oxygene.js 2.9 KB

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