@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.
- package/LICENSE +21 -0
- package/README.md +337 -0
- package/bun.lock +65 -0
- package/dist/index.js +11829 -0
- package/grammar/sdl.ebnf.grammar +399 -0
- package/grammar/sdl.lezer.grammar +629 -0
- package/index.ts +83 -0
- package/package.json +61 -0
- package/src/analyser/checks/check-array-definition.ts +90 -0
- package/src/analyser/checks/check-array-element-access.ts +31 -0
- package/src/analyser/checks/check-class-declaration.ts +417 -0
- package/src/analyser/checks/check-computed-array-definition.ts +44 -0
- package/src/analyser/checks/check-computed-elementary-type-definition.ts +45 -0
- package/src/analyser/checks/check-elementary-type-definition.ts +167 -0
- package/src/analyser/checks/check-expression-binary.ts +242 -0
- package/src/analyser/checks/check-expression-lengthof.ts +34 -0
- package/src/analyser/checks/check-expression-unary.ts +166 -0
- package/src/analyser/checks/check-identifier.ts +71 -0
- package/src/analyser/checks/check-if-statement.ts +164 -0
- package/src/analyser/checks/check-map-declaration.ts +180 -0
- package/src/analyser/checks/check-map-definition.ts +118 -0
- package/src/analyser/checks/check-number-literal-float.ts +28 -0
- package/src/analyser/checks/check-parameter-list.ts +42 -0
- package/src/analyser/checks/check-specification.ts +53 -0
- package/src/analyser/checks/check-switch-statement.ts +206 -0
- package/src/analyser/checks/check.ts +20 -0
- package/src/analyser/create-sdl-analyser.ts +85 -0
- package/src/analyser/node-handler/abstract-analysis-node-handler.ts +626 -0
- package/src/analyser/node-handler/build-symbol-table-node-handler.ts +649 -0
- package/src/analyser/node-handler/specific-check-node-handler.ts +46 -0
- package/src/analyser/node-handler/validate-scope-node-handler.ts +290 -0
- package/src/analyser/node-handler/validate-type-node-handler.ts +497 -0
- package/src/analyser/sdl-analyser.ts +119 -0
- package/src/analyser/symbol-table.ts +388 -0
- package/src/analyser/util/symbol-table-utils.ts +458 -0
- package/src/analyser/util/type-utils.ts +238 -0
- package/src/ast/build/consume/consume-abstract-node.ts +199 -0
- package/src/ast/build/consume/consume-ast-node.ts +400 -0
- package/src/ast/build/consume/consume-primitive.ts +59 -0
- package/src/ast/build/consume/consume-trivia.ts +96 -0
- package/src/ast/build/consume/consume-white-space-and-missing-errors.ts +27 -0
- package/src/ast/build/node/build-aggregate-output-value.ts +57 -0
- package/src/ast/build/node/build-aligned-modifier.ts +99 -0
- package/src/ast/build/node/build-array-definition.ts +131 -0
- package/src/ast/build/node/build-array-element-access.ts +45 -0
- package/src/ast/build/node/build-base64-string-literal.ts +41 -0
- package/src/ast/build/node/build-binary-expression.ts +113 -0
- package/src/ast/build/node/build-binary-literal.ts +37 -0
- package/src/ast/build/node/build-bit-modifier.ts +86 -0
- package/src/ast/build/node/build-case-clause.ts +101 -0
- package/src/ast/build/node/build-class-declaration.ts +124 -0
- package/src/ast/build/node/build-class-definition.ts +56 -0
- package/src/ast/build/node/build-class-id-range.ts +32 -0
- package/src/ast/build/node/build-class-id.ts +19 -0
- package/src/ast/build/node/build-class-member-access.ts +27 -0
- package/src/ast/build/node/build-compound-statement.ts +33 -0
- package/src/ast/build/node/build-computed-array-definition.ts +53 -0
- package/src/ast/build/node/build-computed-elementary-type-definition.ts +100 -0
- package/src/ast/build/node/build-decimal-literal.ts +15 -0
- package/src/ast/build/node/build-default-clause.ts +76 -0
- package/src/ast/build/node/build-do-statement.ts +71 -0
- package/src/ast/build/node/build-elementary-type-definition.ts +164 -0
- package/src/ast/build/node/build-elementary-type-output-value.ts +25 -0
- package/src/ast/build/node/build-elementary-type.ts +36 -0
- package/src/ast/build/node/build-expandable-modifier.ts +68 -0
- package/src/ast/build/node/build-explicit-array-dimension.ts +37 -0
- package/src/ast/build/node/build-expression-statement.ts +31 -0
- package/src/ast/build/node/build-extended-class-id-range.ts +27 -0
- package/src/ast/build/node/build-extends-modifier.ts +41 -0
- package/src/ast/build/node/build-floating-point-literal.ts +15 -0
- package/src/ast/build/node/build-for-statement.ts +117 -0
- package/src/ast/build/node/build-hexadecimal-literal.ts +38 -0
- package/src/ast/build/node/build-identifier.ts +8 -0
- package/src/ast/build/node/build-if-statement.ts +82 -0
- package/src/ast/build/node/build-implicit-array-dimension.ts +78 -0
- package/src/ast/build/node/build-integer-literal.ts +15 -0
- package/src/ast/build/node/build-length-attribute.ts +48 -0
- package/src/ast/build/node/build-lengthof-expression.ts +45 -0
- package/src/ast/build/node/build-map-declaration.ts +110 -0
- package/src/ast/build/node/build-map-definition.ts +103 -0
- package/src/ast/build/node/build-map-entry.ts +33 -0
- package/src/ast/build/node/build-missing-error.ts +10 -0
- package/src/ast/build/node/build-multiple-character-literal.ts +65 -0
- package/src/ast/build/node/build-parameter-list.ts +50 -0
- package/src/ast/build/node/build-parameter-value-list.ts +54 -0
- package/src/ast/build/node/build-parameter.ts +47 -0
- package/src/ast/build/node/build-partial-array-dimension.ts +55 -0
- package/src/ast/build/node/build-specification.ts +24 -0
- package/src/ast/build/node/build-string-definition.ts +106 -0
- package/src/ast/build/node/build-switch-statement.ts +84 -0
- package/src/ast/build/node/build-token.ts +26 -0
- package/src/ast/build/node/build-unary-expression.ts +109 -0
- package/src/ast/build/node/build-unexpected-error.ts +14 -0
- package/src/ast/build/node/build-utf-string-literal.ts +110 -0
- package/src/ast/build/node/build-while-statement.ts +55 -0
- package/src/ast/build/util/array-dimension-kind-by-token-type-id-map.ts +167 -0
- package/src/ast/build/util/binary-operator-kind-by-token-type-id-map.ts +152 -0
- package/src/ast/build/util/build-context.ts +36 -0
- package/src/ast/build/util/class-id-kind-by-token-type-id-map.ts +160 -0
- package/src/ast/build/util/expression-kind-by-token-type-id-map.ts +168 -0
- package/src/ast/build/util/fetch-node.ts +433 -0
- package/src/ast/build/util/node-kind-by-token-type-id-map.ts +202 -0
- package/src/ast/build/util/statement-kind-by-token-type-id-map.ts +210 -0
- package/src/ast/build/util/string-literal-kind-by-token-type-id-map.ts +162 -0
- package/src/ast/build/util/token-kind-by-token-type-id-map.ts +337 -0
- package/src/ast/build-ast.ts +114 -0
- package/src/ast/node/abstract-array-definition.ts +17 -0
- package/src/ast/node/abstract-array-dimension.ts +20 -0
- package/src/ast/node/abstract-class-id.ts +13 -0
- package/src/ast/node/abstract-composite-node.ts +58 -0
- package/src/ast/node/abstract-elementary-type-definition.ts +29 -0
- package/src/ast/node/abstract-expression.ts +13 -0
- package/src/ast/node/abstract-leaf-node.ts +10 -0
- package/src/ast/node/abstract-node.ts +16 -0
- package/src/ast/node/abstract-statement.ts +13 -0
- package/src/ast/node/aggregate-output-value.ts +28 -0
- package/src/ast/node/aligned-modifier.ts +21 -0
- package/src/ast/node/array-definition.ts +44 -0
- package/src/ast/node/array-element-access.ts +24 -0
- package/src/ast/node/binary-expression.ts +28 -0
- package/src/ast/node/bit-modifier.ts +24 -0
- package/src/ast/node/case-clause.ts +30 -0
- package/src/ast/node/class-declaration.ts +39 -0
- package/src/ast/node/class-definition.ts +23 -0
- package/src/ast/node/class-id-range.ts +17 -0
- package/src/ast/node/class-id.ts +14 -0
- package/src/ast/node/class-member-access.ts +19 -0
- package/src/ast/node/compound-statement.ts +19 -0
- package/src/ast/node/computed-array-definition.ts +26 -0
- package/src/ast/node/computed-elementary-type-definition.ts +34 -0
- package/src/ast/node/default-clause.ts +26 -0
- package/src/ast/node/do-statement.ts +28 -0
- package/src/ast/node/elementary-type-definition.ts +49 -0
- package/src/ast/node/elementary-type-output-value.ts +19 -0
- package/src/ast/node/elementary-type.ts +18 -0
- package/src/ast/node/enum/array-dimension-kind.ts +11 -0
- package/src/ast/node/enum/binary-operator-kind.ts +41 -0
- package/src/ast/node/enum/class-id-kind.ts +12 -0
- package/src/ast/node/enum/elementary-type-kind.ts +13 -0
- package/src/ast/node/enum/expression-kind.ts +11 -0
- package/src/ast/node/enum/node-kind.ts +57 -0
- package/src/ast/node/enum/number-literal-kind.ts +17 -0
- package/src/ast/node/enum/statement-kind.ts +37 -0
- package/src/ast/node/enum/string-literal-kind.ts +13 -0
- package/src/ast/node/enum/string-variable-kind.ts +25 -0
- package/src/ast/node/enum/token-kind.ts +87 -0
- package/src/ast/node/expandable-modifier.ts +21 -0
- package/src/ast/node/explicit-array-dimension.ts +26 -0
- package/src/ast/node/expression-statement.ts +23 -0
- package/src/ast/node/extended-class-id-range.ts +20 -0
- package/src/ast/node/extends-modifier.ts +21 -0
- package/src/ast/node/for-statement.ts +29 -0
- package/src/ast/node/identifier.ts +12 -0
- package/src/ast/node/if-statement.ts +28 -0
- package/src/ast/node/implicit-array-dimension.ts +34 -0
- package/src/ast/node/length-attribute.ts +24 -0
- package/src/ast/node/length-of-expression.ts +21 -0
- package/src/ast/node/map-declaration.ts +34 -0
- package/src/ast/node/map-definition.ts +27 -0
- package/src/ast/node/map-entry.ts +18 -0
- package/src/ast/node/missing-error.ts +9 -0
- package/src/ast/node/number-literal.ts +18 -0
- package/src/ast/node/parameter-list.ts +25 -0
- package/src/ast/node/parameter-value-list.ts +29 -0
- package/src/ast/node/parameter.ts +20 -0
- package/src/ast/node/partial-array-dimension.ts +28 -0
- package/src/ast/node/specification.ts +21 -0
- package/src/ast/node/string-definition.ts +28 -0
- package/src/ast/node/string-literal.ts +21 -0
- package/src/ast/node/switch-statement.ts +32 -0
- package/src/ast/node/token.ts +20 -0
- package/src/ast/node/trivia.ts +13 -0
- package/src/ast/node/unary-expression.ts +31 -0
- package/src/ast/node/unexpected-error.ts +12 -0
- package/src/ast/node/while-statement.ts +26 -0
- package/src/ast/util/types.ts +138 -0
- package/src/ast/visitor/node-handler.ts +15 -0
- package/src/ast/visitor/node-visitor.ts +13 -0
- package/src/ast/visitor/traversing-visitor.ts +69 -0
- package/src/completion/completion-rules.ts +447 -0
- package/src/completion/get-potential-syntactic-tokens.ts +54 -0
- package/src/completion/get-potential-token-type-ids.ts +116 -0
- package/src/completion/hierarchical-map.ts +43 -0
- package/src/completion/rules/abstract-types.ts +174 -0
- package/src/completion/rules/aggregate-output-value-rules.ts +48 -0
- package/src/completion/rules/aligned-modifier-rules.ts +45 -0
- package/src/completion/rules/array-definition-rules.ts +87 -0
- package/src/completion/rules/array-element-access-rules.ts +22 -0
- package/src/completion/rules/assignment-expression-rules.ts +19 -0
- package/src/completion/rules/binary-expression-rules.ts +23 -0
- package/src/completion/rules/bit-modifier-rules.ts +25 -0
- package/src/completion/rules/case-clause-rules.ts +39 -0
- package/src/completion/rules/class-declaration-rules.ts +81 -0
- package/src/completion/rules/class-definition-rules.ts +28 -0
- package/src/completion/rules/class-id-range-rules.ts +17 -0
- package/src/completion/rules/class-id-rules.ts +9 -0
- package/src/completion/rules/class-member-access-rules.ts +7 -0
- package/src/completion/rules/compound-statement-rules.ts +25 -0
- package/src/completion/rules/computed-array-definition-rules.ts +25 -0
- package/src/completion/rules/computed-elementary-type-rules.ts +44 -0
- package/src/completion/rules/default-clause-rules.ts +23 -0
- package/src/completion/rules/do-statement-rules.ts +38 -0
- package/src/completion/rules/elementary-type-definition-rules.ts +62 -0
- package/src/completion/rules/elementary-type-output-value-rules.ts +13 -0
- package/src/completion/rules/elementary-type-rules.ts +18 -0
- package/src/completion/rules/expandable-modifier-rules.ts +21 -0
- package/src/completion/rules/explicit-array-dimension-rules.ts +22 -0
- package/src/completion/rules/expression-statement-rules.ts +22 -0
- package/src/completion/rules/extended-class-id-range-rules.ts +17 -0
- package/src/completion/rules/extends-modifier-rules.ts +17 -0
- package/src/completion/rules/for-statement-rules.ts +51 -0
- package/src/completion/rules/if-statement-rules.ts +42 -0
- package/src/completion/rules/implicit-array-dimension-rules.ts +21 -0
- package/src/completion/rules/length-attribute-rules.ts +19 -0
- package/src/completion/rules/lengthof-expression-rules.ts +23 -0
- package/src/completion/rules/map-declaration-rules.ts +45 -0
- package/src/completion/rules/map-definition-rules.ts +46 -0
- package/src/completion/rules/map-entry-rules.ts +17 -0
- package/src/completion/rules/parameter-list-rules.ts +21 -0
- package/src/completion/rules/parameter-rules.ts +17 -0
- package/src/completion/rules/parameter-value-list-rules.ts +27 -0
- package/src/completion/rules/partial-array-dimension-rules.ts +33 -0
- package/src/completion/rules/specification-rules.ts +37 -0
- package/src/completion/rules/string-definition-rules.ts +103 -0
- package/src/completion/rules/switch-statement-rules.ts +50 -0
- package/src/completion/rules/unary-expression-rules.ts +41 -0
- package/src/completion/rules/utf-string-literal-rules.ts +17 -0
- package/src/completion/rules/while-statement-rules.ts +38 -0
- package/src/lezer/context-tracker.ts +45 -0
- package/src/lezer/create-sdl-parser.ts +88 -0
- package/src/lezer/create-syntax-error-from-text-and-cursor.ts +110 -0
- package/src/lezer/create-syntax-error-from-text-and-position.ts +36 -0
- package/src/lezer/parser.terms.ts +129 -0
- package/src/lezer/parser.ts +63 -0
- package/src/lezer/props/fold-node-prop-source.ts +27 -0
- package/src/lezer/props/primitive-node-prop-source.ts +19 -0
- package/src/lezer/props/style-tags-node-prop-source.ts +188 -0
- package/src/lezer/props/syntactic-token-node-prop-source.ts +298 -0
- package/src/lezer/sdl-string-input.ts +46 -0
- package/src/location.ts +13 -0
- package/src/parse-helper.ts +93 -0
- package/src/prettier/prettier-plugin-sdl.ts +89 -0
- package/src/prettier/print-abstract-array-dimension.ts +84 -0
- package/src/prettier/print-abstract-class-id.ts +53 -0
- package/src/prettier/print-abstract-expression.ts +168 -0
- package/src/prettier/print-abstract-node.ts +224 -0
- package/src/prettier/print-abstract-statement.ts +124 -0
- package/src/prettier/print-aggregate-output-value.ts +35 -0
- package/src/prettier/print-aligned-modifier.ts +50 -0
- package/src/prettier/print-array-definition.ts +95 -0
- package/src/prettier/print-array-element-access.ts +14 -0
- package/src/prettier/print-bit-modifier.ts +48 -0
- package/src/prettier/print-case-clause.ts +58 -0
- package/src/prettier/print-class-declaration.ts +99 -0
- package/src/prettier/print-class-definition.ts +44 -0
- package/src/prettier/print-class-member-access.ts +13 -0
- package/src/prettier/print-computed-array-definition.ts +33 -0
- package/src/prettier/print-computed-elementary-type-definition.ts +60 -0
- package/src/prettier/print-default-clause.ts +39 -0
- package/src/prettier/print-do-statement.ts +31 -0
- package/src/prettier/print-elementary-type-definition.ts +108 -0
- package/src/prettier/print-elementary-type-output-value.ts +13 -0
- package/src/prettier/print-elementary-type.ts +28 -0
- package/src/prettier/print-expandable-modifier.ts +41 -0
- package/src/prettier/print-extends-modifier.ts +29 -0
- package/src/prettier/print-for-statement.ts +64 -0
- package/src/prettier/print-identifier.ts +10 -0
- package/src/prettier/print-if-statement.ts +76 -0
- package/src/prettier/print-length-attribute.ts +14 -0
- package/src/prettier/print-map-declaration.ts +75 -0
- package/src/prettier/print-map-definition.ts +67 -0
- package/src/prettier/print-map-entry.ts +22 -0
- package/src/prettier/print-number-literal.ts +84 -0
- package/src/prettier/print-parameter-list.ts +20 -0
- package/src/prettier/print-parameter-value-list.ts +20 -0
- package/src/prettier/print-parameter.ts +34 -0
- package/src/prettier/print-specification.ts +51 -0
- package/src/prettier/print-string-definition.ts +114 -0
- package/src/prettier/print-string-literal.ts +57 -0
- package/src/prettier/print-switch-statement.ts +46 -0
- package/src/prettier/print-token.ts +7 -0
- package/src/prettier/print-unexpected-error.ts +10 -0
- package/src/prettier/print-while-statement.ts +26 -0
- package/src/prettier/util/print-utils.ts +607 -0
- package/src/prettier/util/types.ts +40 -0
- package/src/scanner-error.ts +65 -0
- package/src/util/location-utils.ts +16 -0
- package/src/util/logger.ts +165 -0
- package/tests/analyser/create-sdl-analyser.test.ts +54 -0
- package/tests/analyser/get-sdl-analyser-test-scenarios.ts +80 -0
- package/tests/analyser/sdl-analyser-scenarios.test.ts +67 -0
- package/tests/analyser/semantic-error-scenarios.test.ts +40 -0
- package/tests/analyser/symbol-table.test.ts +188 -0
- package/tests/analyser/test-cases/array_definition.txt +50 -0
- package/tests/analyser/test-cases/class_declaration.txt +112 -0
- package/tests/analyser/test-cases/class_definition.txt +60 -0
- package/tests/analyser/test-cases/compound_statement.txt +63 -0
- package/tests/analyser/test-cases/computed_array_definition.txt +12 -0
- package/tests/analyser/test-cases/computed_elementary_type_definition.txt +39 -0
- package/tests/analyser/test-cases/do_statement.txt +16 -0
- package/tests/analyser/test-cases/elementary_type_definition.txt +58 -0
- package/tests/analyser/test-cases/expression.txt +159 -0
- package/tests/analyser/test-cases/for_statement.txt +55 -0
- package/tests/analyser/test-cases/if_statement.txt +57 -0
- package/tests/analyser/test-cases/map_declaration.txt +89 -0
- package/tests/analyser/test-cases/map_definition.txt +35 -0
- package/tests/analyser/test-cases/number_literal.txt +31 -0
- package/tests/analyser/test-cases/parameter_list.txt +16 -0
- package/tests/analyser/test-cases/scopes.txt +239 -0
- package/tests/analyser/test-cases/specification.txt +28 -0
- package/tests/analyser/test-cases/string_definition.txt +40 -0
- package/tests/analyser/test-cases/switch_statement.txt +96 -0
- package/tests/analyser/test-cases/while_statement.txt +16 -0
- package/tests/analyser/util/symbol-table-utils.test.ts +65 -0
- package/tests/ast/__snapshots__/build-ast.test.ts.snap +38897 -0
- package/tests/ast/build-ast.test.ts +463 -0
- package/tests/ast/visitor/traversing-visitor.test.ts +36 -0
- package/tests/completion/get-potential-syntactic-tokens.test.ts +89 -0
- package/tests/completion/get-potential-token-type-ids.test.ts +76 -0
- package/tests/completion/test-potential-syntactic-tokens-scenario.ts +24 -0
- package/tests/completion/test-potential-token-type-ids-scenario.ts +33 -0
- package/tests/fixtures/history-recording-node-handler.ts +232 -0
- package/tests/lezer/create-parse-error-from-text-and-position.test.ts +129 -0
- package/tests/lezer/create-sdl-parser.test.ts +15 -0
- package/tests/lezer/sdl-parser-scenarios.test.ts +24 -0
- package/tests/lezer/sdl-string-input.test.ts +12 -0
- package/tests/lezer/syntax-error-scenarios.test.ts +114 -0
- package/tests/lezer/test-cases/array_definition.txt +109 -0
- package/tests/lezer/test-cases/class_declaration.txt +141 -0
- package/tests/lezer/test-cases/class_definition.txt +89 -0
- package/tests/lezer/test-cases/comment.txt +335 -0
- package/tests/lezer/test-cases/compound_statement.txt +109 -0
- package/tests/lezer/test-cases/computed_array_definition.txt +33 -0
- package/tests/lezer/test-cases/computed_elementary_type_definition.txt +59 -0
- package/tests/lezer/test-cases/do_statement.txt +48 -0
- package/tests/lezer/test-cases/elementary_type_definition.txt +158 -0
- package/tests/lezer/test-cases/expression.txt +1203 -0
- package/tests/lezer/test-cases/for_statement.txt +183 -0
- package/tests/lezer/test-cases/if_statement.txt +183 -0
- package/tests/lezer/test-cases/invalid.txt +97 -0
- package/tests/lezer/test-cases/map_declaration.txt +152 -0
- package/tests/lezer/test-cases/map_definition.txt +59 -0
- package/tests/lezer/test-cases/number_literal.txt +273 -0
- package/tests/lezer/test-cases/specification.txt +38 -0
- package/tests/lezer/test-cases/string_definition.txt +263 -0
- package/tests/lezer/test-cases/string_literal.txt +303 -0
- package/tests/lezer/test-cases/switch_statement.txt +407 -0
- package/tests/lezer/test-cases/while_statement.txt +45 -0
- package/tests/parse-helper.test.ts +361 -0
- package/tests/prettier/__snapshots__/prettier-plugin-sdl.test.ts.snap +127 -0
- package/tests/prettier/prettier-plugin-sdl.test.ts +58 -0
- package/tests/prettier/print-array.test.ts +29 -0
- package/tests/prettier/print-class.test.ts +15 -0
- package/tests/prettier/print-do.test.ts +25 -0
- package/tests/prettier/print-elementary-type.test.ts +62 -0
- package/tests/prettier/print-error.test.ts +40 -0
- package/tests/prettier/print-expression.test.ts +17 -0
- package/tests/prettier/print-for.test.ts +23 -0
- package/tests/prettier/print-if.test.ts +71 -0
- package/tests/prettier/print-number-literal.test.ts +28 -0
- package/tests/prettier/print-specification.test.ts +54 -0
- package/tests/prettier/print-string.test.ts +36 -0
- package/tests/prettier/print-switch.test.ts +69 -0
- package/tests/prettier/print-while.test.ts +23 -0
- package/tests/prettier/test-prettier-scenario.ts +41 -0
- package/tests/prettier/util/print-utils.test.ts +665 -0
- package/tests/prettier/util/types.test.ts +38 -0
- package/tests/sample-specifications/invalid.sdl +24 -0
- package/tests/sample-specifications/prettified-invalid.sdl +28 -0
- package/tests/sample-specifications/prettified-various-elements-narrow.sdl +97 -0
- package/tests/sample-specifications/prettified-various-elements.sdl +90 -0
- package/tests/sample-specifications/sample.sdl +24 -0
- package/tests/sample-specifications/various-elements.sdl +88 -0
- package/tests/util/logger.test.ts +36 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { InternalScannerError } from "../../scanner-error.ts";
|
|
2
|
+
|
|
3
|
+
// Generated by Lezer from the SDL grammar
|
|
4
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
5
|
+
|
|
6
|
+
export const binaryOperatorTypes: number[] = [];
|
|
7
|
+
export const postfixOperatorTypes: number[] = [];
|
|
8
|
+
export const unaryOperatorTypes: number[] = [];
|
|
9
|
+
export const numberLiteralTypes: number[] = [];
|
|
10
|
+
export const expressionTypes: number[] = [];
|
|
11
|
+
export const statementTypes: number[] = [];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Map parsed token type ID to AST token type enum.
|
|
15
|
+
*/
|
|
16
|
+
Object.values(TokenTypeId).forEach((tokenTypeId) => {
|
|
17
|
+
switch (tokenTypeId) {
|
|
18
|
+
case TokenTypeId.Multiplication:
|
|
19
|
+
case TokenTypeId.Division:
|
|
20
|
+
case TokenTypeId.Modulus:
|
|
21
|
+
case TokenTypeId.Addition:
|
|
22
|
+
case TokenTypeId.Subtraction:
|
|
23
|
+
case TokenTypeId.BitwiseShiftLeft:
|
|
24
|
+
case TokenTypeId.BitwiseShiftRight:
|
|
25
|
+
case TokenTypeId.RelationalLessThan:
|
|
26
|
+
case TokenTypeId.RelationalLessThanOrEqual:
|
|
27
|
+
case TokenTypeId.RelationalGreaterThan:
|
|
28
|
+
case TokenTypeId.RelationalGreaterThanOrEqual:
|
|
29
|
+
case TokenTypeId.RelationalEqual:
|
|
30
|
+
case TokenTypeId.RelationalNotEqual:
|
|
31
|
+
case TokenTypeId.BitwiseAnd:
|
|
32
|
+
case TokenTypeId.BitwiseOr:
|
|
33
|
+
case TokenTypeId.LogicalAnd:
|
|
34
|
+
case TokenTypeId.LogicalOr:
|
|
35
|
+
binaryOperatorTypes.push(tokenTypeId);
|
|
36
|
+
break;
|
|
37
|
+
case TokenTypeId.PostfixIncrement:
|
|
38
|
+
case TokenTypeId.PostfixDecrement:
|
|
39
|
+
postfixOperatorTypes.push(tokenTypeId);
|
|
40
|
+
break;
|
|
41
|
+
case TokenTypeId.UnaryPlus:
|
|
42
|
+
case TokenTypeId.UnaryNegation:
|
|
43
|
+
unaryOperatorTypes.push(tokenTypeId);
|
|
44
|
+
break;
|
|
45
|
+
case TokenTypeId.BinaryLiteral:
|
|
46
|
+
case TokenTypeId.HexadecimalLiteral:
|
|
47
|
+
case TokenTypeId.MultipleCharacterLiteral:
|
|
48
|
+
case TokenTypeId.IntegerLiteral:
|
|
49
|
+
case TokenTypeId.DecimalLiteral:
|
|
50
|
+
case TokenTypeId.FloatingPointLiteral:
|
|
51
|
+
numberLiteralTypes.push(tokenTypeId);
|
|
52
|
+
break;
|
|
53
|
+
case TokenTypeId.UnaryExpression:
|
|
54
|
+
case TokenTypeId.BinaryExpression:
|
|
55
|
+
expressionTypes.push(tokenTypeId);
|
|
56
|
+
break;
|
|
57
|
+
case TokenTypeId.CompoundStatement:
|
|
58
|
+
case TokenTypeId.IfStatement:
|
|
59
|
+
case TokenTypeId.SwitchStatement:
|
|
60
|
+
case TokenTypeId.ForStatement:
|
|
61
|
+
case TokenTypeId.DoStatement:
|
|
62
|
+
case TokenTypeId.WhileStatement:
|
|
63
|
+
case TokenTypeId.ExpressionStatement:
|
|
64
|
+
case TokenTypeId.ElementaryTypeDefinition:
|
|
65
|
+
case TokenTypeId.MapDefinition:
|
|
66
|
+
case TokenTypeId.ClassDefinition:
|
|
67
|
+
case TokenTypeId.StringDefinition:
|
|
68
|
+
case TokenTypeId.ArrayDefinition:
|
|
69
|
+
case TokenTypeId.ComputedElementaryTypeDefinition:
|
|
70
|
+
case TokenTypeId.ComputedArrayDefinition:
|
|
71
|
+
statementTypes.push(tokenTypeId);
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
// Not currently mapped for completion rules
|
|
75
|
+
case TokenTypeId.AlignedModifier:
|
|
76
|
+
case TokenTypeId.AggregateOutputValue:
|
|
77
|
+
case TokenTypeId.ClassDeclaration:
|
|
78
|
+
case TokenTypeId.MapDeclaration:
|
|
79
|
+
case TokenTypeId.AssignmentExpression:
|
|
80
|
+
case TokenTypeId.LengthofExpression:
|
|
81
|
+
case TokenTypeId.ArrayElementAccess:
|
|
82
|
+
case TokenTypeId.Base64StringLiteral:
|
|
83
|
+
case TokenTypeId.UtfStringLiteral:
|
|
84
|
+
case TokenTypeId.BitModifier:
|
|
85
|
+
case TokenTypeId.CaseClause:
|
|
86
|
+
case TokenTypeId.ClassId:
|
|
87
|
+
case TokenTypeId.ClassIdRange:
|
|
88
|
+
case TokenTypeId.ExtendedClassIdRange:
|
|
89
|
+
case TokenTypeId.ClassMemberAccess:
|
|
90
|
+
case TokenTypeId.DefaultClause:
|
|
91
|
+
case TokenTypeId.ElementaryType:
|
|
92
|
+
case TokenTypeId.ElementaryTypeOutputValue:
|
|
93
|
+
case TokenTypeId.ExpandableModifier:
|
|
94
|
+
case TokenTypeId.ExplicitArrayDimension:
|
|
95
|
+
case TokenTypeId.ImplicitArrayDimension:
|
|
96
|
+
case TokenTypeId.PartialArrayDimension:
|
|
97
|
+
case TokenTypeId.ExtendsModifier:
|
|
98
|
+
case TokenTypeId.LengthAttribute:
|
|
99
|
+
case TokenTypeId.MapEntry:
|
|
100
|
+
case TokenTypeId.Parameter:
|
|
101
|
+
case TokenTypeId.ParameterList:
|
|
102
|
+
case TokenTypeId.ParameterValueList:
|
|
103
|
+
case TokenTypeId.Specification:
|
|
104
|
+
case TokenTypeId.AlignmentBitCount8:
|
|
105
|
+
case TokenTypeId.AlignmentBitCount16:
|
|
106
|
+
case TokenTypeId.AlignmentBitCount32:
|
|
107
|
+
case TokenTypeId.AlignmentBitCount64:
|
|
108
|
+
case TokenTypeId.AlignmentBitCount128:
|
|
109
|
+
case TokenTypeId.Base64StringLiteralCharacters:
|
|
110
|
+
case TokenTypeId.Identifier:
|
|
111
|
+
case TokenTypeId.MultipleCharacterLiteralCharacters:
|
|
112
|
+
case TokenTypeId.UtfStringLiteralCharacters:
|
|
113
|
+
|
|
114
|
+
// Trivia
|
|
115
|
+
case TokenTypeId.Comment:
|
|
116
|
+
case TokenTypeId.Whitespace:
|
|
117
|
+
|
|
118
|
+
// punctuation
|
|
119
|
+
case TokenTypeId.Assignment:
|
|
120
|
+
case TokenTypeId.CloseBrace:
|
|
121
|
+
case TokenTypeId.CloseBracket:
|
|
122
|
+
case TokenTypeId.CloseParenthesis:
|
|
123
|
+
case TokenTypeId.Colon:
|
|
124
|
+
case TokenTypeId.Comma:
|
|
125
|
+
case TokenTypeId.DoubleQuote:
|
|
126
|
+
case TokenTypeId.LookAhead:
|
|
127
|
+
case TokenTypeId.OpenBrace:
|
|
128
|
+
case TokenTypeId.OpenBracket:
|
|
129
|
+
case TokenTypeId.OpenParenthesis:
|
|
130
|
+
case TokenTypeId.Period:
|
|
131
|
+
case TokenTypeId.RangeOperator:
|
|
132
|
+
case TokenTypeId.Semicolon:
|
|
133
|
+
case TokenTypeId.SingleQuote:
|
|
134
|
+
case TokenTypeId.UtfPrefix:
|
|
135
|
+
|
|
136
|
+
// keywords
|
|
137
|
+
case TokenTypeId._break:
|
|
138
|
+
case TokenTypeId._case:
|
|
139
|
+
case TokenTypeId._class:
|
|
140
|
+
case TokenTypeId._const:
|
|
141
|
+
case TokenTypeId._default:
|
|
142
|
+
case TokenTypeId._do:
|
|
143
|
+
case TokenTypeId._else:
|
|
144
|
+
case TokenTypeId._extends:
|
|
145
|
+
case TokenTypeId._for:
|
|
146
|
+
case TokenTypeId._if:
|
|
147
|
+
case TokenTypeId._switch:
|
|
148
|
+
case TokenTypeId._while:
|
|
149
|
+
case TokenTypeId.abstract:
|
|
150
|
+
case TokenTypeId.aligned:
|
|
151
|
+
case TokenTypeId.base64string:
|
|
152
|
+
case TokenTypeId.bit:
|
|
153
|
+
case TokenTypeId.computed:
|
|
154
|
+
case TokenTypeId.expandable:
|
|
155
|
+
case TokenTypeId.float:
|
|
156
|
+
case TokenTypeId.int:
|
|
157
|
+
case TokenTypeId.legacy:
|
|
158
|
+
case TokenTypeId.lengthof:
|
|
159
|
+
case TokenTypeId.map:
|
|
160
|
+
case TokenTypeId.reserved:
|
|
161
|
+
case TokenTypeId.unsigned:
|
|
162
|
+
case TokenTypeId.utf16string:
|
|
163
|
+
case TokenTypeId.utf8list:
|
|
164
|
+
case TokenTypeId.utf8string:
|
|
165
|
+
case TokenTypeId.utfstring:
|
|
166
|
+
break;
|
|
167
|
+
default: {
|
|
168
|
+
const exhaustiveCheck: never = tokenTypeId;
|
|
169
|
+
throw new InternalScannerError(
|
|
170
|
+
"Unreachable code reached, tokenTypeId == " + exhaustiveCheck,
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Generated by Lezer from the SDL grammar
|
|
2
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
3
|
+
|
|
4
|
+
import { numberLiteralTypes } from "./abstract-types.ts";
|
|
5
|
+
|
|
6
|
+
export const aggregateOutputValueRules = [
|
|
7
|
+
{
|
|
8
|
+
previous: -1,
|
|
9
|
+
expected: TokenTypeId.OpenBrace,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
previous: TokenTypeId.OpenBrace,
|
|
13
|
+
expected: [
|
|
14
|
+
TokenTypeId.ElementaryTypeOutputValue,
|
|
15
|
+
TokenTypeId.OpenBrace,
|
|
16
|
+
...numberLiteralTypes,
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
previous: TokenTypeId.Comma,
|
|
21
|
+
expected: [
|
|
22
|
+
TokenTypeId.ElementaryTypeOutputValue,
|
|
23
|
+
TokenTypeId.OpenBrace,
|
|
24
|
+
...numberLiteralTypes,
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
previous: TokenTypeId.ElementaryTypeOutputValue,
|
|
29
|
+
expected: [
|
|
30
|
+
TokenTypeId.Comma,
|
|
31
|
+
TokenTypeId.CloseBrace,
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
previous: TokenTypeId.CloseBrace,
|
|
36
|
+
expected: [
|
|
37
|
+
TokenTypeId.Comma,
|
|
38
|
+
TokenTypeId.CloseBrace,
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
...numberLiteralTypes.map((type) => ({
|
|
42
|
+
previous: type,
|
|
43
|
+
expected: [
|
|
44
|
+
TokenTypeId.Comma,
|
|
45
|
+
TokenTypeId.CloseBrace,
|
|
46
|
+
],
|
|
47
|
+
})),
|
|
48
|
+
];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Generated by Lezer from the SDL grammar
|
|
2
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
3
|
+
|
|
4
|
+
export const alignedModifierRules = [
|
|
5
|
+
{
|
|
6
|
+
previous: -1,
|
|
7
|
+
expected: [
|
|
8
|
+
TokenTypeId.aligned,
|
|
9
|
+
],
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
previous: TokenTypeId.OpenParenthesis,
|
|
13
|
+
expected: [
|
|
14
|
+
TokenTypeId.AlignmentBitCount8,
|
|
15
|
+
TokenTypeId.AlignmentBitCount16,
|
|
16
|
+
TokenTypeId.AlignmentBitCount32,
|
|
17
|
+
TokenTypeId.AlignmentBitCount64,
|
|
18
|
+
TokenTypeId.AlignmentBitCount128,
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
previous: TokenTypeId.AlignmentBitCount8,
|
|
23
|
+
expected: TokenTypeId.CloseParenthesis,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
previous: TokenTypeId.AlignmentBitCount16,
|
|
27
|
+
expected: TokenTypeId.CloseParenthesis,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
previous: TokenTypeId.AlignmentBitCount32,
|
|
31
|
+
expected: TokenTypeId.CloseParenthesis,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
previous: TokenTypeId.AlignmentBitCount64,
|
|
35
|
+
expected: TokenTypeId.CloseParenthesis,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
previous: TokenTypeId.AlignmentBitCount128,
|
|
39
|
+
expected: TokenTypeId.CloseParenthesis,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
previous: TokenTypeId.AlignmentBitCount8,
|
|
43
|
+
expected: TokenTypeId.CloseParenthesis,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Generated by Lezer from the SDL grammar
|
|
2
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
3
|
+
|
|
4
|
+
export const arrayDefinitionRules = [
|
|
5
|
+
{
|
|
6
|
+
previous: -1,
|
|
7
|
+
expected: [
|
|
8
|
+
TokenTypeId.reserved,
|
|
9
|
+
TokenTypeId.legacy,
|
|
10
|
+
TokenTypeId.AlignedModifier,
|
|
11
|
+
TokenTypeId.ElementaryType,
|
|
12
|
+
TokenTypeId.Identifier,
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
previous: TokenTypeId.reserved,
|
|
17
|
+
expected: [
|
|
18
|
+
TokenTypeId.AlignedModifier,
|
|
19
|
+
TokenTypeId.ElementaryType,
|
|
20
|
+
TokenTypeId.Identifier,
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
previous: TokenTypeId.legacy,
|
|
25
|
+
expected: [
|
|
26
|
+
TokenTypeId.AlignedModifier,
|
|
27
|
+
TokenTypeId.ElementaryType,
|
|
28
|
+
TokenTypeId.Identifier,
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
previous: TokenTypeId.AlignedModifier,
|
|
33
|
+
expected: [TokenTypeId.ElementaryType, TokenTypeId.Identifier],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
previous: TokenTypeId.ElementaryType,
|
|
37
|
+
expected: TokenTypeId.LengthAttribute,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
previous: TokenTypeId.LengthAttribute,
|
|
41
|
+
expected: TokenTypeId.Identifier,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
previous: [-1, TokenTypeId.Identifier],
|
|
45
|
+
expected: TokenTypeId.Identifier,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
previous: [TokenTypeId.reserved, TokenTypeId.Identifier],
|
|
49
|
+
expected: TokenTypeId.Identifier,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
previous: [TokenTypeId.legacy, TokenTypeId.Identifier],
|
|
53
|
+
expected: TokenTypeId.Identifier,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
previous: [TokenTypeId.AlignedModifier, TokenTypeId.Identifier],
|
|
57
|
+
expected: TokenTypeId.Identifier,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
previous: [TokenTypeId.LengthAttribute, TokenTypeId.Identifier],
|
|
61
|
+
expected: [
|
|
62
|
+
TokenTypeId.ImplicitArrayDimension,
|
|
63
|
+
TokenTypeId.ExplicitArrayDimension,
|
|
64
|
+
TokenTypeId.PartialArrayDimension,
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
previous: [TokenTypeId.Identifier, TokenTypeId.Identifier],
|
|
69
|
+
expected: [
|
|
70
|
+
TokenTypeId.ImplicitArrayDimension,
|
|
71
|
+
TokenTypeId.ExplicitArrayDimension,
|
|
72
|
+
TokenTypeId.PartialArrayDimension,
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
previous: TokenTypeId.ImplicitArrayDimension,
|
|
77
|
+
expected: TokenTypeId.Semicolon,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
previous: TokenTypeId.ExplicitArrayDimension,
|
|
81
|
+
expected: [TokenTypeId.ExplicitArrayDimension, TokenTypeId.Semicolon],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
previous: TokenTypeId.PartialArrayDimension,
|
|
85
|
+
expected: [TokenTypeId.PartialArrayDimension, TokenTypeId.Semicolon],
|
|
86
|
+
},
|
|
87
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
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 arrayElementAccessRules = [
|
|
7
|
+
{
|
|
8
|
+
previous: -1,
|
|
9
|
+
expected: TokenTypeId.OpenBracket,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
previous: TokenTypeId.OpenBracket,
|
|
13
|
+
expected: expressionTypes,
|
|
14
|
+
},
|
|
15
|
+
...expressionTypes.map((expressionType) => ({
|
|
16
|
+
previous: expressionType,
|
|
17
|
+
expected: [
|
|
18
|
+
TokenTypeId.CloseBracket,
|
|
19
|
+
...binaryOperatorTypes,
|
|
20
|
+
],
|
|
21
|
+
})),
|
|
22
|
+
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { 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 assignmentExpressionRules = [
|
|
7
|
+
{
|
|
8
|
+
previous: -1,
|
|
9
|
+
expected: expressionTypes,
|
|
10
|
+
},
|
|
11
|
+
...expressionTypes.map((expressionType) => ({
|
|
12
|
+
previous: expressionType,
|
|
13
|
+
expected: TokenTypeId.Assignment,
|
|
14
|
+
})),
|
|
15
|
+
{
|
|
16
|
+
previous: TokenTypeId.Assignment,
|
|
17
|
+
expected: expressionTypes,
|
|
18
|
+
},
|
|
19
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
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 binaryExpressionRules = [
|
|
7
|
+
{
|
|
8
|
+
previous: -1,
|
|
9
|
+
expected: TokenTypeId.UnaryExpression,
|
|
10
|
+
},
|
|
11
|
+
...expressionTypes.map((type) => {
|
|
12
|
+
return {
|
|
13
|
+
previous: type,
|
|
14
|
+
expected: binaryOperatorTypes,
|
|
15
|
+
};
|
|
16
|
+
}),
|
|
17
|
+
...binaryOperatorTypes.map((type) => {
|
|
18
|
+
return {
|
|
19
|
+
previous: type,
|
|
20
|
+
expected: expressionTypes,
|
|
21
|
+
};
|
|
22
|
+
}),
|
|
23
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Generated by Lezer from the SDL grammar
|
|
2
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
3
|
+
|
|
4
|
+
export const bitModifierRules = [
|
|
5
|
+
{ previous: -1, expected: TokenTypeId.Colon },
|
|
6
|
+
{ previous: TokenTypeId.Colon, expected: TokenTypeId.bit },
|
|
7
|
+
{ previous: TokenTypeId.bit, expected: TokenTypeId.OpenParenthesis },
|
|
8
|
+
{
|
|
9
|
+
previous: TokenTypeId.OpenParenthesis,
|
|
10
|
+
expected: TokenTypeId.IntegerLiteral,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
previous: TokenTypeId.IntegerLiteral,
|
|
14
|
+
expected: TokenTypeId.CloseParenthesis,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
previous: TokenTypeId.CloseParenthesis,
|
|
18
|
+
expected: [TokenTypeId.Identifier, TokenTypeId.ExtendedClassIdRange],
|
|
19
|
+
},
|
|
20
|
+
{ previous: TokenTypeId.Identifier, expected: TokenTypeId.Assignment },
|
|
21
|
+
{
|
|
22
|
+
previous: TokenTypeId.Assignment,
|
|
23
|
+
expected: TokenTypeId.ExtendedClassIdRange,
|
|
24
|
+
},
|
|
25
|
+
];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { numberLiteralTypes, statementTypes } 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 caseClauseRules = [
|
|
7
|
+
{
|
|
8
|
+
previous: -1,
|
|
9
|
+
expected: TokenTypeId._case,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
previous: TokenTypeId._case,
|
|
13
|
+
expected: numberLiteralTypes,
|
|
14
|
+
},
|
|
15
|
+
...numberLiteralTypes.map((type) => ({
|
|
16
|
+
previous: type,
|
|
17
|
+
expected: TokenTypeId.Colon,
|
|
18
|
+
})),
|
|
19
|
+
{
|
|
20
|
+
previous: TokenTypeId.Colon,
|
|
21
|
+
expected: [...statementTypes, TokenTypeId.OpenBrace, TokenTypeId._break],
|
|
22
|
+
},
|
|
23
|
+
...statementTypes.map((type) => ({
|
|
24
|
+
previous: type,
|
|
25
|
+
expected: [...statementTypes, TokenTypeId._break],
|
|
26
|
+
})),
|
|
27
|
+
{
|
|
28
|
+
previous: TokenTypeId._break,
|
|
29
|
+
expected: TokenTypeId.Semicolon,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
previous: TokenTypeId.OpenBrace,
|
|
33
|
+
expected: statementTypes,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
previous: TokenTypeId.Semicolon,
|
|
37
|
+
expected: TokenTypeId.CloseBrace,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { statementTypes } 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 classDeclarationRules = [
|
|
7
|
+
{
|
|
8
|
+
previous: -1,
|
|
9
|
+
expected: [
|
|
10
|
+
TokenTypeId.AlignedModifier,
|
|
11
|
+
TokenTypeId.ExpandableModifier,
|
|
12
|
+
TokenTypeId.abstract,
|
|
13
|
+
TokenTypeId._class,
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
previous: TokenTypeId.AlignedModifier,
|
|
18
|
+
expected: [
|
|
19
|
+
TokenTypeId.ExpandableModifier,
|
|
20
|
+
TokenTypeId.abstract,
|
|
21
|
+
TokenTypeId._class,
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
previous: TokenTypeId.ExpandableModifier,
|
|
26
|
+
expected: [
|
|
27
|
+
TokenTypeId.abstract,
|
|
28
|
+
TokenTypeId._class,
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
previous: TokenTypeId.abstract,
|
|
33
|
+
expected: TokenTypeId._class,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
previous: TokenTypeId._class,
|
|
37
|
+
expected: TokenTypeId.Identifier,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
previous: TokenTypeId.Identifier,
|
|
41
|
+
expected: [
|
|
42
|
+
TokenTypeId.ParameterList,
|
|
43
|
+
TokenTypeId.ExtendsModifier,
|
|
44
|
+
TokenTypeId.BitModifier,
|
|
45
|
+
TokenTypeId.OpenBrace,
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
previous: TokenTypeId.ParameterList,
|
|
50
|
+
expected: [
|
|
51
|
+
TokenTypeId.ExtendsModifier,
|
|
52
|
+
TokenTypeId.BitModifier,
|
|
53
|
+
TokenTypeId.OpenBrace,
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
previous: TokenTypeId.ExtendsModifier,
|
|
58
|
+
expected: [
|
|
59
|
+
TokenTypeId.BitModifier,
|
|
60
|
+
TokenTypeId.OpenBrace,
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
previous: TokenTypeId.BitModifier,
|
|
65
|
+
expected: TokenTypeId.OpenBrace,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
previous: TokenTypeId.OpenBrace,
|
|
69
|
+
expected: [
|
|
70
|
+
...statementTypes,
|
|
71
|
+
TokenTypeId.CloseBrace,
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
...statementTypes.map((type) => ({
|
|
75
|
+
previous: type,
|
|
76
|
+
expected: [
|
|
77
|
+
...statementTypes,
|
|
78
|
+
TokenTypeId.CloseBrace,
|
|
79
|
+
],
|
|
80
|
+
})),
|
|
81
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Generated by Lezer from the SDL grammar
|
|
2
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
3
|
+
|
|
4
|
+
export const classDefinitionRules = [
|
|
5
|
+
{
|
|
6
|
+
previous: -1,
|
|
7
|
+
expected: [
|
|
8
|
+
TokenTypeId.legacy,
|
|
9
|
+
TokenTypeId.Identifier,
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
previous: TokenTypeId.legacy,
|
|
14
|
+
expected: TokenTypeId.Identifier,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
previous: TokenTypeId.Identifier,
|
|
18
|
+
expected: TokenTypeId.Identifier,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
previous: [TokenTypeId.Identifier, TokenTypeId.Identifier],
|
|
22
|
+
expected: [TokenTypeId.ParameterValueList, TokenTypeId.Semicolon],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
previous: TokenTypeId.ParameterValueList,
|
|
26
|
+
expected: TokenTypeId.Semicolon,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
@@ -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 classIdRangeRules = [
|
|
5
|
+
{
|
|
6
|
+
previous: -1,
|
|
7
|
+
expected: TokenTypeId.ClassId,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
previous: TokenTypeId.ClassId,
|
|
11
|
+
expected: TokenTypeId.RangeOperator,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
previous: TokenTypeId.RangeOperator,
|
|
15
|
+
expected: TokenTypeId.ClassId,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by Lezer from the SDL grammar
|
|
2
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
3
|
+
|
|
4
|
+
export const classMemberAccessRules = [
|
|
5
|
+
{ previous: -1, expected: TokenTypeId.Period },
|
|
6
|
+
{ previous: TokenTypeId.Period, expected: TokenTypeId.Identifier },
|
|
7
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { statementTypes } 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 compoundStatementRules = [
|
|
7
|
+
{
|
|
8
|
+
previous: -1,
|
|
9
|
+
expected: TokenTypeId.OpenBrace,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
previous: TokenTypeId.OpenBrace,
|
|
13
|
+
expected: [
|
|
14
|
+
...statementTypes,
|
|
15
|
+
TokenTypeId.CloseBrace,
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
...statementTypes.map((type) => ({
|
|
19
|
+
previous: type,
|
|
20
|
+
expected: [
|
|
21
|
+
...statementTypes,
|
|
22
|
+
TokenTypeId.CloseBrace,
|
|
23
|
+
],
|
|
24
|
+
})),
|
|
25
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Generated by Lezer from the SDL grammar
|
|
2
|
+
import * as TokenTypeId from "../../lezer/parser.terms.ts";
|
|
3
|
+
|
|
4
|
+
export const computedArrayDefinitionRules = [
|
|
5
|
+
{
|
|
6
|
+
previous: -1,
|
|
7
|
+
expected: TokenTypeId.computed,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
previous: TokenTypeId.computed,
|
|
11
|
+
expected: TokenTypeId.ElementaryType,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
previous: TokenTypeId.ElementaryType,
|
|
15
|
+
expected: TokenTypeId.Identifier,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
previous: TokenTypeId.Identifier,
|
|
19
|
+
expected: TokenTypeId.ExplicitArrayDimension,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
previous: TokenTypeId.ExplicitArrayDimension,
|
|
23
|
+
expected: [TokenTypeId.ExplicitArrayDimension, TokenTypeId.Semicolon],
|
|
24
|
+
},
|
|
25
|
+
];
|