@mpeggroup/mpeg-sdl-parser 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +337 -0
  3. package/bun.lock +65 -0
  4. package/dist/index.js +11829 -0
  5. package/grammar/sdl.ebnf.grammar +399 -0
  6. package/grammar/sdl.lezer.grammar +629 -0
  7. package/index.ts +83 -0
  8. package/package.json +61 -0
  9. package/src/analyser/checks/check-array-definition.ts +90 -0
  10. package/src/analyser/checks/check-array-element-access.ts +31 -0
  11. package/src/analyser/checks/check-class-declaration.ts +417 -0
  12. package/src/analyser/checks/check-computed-array-definition.ts +44 -0
  13. package/src/analyser/checks/check-computed-elementary-type-definition.ts +45 -0
  14. package/src/analyser/checks/check-elementary-type-definition.ts +167 -0
  15. package/src/analyser/checks/check-expression-binary.ts +242 -0
  16. package/src/analyser/checks/check-expression-lengthof.ts +34 -0
  17. package/src/analyser/checks/check-expression-unary.ts +166 -0
  18. package/src/analyser/checks/check-identifier.ts +71 -0
  19. package/src/analyser/checks/check-if-statement.ts +164 -0
  20. package/src/analyser/checks/check-map-declaration.ts +180 -0
  21. package/src/analyser/checks/check-map-definition.ts +118 -0
  22. package/src/analyser/checks/check-number-literal-float.ts +28 -0
  23. package/src/analyser/checks/check-parameter-list.ts +42 -0
  24. package/src/analyser/checks/check-specification.ts +53 -0
  25. package/src/analyser/checks/check-switch-statement.ts +206 -0
  26. package/src/analyser/checks/check.ts +20 -0
  27. package/src/analyser/create-sdl-analyser.ts +85 -0
  28. package/src/analyser/node-handler/abstract-analysis-node-handler.ts +626 -0
  29. package/src/analyser/node-handler/build-symbol-table-node-handler.ts +649 -0
  30. package/src/analyser/node-handler/specific-check-node-handler.ts +46 -0
  31. package/src/analyser/node-handler/validate-scope-node-handler.ts +290 -0
  32. package/src/analyser/node-handler/validate-type-node-handler.ts +497 -0
  33. package/src/analyser/sdl-analyser.ts +119 -0
  34. package/src/analyser/symbol-table.ts +388 -0
  35. package/src/analyser/util/symbol-table-utils.ts +458 -0
  36. package/src/analyser/util/type-utils.ts +238 -0
  37. package/src/ast/build/consume/consume-abstract-node.ts +199 -0
  38. package/src/ast/build/consume/consume-ast-node.ts +400 -0
  39. package/src/ast/build/consume/consume-primitive.ts +59 -0
  40. package/src/ast/build/consume/consume-trivia.ts +96 -0
  41. package/src/ast/build/consume/consume-white-space-and-missing-errors.ts +27 -0
  42. package/src/ast/build/node/build-aggregate-output-value.ts +57 -0
  43. package/src/ast/build/node/build-aligned-modifier.ts +99 -0
  44. package/src/ast/build/node/build-array-definition.ts +131 -0
  45. package/src/ast/build/node/build-array-element-access.ts +45 -0
  46. package/src/ast/build/node/build-base64-string-literal.ts +41 -0
  47. package/src/ast/build/node/build-binary-expression.ts +113 -0
  48. package/src/ast/build/node/build-binary-literal.ts +37 -0
  49. package/src/ast/build/node/build-bit-modifier.ts +86 -0
  50. package/src/ast/build/node/build-case-clause.ts +101 -0
  51. package/src/ast/build/node/build-class-declaration.ts +124 -0
  52. package/src/ast/build/node/build-class-definition.ts +56 -0
  53. package/src/ast/build/node/build-class-id-range.ts +32 -0
  54. package/src/ast/build/node/build-class-id.ts +19 -0
  55. package/src/ast/build/node/build-class-member-access.ts +27 -0
  56. package/src/ast/build/node/build-compound-statement.ts +33 -0
  57. package/src/ast/build/node/build-computed-array-definition.ts +53 -0
  58. package/src/ast/build/node/build-computed-elementary-type-definition.ts +100 -0
  59. package/src/ast/build/node/build-decimal-literal.ts +15 -0
  60. package/src/ast/build/node/build-default-clause.ts +76 -0
  61. package/src/ast/build/node/build-do-statement.ts +71 -0
  62. package/src/ast/build/node/build-elementary-type-definition.ts +164 -0
  63. package/src/ast/build/node/build-elementary-type-output-value.ts +25 -0
  64. package/src/ast/build/node/build-elementary-type.ts +36 -0
  65. package/src/ast/build/node/build-expandable-modifier.ts +68 -0
  66. package/src/ast/build/node/build-explicit-array-dimension.ts +37 -0
  67. package/src/ast/build/node/build-expression-statement.ts +31 -0
  68. package/src/ast/build/node/build-extended-class-id-range.ts +27 -0
  69. package/src/ast/build/node/build-extends-modifier.ts +41 -0
  70. package/src/ast/build/node/build-floating-point-literal.ts +15 -0
  71. package/src/ast/build/node/build-for-statement.ts +117 -0
  72. package/src/ast/build/node/build-hexadecimal-literal.ts +38 -0
  73. package/src/ast/build/node/build-identifier.ts +8 -0
  74. package/src/ast/build/node/build-if-statement.ts +82 -0
  75. package/src/ast/build/node/build-implicit-array-dimension.ts +78 -0
  76. package/src/ast/build/node/build-integer-literal.ts +15 -0
  77. package/src/ast/build/node/build-length-attribute.ts +48 -0
  78. package/src/ast/build/node/build-lengthof-expression.ts +45 -0
  79. package/src/ast/build/node/build-map-declaration.ts +110 -0
  80. package/src/ast/build/node/build-map-definition.ts +103 -0
  81. package/src/ast/build/node/build-map-entry.ts +33 -0
  82. package/src/ast/build/node/build-missing-error.ts +10 -0
  83. package/src/ast/build/node/build-multiple-character-literal.ts +65 -0
  84. package/src/ast/build/node/build-parameter-list.ts +50 -0
  85. package/src/ast/build/node/build-parameter-value-list.ts +54 -0
  86. package/src/ast/build/node/build-parameter.ts +47 -0
  87. package/src/ast/build/node/build-partial-array-dimension.ts +55 -0
  88. package/src/ast/build/node/build-specification.ts +24 -0
  89. package/src/ast/build/node/build-string-definition.ts +106 -0
  90. package/src/ast/build/node/build-switch-statement.ts +84 -0
  91. package/src/ast/build/node/build-token.ts +26 -0
  92. package/src/ast/build/node/build-unary-expression.ts +109 -0
  93. package/src/ast/build/node/build-unexpected-error.ts +14 -0
  94. package/src/ast/build/node/build-utf-string-literal.ts +110 -0
  95. package/src/ast/build/node/build-while-statement.ts +55 -0
  96. package/src/ast/build/util/array-dimension-kind-by-token-type-id-map.ts +167 -0
  97. package/src/ast/build/util/binary-operator-kind-by-token-type-id-map.ts +152 -0
  98. package/src/ast/build/util/build-context.ts +36 -0
  99. package/src/ast/build/util/class-id-kind-by-token-type-id-map.ts +160 -0
  100. package/src/ast/build/util/expression-kind-by-token-type-id-map.ts +168 -0
  101. package/src/ast/build/util/fetch-node.ts +433 -0
  102. package/src/ast/build/util/node-kind-by-token-type-id-map.ts +202 -0
  103. package/src/ast/build/util/statement-kind-by-token-type-id-map.ts +210 -0
  104. package/src/ast/build/util/string-literal-kind-by-token-type-id-map.ts +162 -0
  105. package/src/ast/build/util/token-kind-by-token-type-id-map.ts +337 -0
  106. package/src/ast/build-ast.ts +114 -0
  107. package/src/ast/node/abstract-array-definition.ts +17 -0
  108. package/src/ast/node/abstract-array-dimension.ts +20 -0
  109. package/src/ast/node/abstract-class-id.ts +13 -0
  110. package/src/ast/node/abstract-composite-node.ts +58 -0
  111. package/src/ast/node/abstract-elementary-type-definition.ts +29 -0
  112. package/src/ast/node/abstract-expression.ts +13 -0
  113. package/src/ast/node/abstract-leaf-node.ts +10 -0
  114. package/src/ast/node/abstract-node.ts +16 -0
  115. package/src/ast/node/abstract-statement.ts +13 -0
  116. package/src/ast/node/aggregate-output-value.ts +28 -0
  117. package/src/ast/node/aligned-modifier.ts +21 -0
  118. package/src/ast/node/array-definition.ts +44 -0
  119. package/src/ast/node/array-element-access.ts +24 -0
  120. package/src/ast/node/binary-expression.ts +28 -0
  121. package/src/ast/node/bit-modifier.ts +24 -0
  122. package/src/ast/node/case-clause.ts +30 -0
  123. package/src/ast/node/class-declaration.ts +39 -0
  124. package/src/ast/node/class-definition.ts +23 -0
  125. package/src/ast/node/class-id-range.ts +17 -0
  126. package/src/ast/node/class-id.ts +14 -0
  127. package/src/ast/node/class-member-access.ts +19 -0
  128. package/src/ast/node/compound-statement.ts +19 -0
  129. package/src/ast/node/computed-array-definition.ts +26 -0
  130. package/src/ast/node/computed-elementary-type-definition.ts +34 -0
  131. package/src/ast/node/default-clause.ts +26 -0
  132. package/src/ast/node/do-statement.ts +28 -0
  133. package/src/ast/node/elementary-type-definition.ts +49 -0
  134. package/src/ast/node/elementary-type-output-value.ts +19 -0
  135. package/src/ast/node/elementary-type.ts +18 -0
  136. package/src/ast/node/enum/array-dimension-kind.ts +11 -0
  137. package/src/ast/node/enum/binary-operator-kind.ts +41 -0
  138. package/src/ast/node/enum/class-id-kind.ts +12 -0
  139. package/src/ast/node/enum/elementary-type-kind.ts +13 -0
  140. package/src/ast/node/enum/expression-kind.ts +11 -0
  141. package/src/ast/node/enum/node-kind.ts +57 -0
  142. package/src/ast/node/enum/number-literal-kind.ts +17 -0
  143. package/src/ast/node/enum/statement-kind.ts +37 -0
  144. package/src/ast/node/enum/string-literal-kind.ts +13 -0
  145. package/src/ast/node/enum/string-variable-kind.ts +25 -0
  146. package/src/ast/node/enum/token-kind.ts +87 -0
  147. package/src/ast/node/expandable-modifier.ts +21 -0
  148. package/src/ast/node/explicit-array-dimension.ts +26 -0
  149. package/src/ast/node/expression-statement.ts +23 -0
  150. package/src/ast/node/extended-class-id-range.ts +20 -0
  151. package/src/ast/node/extends-modifier.ts +21 -0
  152. package/src/ast/node/for-statement.ts +29 -0
  153. package/src/ast/node/identifier.ts +12 -0
  154. package/src/ast/node/if-statement.ts +28 -0
  155. package/src/ast/node/implicit-array-dimension.ts +34 -0
  156. package/src/ast/node/length-attribute.ts +24 -0
  157. package/src/ast/node/length-of-expression.ts +21 -0
  158. package/src/ast/node/map-declaration.ts +34 -0
  159. package/src/ast/node/map-definition.ts +27 -0
  160. package/src/ast/node/map-entry.ts +18 -0
  161. package/src/ast/node/missing-error.ts +9 -0
  162. package/src/ast/node/number-literal.ts +18 -0
  163. package/src/ast/node/parameter-list.ts +25 -0
  164. package/src/ast/node/parameter-value-list.ts +29 -0
  165. package/src/ast/node/parameter.ts +20 -0
  166. package/src/ast/node/partial-array-dimension.ts +28 -0
  167. package/src/ast/node/specification.ts +21 -0
  168. package/src/ast/node/string-definition.ts +28 -0
  169. package/src/ast/node/string-literal.ts +21 -0
  170. package/src/ast/node/switch-statement.ts +32 -0
  171. package/src/ast/node/token.ts +20 -0
  172. package/src/ast/node/trivia.ts +13 -0
  173. package/src/ast/node/unary-expression.ts +31 -0
  174. package/src/ast/node/unexpected-error.ts +12 -0
  175. package/src/ast/node/while-statement.ts +26 -0
  176. package/src/ast/util/types.ts +138 -0
  177. package/src/ast/visitor/node-handler.ts +15 -0
  178. package/src/ast/visitor/node-visitor.ts +13 -0
  179. package/src/ast/visitor/traversing-visitor.ts +69 -0
  180. package/src/completion/completion-rules.ts +447 -0
  181. package/src/completion/get-potential-syntactic-tokens.ts +54 -0
  182. package/src/completion/get-potential-token-type-ids.ts +116 -0
  183. package/src/completion/hierarchical-map.ts +43 -0
  184. package/src/completion/rules/abstract-types.ts +174 -0
  185. package/src/completion/rules/aggregate-output-value-rules.ts +48 -0
  186. package/src/completion/rules/aligned-modifier-rules.ts +45 -0
  187. package/src/completion/rules/array-definition-rules.ts +87 -0
  188. package/src/completion/rules/array-element-access-rules.ts +22 -0
  189. package/src/completion/rules/assignment-expression-rules.ts +19 -0
  190. package/src/completion/rules/binary-expression-rules.ts +23 -0
  191. package/src/completion/rules/bit-modifier-rules.ts +25 -0
  192. package/src/completion/rules/case-clause-rules.ts +39 -0
  193. package/src/completion/rules/class-declaration-rules.ts +81 -0
  194. package/src/completion/rules/class-definition-rules.ts +28 -0
  195. package/src/completion/rules/class-id-range-rules.ts +17 -0
  196. package/src/completion/rules/class-id-rules.ts +9 -0
  197. package/src/completion/rules/class-member-access-rules.ts +7 -0
  198. package/src/completion/rules/compound-statement-rules.ts +25 -0
  199. package/src/completion/rules/computed-array-definition-rules.ts +25 -0
  200. package/src/completion/rules/computed-elementary-type-rules.ts +44 -0
  201. package/src/completion/rules/default-clause-rules.ts +23 -0
  202. package/src/completion/rules/do-statement-rules.ts +38 -0
  203. package/src/completion/rules/elementary-type-definition-rules.ts +62 -0
  204. package/src/completion/rules/elementary-type-output-value-rules.ts +13 -0
  205. package/src/completion/rules/elementary-type-rules.ts +18 -0
  206. package/src/completion/rules/expandable-modifier-rules.ts +21 -0
  207. package/src/completion/rules/explicit-array-dimension-rules.ts +22 -0
  208. package/src/completion/rules/expression-statement-rules.ts +22 -0
  209. package/src/completion/rules/extended-class-id-range-rules.ts +17 -0
  210. package/src/completion/rules/extends-modifier-rules.ts +17 -0
  211. package/src/completion/rules/for-statement-rules.ts +51 -0
  212. package/src/completion/rules/if-statement-rules.ts +42 -0
  213. package/src/completion/rules/implicit-array-dimension-rules.ts +21 -0
  214. package/src/completion/rules/length-attribute-rules.ts +19 -0
  215. package/src/completion/rules/lengthof-expression-rules.ts +23 -0
  216. package/src/completion/rules/map-declaration-rules.ts +45 -0
  217. package/src/completion/rules/map-definition-rules.ts +46 -0
  218. package/src/completion/rules/map-entry-rules.ts +17 -0
  219. package/src/completion/rules/parameter-list-rules.ts +21 -0
  220. package/src/completion/rules/parameter-rules.ts +17 -0
  221. package/src/completion/rules/parameter-value-list-rules.ts +27 -0
  222. package/src/completion/rules/partial-array-dimension-rules.ts +33 -0
  223. package/src/completion/rules/specification-rules.ts +37 -0
  224. package/src/completion/rules/string-definition-rules.ts +103 -0
  225. package/src/completion/rules/switch-statement-rules.ts +50 -0
  226. package/src/completion/rules/unary-expression-rules.ts +41 -0
  227. package/src/completion/rules/utf-string-literal-rules.ts +17 -0
  228. package/src/completion/rules/while-statement-rules.ts +38 -0
  229. package/src/lezer/context-tracker.ts +45 -0
  230. package/src/lezer/create-sdl-parser.ts +88 -0
  231. package/src/lezer/create-syntax-error-from-text-and-cursor.ts +110 -0
  232. package/src/lezer/create-syntax-error-from-text-and-position.ts +36 -0
  233. package/src/lezer/parser.terms.ts +129 -0
  234. package/src/lezer/parser.ts +63 -0
  235. package/src/lezer/props/fold-node-prop-source.ts +27 -0
  236. package/src/lezer/props/primitive-node-prop-source.ts +19 -0
  237. package/src/lezer/props/style-tags-node-prop-source.ts +188 -0
  238. package/src/lezer/props/syntactic-token-node-prop-source.ts +298 -0
  239. package/src/lezer/sdl-string-input.ts +46 -0
  240. package/src/location.ts +13 -0
  241. package/src/parse-helper.ts +93 -0
  242. package/src/prettier/prettier-plugin-sdl.ts +89 -0
  243. package/src/prettier/print-abstract-array-dimension.ts +84 -0
  244. package/src/prettier/print-abstract-class-id.ts +53 -0
  245. package/src/prettier/print-abstract-expression.ts +168 -0
  246. package/src/prettier/print-abstract-node.ts +224 -0
  247. package/src/prettier/print-abstract-statement.ts +124 -0
  248. package/src/prettier/print-aggregate-output-value.ts +35 -0
  249. package/src/prettier/print-aligned-modifier.ts +50 -0
  250. package/src/prettier/print-array-definition.ts +95 -0
  251. package/src/prettier/print-array-element-access.ts +14 -0
  252. package/src/prettier/print-bit-modifier.ts +48 -0
  253. package/src/prettier/print-case-clause.ts +58 -0
  254. package/src/prettier/print-class-declaration.ts +99 -0
  255. package/src/prettier/print-class-definition.ts +44 -0
  256. package/src/prettier/print-class-member-access.ts +13 -0
  257. package/src/prettier/print-computed-array-definition.ts +33 -0
  258. package/src/prettier/print-computed-elementary-type-definition.ts +60 -0
  259. package/src/prettier/print-default-clause.ts +39 -0
  260. package/src/prettier/print-do-statement.ts +31 -0
  261. package/src/prettier/print-elementary-type-definition.ts +108 -0
  262. package/src/prettier/print-elementary-type-output-value.ts +13 -0
  263. package/src/prettier/print-elementary-type.ts +28 -0
  264. package/src/prettier/print-expandable-modifier.ts +41 -0
  265. package/src/prettier/print-extends-modifier.ts +29 -0
  266. package/src/prettier/print-for-statement.ts +64 -0
  267. package/src/prettier/print-identifier.ts +10 -0
  268. package/src/prettier/print-if-statement.ts +76 -0
  269. package/src/prettier/print-length-attribute.ts +14 -0
  270. package/src/prettier/print-map-declaration.ts +75 -0
  271. package/src/prettier/print-map-definition.ts +67 -0
  272. package/src/prettier/print-map-entry.ts +22 -0
  273. package/src/prettier/print-number-literal.ts +84 -0
  274. package/src/prettier/print-parameter-list.ts +20 -0
  275. package/src/prettier/print-parameter-value-list.ts +20 -0
  276. package/src/prettier/print-parameter.ts +34 -0
  277. package/src/prettier/print-specification.ts +51 -0
  278. package/src/prettier/print-string-definition.ts +114 -0
  279. package/src/prettier/print-string-literal.ts +57 -0
  280. package/src/prettier/print-switch-statement.ts +46 -0
  281. package/src/prettier/print-token.ts +7 -0
  282. package/src/prettier/print-unexpected-error.ts +10 -0
  283. package/src/prettier/print-while-statement.ts +26 -0
  284. package/src/prettier/util/print-utils.ts +607 -0
  285. package/src/prettier/util/types.ts +40 -0
  286. package/src/scanner-error.ts +65 -0
  287. package/src/util/location-utils.ts +16 -0
  288. package/src/util/logger.ts +165 -0
  289. package/tests/analyser/create-sdl-analyser.test.ts +54 -0
  290. package/tests/analyser/get-sdl-analyser-test-scenarios.ts +80 -0
  291. package/tests/analyser/sdl-analyser-scenarios.test.ts +67 -0
  292. package/tests/analyser/semantic-error-scenarios.test.ts +40 -0
  293. package/tests/analyser/symbol-table.test.ts +188 -0
  294. package/tests/analyser/test-cases/array_definition.txt +50 -0
  295. package/tests/analyser/test-cases/class_declaration.txt +112 -0
  296. package/tests/analyser/test-cases/class_definition.txt +60 -0
  297. package/tests/analyser/test-cases/compound_statement.txt +63 -0
  298. package/tests/analyser/test-cases/computed_array_definition.txt +12 -0
  299. package/tests/analyser/test-cases/computed_elementary_type_definition.txt +39 -0
  300. package/tests/analyser/test-cases/do_statement.txt +16 -0
  301. package/tests/analyser/test-cases/elementary_type_definition.txt +58 -0
  302. package/tests/analyser/test-cases/expression.txt +159 -0
  303. package/tests/analyser/test-cases/for_statement.txt +55 -0
  304. package/tests/analyser/test-cases/if_statement.txt +57 -0
  305. package/tests/analyser/test-cases/map_declaration.txt +89 -0
  306. package/tests/analyser/test-cases/map_definition.txt +35 -0
  307. package/tests/analyser/test-cases/number_literal.txt +31 -0
  308. package/tests/analyser/test-cases/parameter_list.txt +16 -0
  309. package/tests/analyser/test-cases/scopes.txt +239 -0
  310. package/tests/analyser/test-cases/specification.txt +28 -0
  311. package/tests/analyser/test-cases/string_definition.txt +40 -0
  312. package/tests/analyser/test-cases/switch_statement.txt +96 -0
  313. package/tests/analyser/test-cases/while_statement.txt +16 -0
  314. package/tests/analyser/util/symbol-table-utils.test.ts +65 -0
  315. package/tests/ast/__snapshots__/build-ast.test.ts.snap +38897 -0
  316. package/tests/ast/build-ast.test.ts +463 -0
  317. package/tests/ast/visitor/traversing-visitor.test.ts +36 -0
  318. package/tests/completion/get-potential-syntactic-tokens.test.ts +89 -0
  319. package/tests/completion/get-potential-token-type-ids.test.ts +76 -0
  320. package/tests/completion/test-potential-syntactic-tokens-scenario.ts +24 -0
  321. package/tests/completion/test-potential-token-type-ids-scenario.ts +33 -0
  322. package/tests/fixtures/history-recording-node-handler.ts +232 -0
  323. package/tests/lezer/create-parse-error-from-text-and-position.test.ts +129 -0
  324. package/tests/lezer/create-sdl-parser.test.ts +15 -0
  325. package/tests/lezer/sdl-parser-scenarios.test.ts +24 -0
  326. package/tests/lezer/sdl-string-input.test.ts +12 -0
  327. package/tests/lezer/syntax-error-scenarios.test.ts +114 -0
  328. package/tests/lezer/test-cases/array_definition.txt +109 -0
  329. package/tests/lezer/test-cases/class_declaration.txt +141 -0
  330. package/tests/lezer/test-cases/class_definition.txt +89 -0
  331. package/tests/lezer/test-cases/comment.txt +335 -0
  332. package/tests/lezer/test-cases/compound_statement.txt +109 -0
  333. package/tests/lezer/test-cases/computed_array_definition.txt +33 -0
  334. package/tests/lezer/test-cases/computed_elementary_type_definition.txt +59 -0
  335. package/tests/lezer/test-cases/do_statement.txt +48 -0
  336. package/tests/lezer/test-cases/elementary_type_definition.txt +158 -0
  337. package/tests/lezer/test-cases/expression.txt +1203 -0
  338. package/tests/lezer/test-cases/for_statement.txt +183 -0
  339. package/tests/lezer/test-cases/if_statement.txt +183 -0
  340. package/tests/lezer/test-cases/invalid.txt +97 -0
  341. package/tests/lezer/test-cases/map_declaration.txt +152 -0
  342. package/tests/lezer/test-cases/map_definition.txt +59 -0
  343. package/tests/lezer/test-cases/number_literal.txt +273 -0
  344. package/tests/lezer/test-cases/specification.txt +38 -0
  345. package/tests/lezer/test-cases/string_definition.txt +263 -0
  346. package/tests/lezer/test-cases/string_literal.txt +303 -0
  347. package/tests/lezer/test-cases/switch_statement.txt +407 -0
  348. package/tests/lezer/test-cases/while_statement.txt +45 -0
  349. package/tests/parse-helper.test.ts +361 -0
  350. package/tests/prettier/__snapshots__/prettier-plugin-sdl.test.ts.snap +127 -0
  351. package/tests/prettier/prettier-plugin-sdl.test.ts +58 -0
  352. package/tests/prettier/print-array.test.ts +29 -0
  353. package/tests/prettier/print-class.test.ts +15 -0
  354. package/tests/prettier/print-do.test.ts +25 -0
  355. package/tests/prettier/print-elementary-type.test.ts +62 -0
  356. package/tests/prettier/print-error.test.ts +40 -0
  357. package/tests/prettier/print-expression.test.ts +17 -0
  358. package/tests/prettier/print-for.test.ts +23 -0
  359. package/tests/prettier/print-if.test.ts +71 -0
  360. package/tests/prettier/print-number-literal.test.ts +28 -0
  361. package/tests/prettier/print-specification.test.ts +54 -0
  362. package/tests/prettier/print-string.test.ts +36 -0
  363. package/tests/prettier/print-switch.test.ts +69 -0
  364. package/tests/prettier/print-while.test.ts +23 -0
  365. package/tests/prettier/test-prettier-scenario.ts +41 -0
  366. package/tests/prettier/util/print-utils.test.ts +665 -0
  367. package/tests/prettier/util/types.test.ts +38 -0
  368. package/tests/sample-specifications/invalid.sdl +24 -0
  369. package/tests/sample-specifications/prettified-invalid.sdl +28 -0
  370. package/tests/sample-specifications/prettified-various-elements-narrow.sdl +97 -0
  371. package/tests/sample-specifications/prettified-various-elements.sdl +90 -0
  372. package/tests/sample-specifications/sample.sdl +24 -0
  373. package/tests/sample-specifications/various-elements.sdl +88 -0
  374. package/tests/util/logger.test.ts +36 -0
  375. package/tsconfig.json +29 -0
