cpp.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.cpp"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.highlight.languages.cpp"] = true;
  8. dojo.provide("dojox.highlight.languages.cpp");
  9. dojo.require("dojox.highlight._base");
  10. (function(){
  11. var dh = dojox.highlight, dhc = dh.constants;
  12. dh.languages.cpp = {
  13. // summary: C++ highlight definitions
  14. defaultMode: {
  15. lexems: [dhc.UNDERSCORE_IDENT_RE],
  16. illegal: '</',
  17. contains: ['comment', 'string', 'number', 'preprocessor'],
  18. keywords: {
  19. 'false': 1, 'int': 1, 'float': 1, 'while': 1, 'private': 1,
  20. 'char': 1, 'catch': 1, 'export': 1, 'virtual': 1,
  21. 'operator': 2, 'sizeof': 2, 'dynamic_cast': 2, 'typedef': 2,
  22. 'const_cast': 2, 'const': 1, 'struct': 1, 'for': 1,
  23. 'static_cast': 2, 'union': 1, 'namespace': 1, 'unsigned': 1,
  24. 'long': 1, 'throw': 1, 'volatile': 2, 'static': 1,
  25. 'protected': 1, 'bool': 1, 'template': 1, 'mutable': 1,
  26. 'if': 1, 'public': 1, 'friend': 2, 'do': 1, 'return': 1,
  27. 'goto': 1, 'auto': 1, 'void': 2, 'enum': 1, 'else': 1,
  28. 'break': 1, 'new': 1, 'extern': 1, 'using': 1, 'true': 1,
  29. 'class': 1, 'asm': 1, 'case': 1, 'typeid': 1, 'short': 1,
  30. 'reinterpret_cast': 2, 'default': 1, 'double': 1,
  31. 'register': 1, 'explicit': 1, 'signed': 1, 'typename': 1,
  32. 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'wchar_t': 1,
  33. 'inline': 1, 'delete': 1
  34. }
  35. },
  36. modes: [
  37. dhc.C_LINE_COMMENT_MODE,
  38. dhc.C_BLOCK_COMMENT_MODE,
  39. dhc.C_NUMBER_MODE,
  40. dhc.QUOTE_STRING_MODE,
  41. dhc.BACKSLASH_ESCAPE,
  42. {
  43. className: 'string',
  44. begin: '\'',
  45. end: '[^\\\\]\'',
  46. illegal: '[^\\\\][^\']'
  47. },
  48. {
  49. className: 'preprocessor',
  50. begin: '#', end: '$'
  51. }
  52. ]
  53. };
  54. })();
  55. }