java.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.java"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.highlight.languages.java"] = true;
  8. dojo.provide("dojox.highlight.languages.java");
  9. dojo.require("dojox.highlight._base");
  10. (function(){
  11. var dh = dojox.highlight, dhc = dh.constants;
  12. var javakeywords = {
  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
  25. }
  26. dh.languages.java = {
  27. // summary: Java highlight definitions
  28. defaultMode: {
  29. lexems: [dhc.UNDERSCORE_IDENT_RE],
  30. illegal: '</',
  31. contains: ['comment', 'string', 'number', 'function','block'],
  32. keywords: javakeywords
  33. },
  34. modes: [
  35. dhc.C_LINE_COMMENT_MODE,
  36. dhc.C_BLOCK_COMMENT_MODE,
  37. dhc.C_NUMBER_MODE,
  38. dhc.QUOTE_STRING_MODE,
  39. dhc.BACKSLASH_ESCAPE,
  40. {
  41. className: 'string',
  42. begin: '\'',
  43. end: '[^\\\\]\'',
  44. illegal: '[^\\\\][^\']'
  45. },
  46. {
  47. className: 'function',
  48. begin: '\\(',
  49. end: '\\)',
  50. contains: ['comment', 'number', 'string', 'function', 'block'],
  51. keywords: javakeywords
  52. },
  53. {
  54. lexems: [dhc.UNDERSCORE_IDENT_RE],
  55. className: 'block',
  56. begin: '\\{',
  57. end: '\\}',
  58. contains: ['comment', 'string', 'number', 'function','block'],
  59. keywords: javakeywords
  60. }
  61. ]
  62. };
  63. })();
  64. }