@@ -0,0 +1,37 @@
1
+ // Generated by Lezer from the SDL grammar
2
+ import * as TokenTypeId from "../../lezer/parser.terms.ts";
3
+
4
+ export const specificationRules = [
5
+ {
6
+ previous: -1,
7
+ expected: [
8
+ TokenTypeId.ClassDeclaration,
9
+ TokenTypeId.MapDeclaration,
10
+ TokenTypeId.ComputedElementaryTypeDefinition,
11
+ ],
12
+ },
13
+ {
14
+ previous: TokenTypeId.ClassDeclaration,
15
+ expected: [
16
+ TokenTypeId.ClassDeclaration,
17
+ TokenTypeId.MapDeclaration,
18
+ TokenTypeId.ComputedElementaryTypeDefinition,
19
+ ],
20
+ },
21
+ {
22
+ previous: TokenTypeId.MapDeclaration,
23
+ expected: [
24
+ TokenTypeId.ClassDeclaration,
25
+ TokenTypeId.MapDeclaration,
26
+ TokenTypeId.ComputedElementaryTypeDefinition,
27
+ ],
28
+ },
29
+ {
30
+ previous: TokenTypeId.ComputedElementaryTypeDefinition,
31
+ expected: [
32
+ TokenTypeId.ClassDeclaration,
33
+ TokenTypeId.MapDeclaration,
34
+ TokenTypeId.ComputedElementaryTypeDefinition,
35
+ ],
36
+ },
37
+ ];
@@ -0,0 +1,103 @@
1
+ // Generated by Lezer from the SDL grammar
2
+ import * as TokenTypeId from "../../lezer/parser.terms.ts";
3
+
4
+ export const stringDefinitionRules = [
5
+ {
6
+ previous: [
7
+ TokenTypeId.utf8string,
8
+ TokenTypeId.Identifier,
9
+ TokenTypeId.Assignment,
10
+ ],
11
+ expected: TokenTypeId.UtfStringLiteral,
12
+ },
13
+ {
14
+ previous: [
15
+ TokenTypeId.utf16string,
16
+ TokenTypeId.Identifier,
17
+ TokenTypeId.Assignment,
18
+ ],
19
+ expected: TokenTypeId.UtfStringLiteral,
20
+ },
21
+ {
22
+ previous: [
23
+ TokenTypeId.utfstring,
24
+ TokenTypeId.Identifier,
25
+ TokenTypeId.Assignment,
26
+ ],
27
+ expected: TokenTypeId.UtfStringLiteral,
28
+ },
29
+ {
30
+ previous: [
31
+ TokenTypeId.base64string,
32
+ TokenTypeId.Identifier,
33
+ TokenTypeId.Assignment,
34
+ ],
35
+ expected: TokenTypeId.Base64StringLiteral,
36
+ },
37
+ {
38
+ previous: TokenTypeId.reserved,
39
+ expected: [
40
+ TokenTypeId._const,
41
+ TokenTypeId.AlignedModifier,
42
+ TokenTypeId.utf8string,
43
+ TokenTypeId.utf16string,
44
+ TokenTypeId.utfstring,
45
+ TokenTypeId.base64string,
46
+ ],
47
+ },
48
+ {
49
+ previous: TokenTypeId._const,
50
+ expected: [
51
+ TokenTypeId.AlignedModifier,
52
+ TokenTypeId.utf8string,
53
+ TokenTypeId.utf16string,
54
+ TokenTypeId.utfstring,
55
+ TokenTypeId.base64string,
56
+ ],
57
+ },
58
+ {
59
+ previous: TokenTypeId.AlignedModifier,
60
+ expected: [
61
+ TokenTypeId.utf8string,
62
+ TokenTypeId.utf16string,
63
+ TokenTypeId.utfstring,
64
+ TokenTypeId.base64string,
65
+ ],
66
+ },
67
+ {
68
+ previous: [
69
+ TokenTypeId.utf8string,
70
+ TokenTypeId.Identifier,
71
+ ],
72
+ expected: TokenTypeId.Semicolon,
73
+ },
74
+ {
75
+ previous: [
76
+ TokenTypeId.utf16string,
77
+ TokenTypeId.Identifier,
78
+ ],
79
+ expected: TokenTypeId.Semicolon,
80
+ },
81
+ {
82
+ previous: [
83
+ TokenTypeId.utfstring,
84
+ TokenTypeId.Identifier,
85
+ ],
86
+ expected: TokenTypeId.Semicolon,
87
+ },
88
+ {
89
+ previous: [
90
+ TokenTypeId.base64string,
91
+ TokenTypeId.Identifier,
92
+ ],
93
+ expected: TokenTypeId.Semicolon,
94
+ },
95
+ {
96
+ previous: TokenTypeId.Base64StringLiteral,
97
+ expected: TokenTypeId.Semicolon,
98
+ },
99
+ {
100
+ previous: TokenTypeId.UtfStringLiteral,
101
+ expected: TokenTypeId.Semicolon,
102
+ },
103
+ ];
@@ -0,0 +1,50 @@
1
+ import { binaryOperatorTypes, expressionTypes } from "./abstract-types.ts";
2
+
3
+ // Generated by Lezer from the SDL grammar
4
+ import * as TokenTypeId from "../../lezer/parser.terms.ts";
5
+
6
+ export const switchStatementRules = [
7
+ {
8
+ previous: -1,
9
+ expected: TokenTypeId._switch,
10
+ },
11
+ {
12
+ previous: TokenTypeId._switch,
13
+ expected: TokenTypeId.OpenParenthesis,
14
+ },
15
+ {
16
+ previous: TokenTypeId.OpenParenthesis,
17
+ expected: expressionTypes,
18
+ },
19
+ ...expressionTypes.map((expressionType) => ({
20
+ previous: expressionType,
21
+ expected: [
22
+ TokenTypeId.CloseParenthesis,
23
+ ...binaryOperatorTypes,
24
+ ],
25
+ })),
26
+ {
27
+ previous: TokenTypeId.CloseParenthesis,
28
+ expected: TokenTypeId.OpenBrace,
29
+ },
30
+ {
31
+ previous: TokenTypeId.OpenBrace,
32
+ expected: [
33
+ TokenTypeId.CaseClause,
34
+ TokenTypeId.DefaultClause,
35
+ TokenTypeId.CloseBrace,
36
+ ],
37
+ },
38
+ {
39
+ previous: TokenTypeId.CaseClause,
40
+ expected: [
41
+ TokenTypeId.CaseClause,
42
+ TokenTypeId.DefaultClause,
43
+ TokenTypeId.CloseBrace,
44
+ ],
45
+ },
46
+ {
47
+ previous: TokenTypeId.DefaultClause,
48
+ expected: TokenTypeId.CloseBrace,
49
+ },
50
+ ];
@@ -0,0 +1,41 @@
1
+ import {
2
+ binaryOperatorTypes,
3
+ expressionTypes,
4
+ numberLiteralTypes,
5
+ postfixOperatorTypes,
6
+ unaryOperatorTypes,
7
+ } from "./abstract-types.ts";
8
+
9
+ // Generated by Lezer from the SDL grammar
10
+ import * as TokenTypeId from "../../lezer/parser.terms.ts";
11
+
12
+ export const unaryExpressionRules = [
13
+ {
14
+ previous: -1,
15
+ expected: [
16
+ ...unaryOperatorTypes,
17
+ TokenTypeId.LengthofExpression,
18
+ TokenTypeId.Identifier,
19
+ ...numberLiteralTypes,
20
+ TokenTypeId.OpenParenthesis,
21
+ ],
22
+ },
23
+ ...expressionTypes.map((expressionType) => ({
24
+ previous: expressionType,
25
+ expected: [
26
+ TokenTypeId.ArrayElementAccess,
27
+ TokenTypeId.ClassMemberAccess,
28
+ ...postfixOperatorTypes,
29
+ ...binaryOperatorTypes,
30
+ TokenTypeId.CloseParenthesis,
31
+ ],
32
+ })),
33
+ ...unaryOperatorTypes.map((unaryOperatorType) => ({
34
+ previous: unaryOperatorType,
35
+ expected: expressionTypes,
36
+ })),
37
+ {
38
+ previous: TokenTypeId.OpenParenthesis,
39
+ expected: [...expressionTypes],
40
+ },
41
+ ];
@@ -0,0 +1,17 @@
1
+ // Generated by Lezer from the SDL grammar
2
+ import * as TokenTypeId from "../../lezer/parser.terms.ts";
3
+
4
+ export const utfStringLiteralRules = [
5
+ {
6
+ previous: -1,
7
+ expected: TokenTypeId.UtfPrefix,
8
+ },
9
+ {
10
+ previous: TokenTypeId.UtfStringLiteralCharacters,
11
+ expected: TokenTypeId.DoubleQuote,
12
+ },
13
+ {
14
+ previous: TokenTypeId.DoubleQuote,
15
+ expected: TokenTypeId.UtfPrefix,
16
+ },
17
+ ];
@@ -0,0 +1,38 @@
1
+ import {
2
+ binaryOperatorTypes,
3
+ expressionTypes,
4
+ statementTypes,
5
+ } from "./abstract-types.ts";
6
+
7
+ // Generated by Lezer from the SDL grammar
8
+ import * as TokenTypeId from "../../lezer/parser.terms.ts";
9
+
10
+ export const whileStatementRules = [
11
+ {
12
+ previous: -1,
13
+ expected: TokenTypeId._while,
14
+ },
15
+ {
16
+ previous: TokenTypeId._while,
17
+ expected: TokenTypeId.OpenParenthesis,
18
+ },
19
+ {
20
+ previous: TokenTypeId.OpenParenthesis,
21
+ expected: expressionTypes,
22
+ },
23
+ {
24
+ previous: TokenTypeId.UnaryExpression,
25
+ expected: TokenTypeId.CloseParenthesis,
26
+ },
27
+ ...expressionTypes.map((expressionType) => ({
28
+ previous: expressionType,
29
+ expected: [
30
+ TokenTypeId.CloseParenthesis,
31
+ ...binaryOperatorTypes,
32
+ ],
33
+ })),
34
+ {
35
+ previous: TokenTypeId.CloseParenthesis,
36
+ expected: statementTypes,
37
+ },
38
+ ];
@@ -0,0 +1,45 @@
1
+ import { ContextTracker, LRParser as LezerParser } from "@lezer/lr";
2
+ import getLogger from "../util/logger.ts";
3
+
4
+ const logger = getLogger("contextTracker");
5
+
6
+ /*
7
+ * Define a custom context tracker for debug logging via the framework wide logger
8
+ */
9
+ export function getContextTracker(parser: LezerParser): ContextTracker<number> {
10
+ const contextTracker = new ContextTracker<number>({
11
+ start: 0,
12
+ shift: (_context, term, stack, _input) => {
13
+ const termName = parser.getName(term) ?? "unknown";
14
+
15
+ logger.debug("shift term: %s at position %d", termName, stack.pos);
16
+
17
+ return 0;
18
+ },
19
+ reduce: (_context, term, stack, _input) => {
20
+ const termName = parser.getName(term) ?? "unknown";
21
+
22
+ logger.debug("reduce term: %s at position %d", termName, stack.pos);
23
+
24
+ return 0;
25
+ },
26
+ reuse: (_context, node, stack, _input) => {
27
+ const nodeName = parser.getName(node.type.id) ?? "unknown";
28
+
29
+ logger.debug("reuse node: %s at position %d", nodeName, stack.pos);
30
+
31
+ return 0;
32
+ },
33
+ strict: false,
34
+ });
35
+
36
+ return contextTracker;
37
+ }
38
+
39
+ export const defaultContextTracker = new ContextTracker<number>({
40
+ start: 0,
41
+ shift: (_context, _term, _stack, _input) => 0,
42
+ reduce: (_context, _term, _stack, _input) => 0,
43
+ reuse: (_context, _node, _stack, _input) => 0,
44
+ strict: false,
45
+ });
@@ -0,0 +1,88 @@
1
+ import { LRParser as LezerParser } from "@lezer/lr";
2
+ import { Text } from "@codemirror/state";
3
+ import { type Input } from "@lezer/common";
4
+ import { debugEnabled } from "../util/logger.ts";
5
+ import { getContextTracker } from "./context-tracker.ts";
6
+ import { styleTagsNodePropSource } from "./props/style-tags-node-prop-source.ts";
7
+ import { foldNodePropSource } from "./props/fold-node-prop-source.ts";
8
+ import { primitiveNodePropSource } from "./props/primitive-node-prop-source.ts";
9
+ import { syntacticTokenNodePropSource } from "./props/syntactic-token-node-prop-source.ts";
10
+ import { createSyntaxErrorFromTextAndPosition } from "./create-syntax-error-from-text-and-position.ts";
11
+
12
+ // Generated by Lezer from the SDL grammar
13
+ import { parser } from "./parser.ts";
14
+
15
+ let lenientSdlParser: LezerParser | undefined;
16
+ let strictSdlParser: LezerParser | undefined;
17
+
18
+ /**
19
+ * Create an in memory lenient Lezer based parser using the SDL grammar and store it as a "singleton".
20
+ */
21
+ export function createLenientSdlParser(): LezerParser {
22
+ if (!lenientSdlParser) {
23
+ if (debugEnabled) {
24
+ lenientSdlParser = parser.configure({
25
+ contextTracker: getContextTracker(parser),
26
+ });
27
+ } else {
28
+ lenientSdlParser = parser;
29
+ }
30
+
31
+ // Configure the parser with custom node properties
32
+ lenientSdlParser = lenientSdlParser.configure({
33
+ props: [
34
+ foldNodePropSource,
35
+ primitiveNodePropSource,
36
+ styleTagsNodePropSource,
37
+ syntacticTokenNodePropSource,
38
+ ],
39
+ });
40
+ }
41
+
42
+ return lenientSdlParser;
43
+ }
44
+
45
+ /**
46
+ * Create an in memory strict Lezer based parser using the SDL grammar and store it as a "singleton".
47
+ */
48
+ export function createStrictSdlParser(): LezerParser {
49
+ if (!strictSdlParser) {
50
+ strictSdlParser = createLenientSdlParser().configure({
51
+ strict: true,
52
+ });
53
+
54
+ // Wrap the parser's parse method to catch errors and wrap them in SyntaxError
55
+ const originalParseFunc = strictSdlParser.parse.bind(strictSdlParser);
56
+
57
+ strictSdlParser.parse = (input: Input | string, ...args) => {
58
+ try {
59
+ return originalParseFunc(input, ...args);
60
+ } catch (err) {
61
+ // parse position out of error message which takes the form "No parse at 0"
62
+ const errorMessage = (err as Error).message;
63
+ const match = errorMessage.match(/No parse at (\d+)/);
64
+ let position = 0;
65
+ if (match) {
66
+ const parsed = parseInt(match[1], 10);
67
+ position = isNaN(parsed) ? 0 : parsed;
68
+ }
69
+
70
+ let inputText: string;
71
+
72
+ if (typeof input === "string") {
73
+ inputText = input;
74
+ } else {
75
+ inputText = input.read(0, input.length);
76
+ }
77
+
78
+ const text = Text.of(
79
+ inputText.split("\n"),
80
+ );
81
+
82
+ throw createSyntaxErrorFromTextAndPosition(text, position);
83
+ }
84
+ };
85
+ }
86
+
87
+ return strictSdlParser;
88
+ }
@@ -0,0 +1,110 @@
1
+ import type { Text } from "@codemirror/state";
2
+ import { TreeCursor } from "@lezer/common";
3
+ import { InternalScannerError, SyntaxError } from "../scanner-error.ts";
4
+ import { syntacticTokenNodeProp } from "./props/syntactic-token-node-prop-source.ts";
5
+ import { getPotentialTokenTypeIds } from "../completion/get-potential-token-type-ids.ts";
6
+ import { createSyntaxErrorFromTextAndPosition } from "./create-syntax-error-from-text-and-position.ts";
7
+ import { createLenientSdlParser } from "./create-sdl-parser.ts";
8
+
9
+ const lenientSdlParser = createLenientSdlParser();
10
+
11
+ const nodeSet = lenientSdlParser.nodeSet;
12
+
13
+ /**
14
+ * Helper function to create a SyntaxError from the text and a cursor positioned at an error node.
15
+ * As the cursor from a parse tree is available, details on missing or unexpected tokens can be extracted.
16
+ *
17
+ * @param text The text to parse.
18
+ * @param cursor The cursor position in the text which should be at an error node.
19
+ */
20
+ export function createSyntaxErrorFromTextAndCursor(
21
+ text: Text,
22
+ cursor: TreeCursor,
23
+ ): SyntaxError {
24
+ if (!cursor.type.isError) {
25
+ throw new InternalScannerError(
26
+ "Expected cursor to be an error token, but it is not",
27
+ );
28
+ }
29
+
30
+ // if the error token has a child, the child is an unexpected token
31
+ const unexpectedNode = cursor.firstChild();
32
+
33
+ let message: string = "";
34
+
35
+ if (unexpectedNode) {
36
+ message = "Unexpected: " +
37
+ text.sliceString(cursor.from, cursor.to);
38
+
39
+ return createSyntaxErrorFromTextAndPosition(
40
+ text,
41
+ cursor.from,
42
+ message,
43
+ );
44
+ }
45
+
46
+ // check if the error is for an uknown token
47
+ if (cursor.to > cursor.from) {
48
+ message = "Unknown token: " +
49
+ text.sliceString(cursor.from, cursor.to);
50
+
51
+ return createSyntaxErrorFromTextAndPosition(
52
+ text,
53
+ cursor.from,
54
+ message,
55
+ );
56
+ }
57
+
58
+ // otherwise it is a missing expected token and we should indicate what token(s) or node(s) could be expected here
59
+ const potentialTokenTypeIds = getPotentialTokenTypeIds(
60
+ cursor,
61
+ );
62
+
63
+ if (!potentialTokenTypeIds || potentialTokenTypeIds.length === 0) {
64
+ throw new InternalScannerError(
65
+ "Expected token type IDs not found for parse error at position " +
66
+ cursor.from,
67
+ );
68
+ }
69
+
70
+ const possibleSyntacticTokens: string[] = [];
71
+ const possibleNodes: string[] = [];
72
+ potentialTokenTypeIds.forEach((id) => {
73
+ const type = nodeSet.types[id];
74
+
75
+ if (type.prop(syntacticTokenNodeProp)) {
76
+ possibleSyntacticTokens.push(type.prop(syntacticTokenNodeProp)!);
77
+ } else {
78
+ possibleNodes.push("<" + type.name + ">");
79
+ }
80
+ });
81
+
82
+ // sort strings taking into account that some strings may be integers
83
+ possibleSyntacticTokens.sort((a, b) => {
84
+ const aIsNumber = !isNaN(Number(a));
85
+ const bIsNumber = !isNaN(Number(b));
86
+
87
+ if (aIsNumber && bIsNumber) {
88
+ return Number(a) - Number(b);
89
+ }
90
+ if (aIsNumber) return -1;
91
+ if (bIsNumber) return 1;
92
+ return a.localeCompare(b);
93
+ });
94
+
95
+ possibleNodes.sort();
96
+
97
+ const possibleSyntacticTokensAndNodes = [
98
+ ...possibleSyntacticTokens,
99
+ ...possibleNodes,
100
+ ];
101
+
102
+ message = possibleSyntacticTokensAndNodes.length > 1
103
+ ? "Expected one of: " + possibleSyntacticTokensAndNodes.join(" ")
104
+ : "Expected: " + possibleSyntacticTokensAndNodes[0];
105
+ return createSyntaxErrorFromTextAndPosition(
106
+ text,
107
+ cursor.from,
108
+ message,
109
+ );
110
+ }
@@ -0,0 +1,36 @@
1
+ import type { Text } from "@codemirror/state";
2
+ import { SyntaxError } from "../scanner-error.ts";
3
+ import { getLocationFromTextPosition } from "../util/location-utils.ts";
4
+
5
+ /**
6
+ * Helper function to create a SyntaxError from the text and a position.
7
+ *
8
+ * @param text The text to parse.
9
+ * @param position The position in the text, 0-based.
10
+ * @param message The error message, defaults to "Syntax error".
11
+ */
12
+ export function createSyntaxErrorFromTextAndPosition(
13
+ text: Text,
14
+ position: number,
15
+ message: string = "",
16
+ ): SyntaxError {
17
+ const line = text.lineAt(position);
18
+ const location = getLocationFromTextPosition(text, position);
19
+ const precedingLines = [];
20
+ // Collect up to two preceding lines if available
21
+ if (location.row > 1) {
22
+ // First preceding line (if exists)
23
+ precedingLines.push(text.line(location.row - 1).text);
24
+ // Second preceding line (if exists)
25
+ if (location.row > 2) {
26
+ precedingLines.unshift(text.line(location.row - 2).text);
27
+ }
28
+ }
29
+
30
+ return new SyntaxError(
31
+ message,
32
+ location,
33
+ line.text,
34
+ precedingLines,
35
+ );
36
+ }
@@ -0,0 +1,129 @@
1
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
2
+ export const Whitespace = 1,
3
+ Comment = 2,
4
+ Specification = 3,
5
+ CloseBrace = 4,
6
+ ClassDeclaration = 5,
7
+ AlignedModifier = 6,
8
+ Identifier = 7,
9
+ aligned = 8,
10
+ OpenParenthesis = 9,
11
+ AlignmentBitCount8 = 10,
12
+ AlignmentBitCount16 = 11,
13
+ AlignmentBitCount32 = 12,
14
+ AlignmentBitCount64 = 13,
15
+ AlignmentBitCount128 = 14,
16
+ CloseParenthesis = 15,
17
+ ExpandableModifier = 16,
18
+ expandable = 17,
19
+ IntegerLiteral = 18,
20
+ abstract = 19,
21
+ _class = 20,
22
+ ParameterList = 21,
23
+ Parameter = 22,
24
+ ElementaryType = 23,
25
+ int = 24,
26
+ unsigned = 25,
27
+ float = 26,
28
+ bit = 27,
29
+ Comma = 28,
30
+ ExtendsModifier = 29,
31
+ _extends = 30,
32
+ ParameterValueList = 31,
33
+ BinaryExpression = 32,
34
+ Multiplication = 33,
35
+ Division = 34,
36
+ Modulus = 35,
37
+ Addition = 36,
38
+ Subtraction = 37,
39
+ BitwiseShiftLeft = 38,
40
+ BitwiseShiftRight = 39,
41
+ RelationalLessThan = 40,
42
+ RelationalLessThanOrEqual = 41,
43
+ RelationalGreaterThan = 42,
44
+ RelationalGreaterThanOrEqual = 43,
45
+ RelationalEqual = 44,
46
+ RelationalNotEqual = 45,
47
+ BitwiseAnd = 46,
48
+ BitwiseOr = 47,
49
+ LogicalAnd = 48,
50
+ LogicalOr = 49,
51
+ UnaryExpression = 50,
52
+ CloseBracket = 51,
53
+ OpenBracket = 52,
54
+ ArrayElementAccess = 53,
55
+ ClassMemberAccess = 54,
56
+ Period = 55,
57
+ PostfixIncrement = 56,
58
+ PostfixDecrement = 57,
59
+ UnaryPlus = 58,
60
+ UnaryNegation = 59,
61
+ LengthofExpression = 60,
62
+ lengthof = 61,
63
+ BinaryLiteral = 62,
64
+ HexadecimalLiteral = 63,
65
+ MultipleCharacterLiteral = 64,
66
+ SingleQuote = 65,
67
+ MultipleCharacterLiteralCharacters = 66,
68
+ DecimalLiteral = 67,
69
+ FloatingPointLiteral = 68,
70
+ BitModifier = 69,
71
+ Colon = 70,
72
+ Assignment = 71,
73
+ ExtendedClassIdRange = 72,
74
+ ClassId = 73,
75
+ ClassIdRange = 74,
76
+ RangeOperator = 75,
77
+ OpenBrace = 76,
78
+ CompoundStatement = 77,
79
+ IfStatement = 78,
80
+ _if = 79,
81
+ _else = 80,
82
+ SwitchStatement = 81,
83
+ _switch = 82,
84
+ CaseClause = 83,
85
+ _case = 84,
86
+ _break = 85,
87
+ Semicolon = 86,
88
+ DefaultClause = 87,
89
+ _default = 88,
90
+ ForStatement = 89,
91
+ _for = 90,
92
+ AssignmentExpression = 91,
93
+ ComputedElementaryTypeDefinition = 92,
94
+ computed = 93,
95
+ _const = 94,
96
+ DoStatement = 95,
97
+ _do = 96,
98
+ _while = 97,
99
+ WhileStatement = 98,
100
+ ExpressionStatement = 99,
101
+ ElementaryTypeDefinition = 100,
102
+ reserved = 101,
103
+ legacy = 102,
104
+ LengthAttribute = 103,
105
+ LookAhead = 104,
106
+ MapDefinition = 105,
107
+ ClassDefinition = 106,
108
+ StringDefinition = 107,
109
+ base64string = 108,
110
+ Base64StringLiteral = 109,
111
+ DoubleQuote = 110,
112
+ Base64StringLiteralCharacters = 111,
113
+ utf16string = 112,
114
+ UtfStringLiteral = 113,
115
+ UtfPrefix = 114,
116
+ UtfStringLiteralCharacters = 115,
117
+ utf8string = 116,
118
+ utf8list = 117,
119
+ utfstring = 118,
120
+ ArrayDefinition = 119,
121
+ ImplicitArrayDimension = 120,
122
+ ExplicitArrayDimension = 121,
123
+ PartialArrayDimension = 122,
124
+ ComputedArrayDefinition = 123,
125
+ MapDeclaration = 124,
126
+ map = 125,
127
+ MapEntry = 126,
128
+ AggregateOutputValue = 127,
129
+ ElementaryTypeOutputValue = 128;