groovy.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.highlight.languages.groovy"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.highlight.languages.groovy"] = true;
  8. dojo.provide("dojox.highlight.languages.groovy");
  9. dojo.require("dojox.highlight._base");
  10. (function(){
  11. var dh = dojox.highlight, dhc = dh.constants;
  12. var GROOVY_KEYWORDS = {
  13. 'false': 1, 'int': 1, 'float': 1, 'while': 1, 'private': 1,
  14. 'char': 1, 'catch': 1, 'abstract': 1, 'assert': 1,
  15. 'const': 1, 'byte': 1, 'for': 1, 'final': 1,
  16. 'finally': 1, 'implements': 1, 'import': 1, 'extends': 1,
  17. 'long': 1, 'throw': 1, 'instanceof': 2, 'static': 1,
  18. 'protected': 1, 'boolean': 1, 'interface': 2, 'native': 1,
  19. 'if': 1, 'public': 1, 'new': 1, 'do': 1, 'return': 1,
  20. 'goto': 1, 'package': 2, 'void': 2, 'short': 1, 'else': 1,
  21. 'break': 1, 'new': 1, 'strictfp': 1, 'super': 1, 'true': 1,
  22. 'class': 1, 'synchronized': 1, 'case': 1, 'this': 1, 'short': 1,
  23. 'throws': 1, 'transient': 1, 'double': 1, 'volatile': 1,
  24. 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'def': 2
  25. }
  26. dh.languages.groovy = {
  27. // summary: Groovy highlight definitions
  28. defaultMode: {
  29. lexems: [dhc.UNDERSCORE_IDENT_RE],
  30. illegal: '</',
  31. contains: ['comment', 'string', 'number', 'function', 'block'],
  32. keywords: GROOVY_KEYWORDS
  33. },
  34. modes: [
  35. dhc.C_LINE_COMMENT_MODE,
  36. dhc.C_BLOCK_COMMENT_MODE,
  37. dhc.C_NUMBER_MODE,
  38. {
  39. className: 'string',
  40. begin: '\"\"\"', end: '\"\"\"',
  41. contains: ['escape'],
  42. relevance: 0
  43. },
  44. dhc.QUOTE_STRING_MODE,
  45. dhc.BACKSLASH_ESCAPE,
  46. {
  47. className: 'string',
  48. begin: '\'\'\'', end: '\'\'\'',
  49. contains: ['escape'],
  50. relevance: 0
  51. },
  52. dhc.APOS_STRING_MODE,
  53. {
  54. className: 'function',
  55. begin: '\\(',
  56. end: '\\)',
  57. contains: ['comment', 'number', 'string', 'function', 'block'],
  58. keywords: GROOVY_KEYWORDS
  59. },
  60. {
  61. lexems: [dhc.UNDERSCORE_IDENT_RE],
  62. className: 'block',
  63. begin: '\\{',
  64. end: '\\}',
  65. contains: ['comment', 'string', 'number', 'function', 'block'],
  66. keywords: GROOVY_KEYWORDS
  67. }
  68. ],
  69. //exporting constants
  70. GROOVY_KEYWORDS: GROOVY_KEYWORDS
  71. };
  72. })();
  73. }