oxygene.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. module.exports = function(hljs) {
  2. var OXYGENE_KEYWORDS = 'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue '+
  3. 'create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false '+
  4. 'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited '+
  5. 'inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of '+
  6. 'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly '+
  7. 'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple '+
  8. 'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal '+
  9. 'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained';
  10. var CURLY_COMMENT = hljs.COMMENT(
  11. '{',
  12. '}',
  13. {
  14. relevance: 0
  15. }
  16. );
  17. var PAREN_COMMENT = hljs.COMMENT(
  18. '\\(\\*',
  19. '\\*\\)',
  20. {
  21. relevance: 10
  22. }
  23. );
  24. var STRING = {
  25. className: 'string',
  26. begin: '\'', end: '\'',
  27. contains: [{begin: '\'\''}]
  28. };
  29. var CHAR_STRING = {
  30. className: 'string', begin: '(#\\d+)+'
  31. };
  32. var FUNCTION = {
  33. className: 'function',
  34. beginKeywords: 'function constructor destructor procedure method', end: '[:;]',
  35. keywords: 'function constructor|10 destructor|10 procedure|10 method|10',
  36. contains: [
  37. hljs.TITLE_MODE,
  38. {
  39. className: 'params',
  40. begin: '\\(', end: '\\)',
  41. keywords: OXYGENE_KEYWORDS,
  42. contains: [STRING, CHAR_STRING]
  43. },
  44. CURLY_COMMENT, PAREN_COMMENT
  45. ]
  46. };
  47. return {
  48. case_insensitive: true,
  49. lexemes: /\.?\w+/,
  50. keywords: OXYGENE_KEYWORDS,
  51. illegal: '("|\\$[G-Zg-z]|\\/\\*|</|=>|->)',
  52. contains: [
  53. CURLY_COMMENT, PAREN_COMMENT, hljs.C_LINE_COMMENT_MODE,
  54. STRING, CHAR_STRING,
  55. hljs.NUMBER_MODE,
  56. FUNCTION,
  57. {
  58. className: 'class',
  59. begin: '=\\bclass\\b', end: 'end;',
  60. keywords: OXYGENE_KEYWORDS,
  61. contains: [
  62. STRING, CHAR_STRING,
  63. CURLY_COMMENT, PAREN_COMMENT, hljs.C_LINE_COMMENT_MODE,
  64. FUNCTION
  65. ]
  66. }
  67. ]
  68. };
  69. };