axapta.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. Language: Microsoft X++
  3. Description: X++ is a language used in Microsoft Dynamics 365, Dynamics AX, and Axapta.
  4. Author: Dmitri Roudakov <dmitri@roudakov.ru>
  5. Website: https://dynamics.microsoft.com/en-us/ax-overview/
  6. Category: enterprise
  7. */
  8. /** @type LanguageFn */
  9. function axapta(hljs) {
  10. const BUILT_IN_KEYWORDS = [
  11. 'anytype',
  12. 'boolean',
  13. 'byte',
  14. 'char',
  15. 'container',
  16. 'date',
  17. 'double',
  18. 'enum',
  19. 'guid',
  20. 'int',
  21. 'int64',
  22. 'long',
  23. 'real',
  24. 'short',
  25. 'str',
  26. 'utcdatetime',
  27. 'var'
  28. ];
  29. const LITERAL_KEYWORDS = [
  30. 'default',
  31. 'false',
  32. 'null',
  33. 'true'
  34. ];
  35. const NORMAL_KEYWORDS = [
  36. 'abstract',
  37. 'as',
  38. 'asc',
  39. 'avg',
  40. 'break',
  41. 'breakpoint',
  42. 'by',
  43. 'byref',
  44. 'case',
  45. 'catch',
  46. 'changecompany',
  47. 'class',
  48. 'client',
  49. 'client',
  50. 'common',
  51. 'const',
  52. 'continue',
  53. 'count',
  54. 'crosscompany',
  55. 'delegate',
  56. 'delete_from',
  57. 'desc',
  58. 'display',
  59. 'div',
  60. 'do',
  61. 'edit',
  62. 'else',
  63. 'eventhandler',
  64. 'exists',
  65. 'extends',
  66. 'final',
  67. 'finally',
  68. 'firstfast',
  69. 'firstonly',
  70. 'firstonly1',
  71. 'firstonly10',
  72. 'firstonly100',
  73. 'firstonly1000',
  74. 'flush',
  75. 'for',
  76. 'forceliterals',
  77. 'forcenestedloop',
  78. 'forceplaceholders',
  79. 'forceselectorder',
  80. 'forupdate',
  81. 'from',
  82. 'generateonly',
  83. 'group',
  84. 'hint',
  85. 'if',
  86. 'implements',
  87. 'in',
  88. 'index',
  89. 'insert_recordset',
  90. 'interface',
  91. 'internal',
  92. 'is',
  93. 'join',
  94. 'like',
  95. 'maxof',
  96. 'minof',
  97. 'mod',
  98. 'namespace',
  99. 'new',
  100. 'next',
  101. 'nofetch',
  102. 'notexists',
  103. 'optimisticlock',
  104. 'order',
  105. 'outer',
  106. 'pessimisticlock',
  107. 'print',
  108. 'private',
  109. 'protected',
  110. 'public',
  111. 'readonly',
  112. 'repeatableread',
  113. 'retry',
  114. 'return',
  115. 'reverse',
  116. 'select',
  117. 'server',
  118. 'setting',
  119. 'static',
  120. 'sum',
  121. 'super',
  122. 'switch',
  123. 'this',
  124. 'throw',
  125. 'try',
  126. 'ttsabort',
  127. 'ttsbegin',
  128. 'ttscommit',
  129. 'unchecked',
  130. 'update_recordset',
  131. 'using',
  132. 'validtimestate',
  133. 'void',
  134. 'where',
  135. 'while'
  136. ];
  137. const KEYWORDS = {
  138. keyword: NORMAL_KEYWORDS,
  139. built_in: BUILT_IN_KEYWORDS,
  140. literal: LITERAL_KEYWORDS
  141. };
  142. return {
  143. name: 'X++',
  144. aliases: ['x++'],
  145. keywords: KEYWORDS,
  146. contains: [
  147. hljs.C_LINE_COMMENT_MODE,
  148. hljs.C_BLOCK_COMMENT_MODE,
  149. hljs.APOS_STRING_MODE,
  150. hljs.QUOTE_STRING_MODE,
  151. hljs.C_NUMBER_MODE,
  152. {
  153. className: 'meta',
  154. begin: '#',
  155. end: '$'
  156. },
  157. {
  158. className: 'class',
  159. beginKeywords: 'class interface',
  160. end: /\{/,
  161. excludeEnd: true,
  162. illegal: ':',
  163. contains: [
  164. {
  165. beginKeywords: 'extends implements'
  166. },
  167. hljs.UNDERSCORE_TITLE_MODE
  168. ]
  169. }
  170. ]
  171. };
  172. }
  173. module.exports = axapta;