@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,21 @@
|
|
|
1
|
+
import type { OptionalNode, RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
5
|
+
import type { Token } from "./token.ts";
|
|
6
|
+
|
|
7
|
+
export class AlignedModifier extends AbstractCompositeNode {
|
|
8
|
+
constructor(
|
|
9
|
+
public readonly alignedKeyword: RequiredNode<Token>,
|
|
10
|
+
public readonly openParenthesisPunctuator: OptionalNode<Token>,
|
|
11
|
+
public readonly bitCountModifierToken: OptionalNode<Token>,
|
|
12
|
+
public readonly closeParenthesisPunctuator: OptionalNode<Token>,
|
|
13
|
+
public readonly alignment: number,
|
|
14
|
+
children: Array<AbstractNode>,
|
|
15
|
+
) {
|
|
16
|
+
super(
|
|
17
|
+
NodeKind.ALIGNED_MODIFIER,
|
|
18
|
+
children,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OptionalNode,
|
|
3
|
+
RequiredNode,
|
|
4
|
+
ZeroToManyList,
|
|
5
|
+
} from "../util/types.ts";
|
|
6
|
+
import { AbstractArrayDefinition } from "./abstract-array-definition.ts";
|
|
7
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
8
|
+
import type { AlignedModifier } from "./aligned-modifier.ts";
|
|
9
|
+
import type { ElementaryType } from "./elementary-type.ts";
|
|
10
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
11
|
+
import type { ExplicitArrayDimension } from "./explicit-array-dimension.ts";
|
|
12
|
+
import type { Identifier } from "./identifier.ts";
|
|
13
|
+
import type { ImplicitArrayDimension } from "./implicit-array-dimension.ts";
|
|
14
|
+
import type { LengthAttribute } from "./length-attribute.ts";
|
|
15
|
+
import type { PartialArrayDimension } from "./partial-array-dimension.ts";
|
|
16
|
+
import type { Token } from "./token.ts";
|
|
17
|
+
|
|
18
|
+
export class ArrayDefinition extends AbstractArrayDefinition {
|
|
19
|
+
constructor(
|
|
20
|
+
public readonly reservedKeyword: OptionalNode<Token>,
|
|
21
|
+
public readonly legacyKeyword: OptionalNode<Token>,
|
|
22
|
+
public readonly alignedModifier: OptionalNode<AlignedModifier>,
|
|
23
|
+
public readonly elementaryType: OptionalNode<ElementaryType>,
|
|
24
|
+
public readonly lengthAttribute: OptionalNode<LengthAttribute>,
|
|
25
|
+
public readonly classIdentifier: OptionalNode<Identifier>,
|
|
26
|
+
public readonly identifier: RequiredNode<Identifier>,
|
|
27
|
+
public readonly implicitArrayDimension: OptionalNode<
|
|
28
|
+
ImplicitArrayDimension
|
|
29
|
+
>,
|
|
30
|
+
public readonly dimensions: ZeroToManyList<
|
|
31
|
+
| ExplicitArrayDimension
|
|
32
|
+
| PartialArrayDimension
|
|
33
|
+
>,
|
|
34
|
+
semicolonPunctuator: RequiredNode<Token>,
|
|
35
|
+
children: Array<AbstractNode>,
|
|
36
|
+
) {
|
|
37
|
+
super(
|
|
38
|
+
StatementKind.ARRAY_DEFINITION,
|
|
39
|
+
identifier,
|
|
40
|
+
semicolonPunctuator,
|
|
41
|
+
children,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
3
|
+
import type { AbstractExpression } from "./abstract-expression.ts";
|
|
4
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
5
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
6
|
+
import type { Identifier } from "./identifier.ts";
|
|
7
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
8
|
+
import type { Token } from "./token.ts";
|
|
9
|
+
|
|
10
|
+
export class ArrayElementAccess extends AbstractCompositeNode {
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly openBracketPunctuator: RequiredNode<Token>,
|
|
13
|
+
public readonly index: RequiredNode<
|
|
14
|
+
AbstractExpression | NumberLiteral | Identifier
|
|
15
|
+
>,
|
|
16
|
+
public readonly closeBracketPunctuator: RequiredNode<Token>,
|
|
17
|
+
children: Array<AbstractNode>,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
NodeKind.ARRAY_ELEMENT_ACCESS,
|
|
21
|
+
children,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractExpression } from "./abstract-expression.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import type { BinaryOperatorKind } from "./enum/binary-operator-kind.ts";
|
|
5
|
+
import { ExpressionKind } from "./enum/expression-kind.ts";
|
|
6
|
+
import type { Identifier } from "./identifier.ts";
|
|
7
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
8
|
+
import type { Token } from "./token.ts";
|
|
9
|
+
|
|
10
|
+
export class BinaryExpression extends AbstractExpression {
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly leftOperand: RequiredNode<
|
|
13
|
+
| AbstractExpression
|
|
14
|
+
| Identifier
|
|
15
|
+
| NumberLiteral
|
|
16
|
+
>,
|
|
17
|
+
public readonly binaryOperator: RequiredNode<Token>,
|
|
18
|
+
public readonly rightOperand: RequiredNode<
|
|
19
|
+
| AbstractExpression
|
|
20
|
+
| Identifier
|
|
21
|
+
| NumberLiteral
|
|
22
|
+
>,
|
|
23
|
+
public readonly binaryOperatorKind: BinaryOperatorKind | undefined,
|
|
24
|
+
children: Array<AbstractNode>,
|
|
25
|
+
) {
|
|
26
|
+
super(ExpressionKind.BINARY, children);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { OptionalNode, RequiredNode } from "../util/types.ts";
|
|
2
|
+
import type { AbstractClassId } from "./abstract-class-id.ts";
|
|
3
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
4
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
5
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
6
|
+
import type { Identifier } from "./identifier.ts";
|
|
7
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
8
|
+
import type { Token } from "./token.ts";
|
|
9
|
+
|
|
10
|
+
export class BitModifier extends AbstractCompositeNode {
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly colonPunctuator: RequiredNode<Token>,
|
|
13
|
+
public readonly bitKeyword: RequiredNode<Token>,
|
|
14
|
+
public readonly openParenthesisPunctuator: RequiredNode<Token>,
|
|
15
|
+
public readonly length: RequiredNode<NumberLiteral>,
|
|
16
|
+
public readonly closeParenthesisPunctuator: RequiredNode<Token>,
|
|
17
|
+
public readonly identifier: OptionalNode<Identifier>,
|
|
18
|
+
public readonly assignmentOperator: OptionalNode<Token>,
|
|
19
|
+
public readonly classId: RequiredNode<AbstractClassId>,
|
|
20
|
+
children: Array<AbstractNode>,
|
|
21
|
+
) {
|
|
22
|
+
super(NodeKind.BIT_MODIFIER, children);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OptionalNode,
|
|
3
|
+
RequiredNode,
|
|
4
|
+
ZeroToManyList,
|
|
5
|
+
} from "../util/types.ts";
|
|
6
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
7
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
8
|
+
import type { AbstractStatement } from "./abstract-statement.ts";
|
|
9
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
10
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
11
|
+
import type { Token } from "./token.ts";
|
|
12
|
+
|
|
13
|
+
export class CaseClause extends AbstractCompositeNode {
|
|
14
|
+
constructor(
|
|
15
|
+
public readonly caseKeyword: RequiredNode<Token>,
|
|
16
|
+
public readonly value: RequiredNode<NumberLiteral>,
|
|
17
|
+
public readonly colonPunctuator: RequiredNode<Token>,
|
|
18
|
+
public readonly openBracePunctuator: OptionalNode<Token>,
|
|
19
|
+
public readonly statements: ZeroToManyList<AbstractStatement>,
|
|
20
|
+
public readonly breakKeyword: OptionalNode<Token>,
|
|
21
|
+
public readonly semicolonPunctuator: OptionalNode<Token>,
|
|
22
|
+
public readonly closeBracePunctuator: OptionalNode<Token>,
|
|
23
|
+
children: Array<AbstractNode>,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
NodeKind.CASE_CLAUSE,
|
|
27
|
+
children,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OptionalNode,
|
|
3
|
+
RequiredNode,
|
|
4
|
+
ZeroToManyList,
|
|
5
|
+
} from "../util/types.ts";
|
|
6
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
7
|
+
import { AbstractStatement } from "./abstract-statement.ts";
|
|
8
|
+
import type { AlignedModifier } from "./aligned-modifier.ts";
|
|
9
|
+
import type { BitModifier } from "./bit-modifier.ts";
|
|
10
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
11
|
+
import type { ExpandableModifier } from "./expandable-modifier.ts";
|
|
12
|
+
import type { ExtendsModifier } from "./extends-modifier.ts";
|
|
13
|
+
import type { Identifier } from "./identifier.ts";
|
|
14
|
+
import type { ParameterList } from "./parameter-list.ts";
|
|
15
|
+
import type { Token } from "./token.ts";
|
|
16
|
+
|
|
17
|
+
export class ClassDeclaration extends AbstractStatement {
|
|
18
|
+
constructor(
|
|
19
|
+
public readonly alignedModifier: OptionalNode<AlignedModifier>,
|
|
20
|
+
public readonly expandableModifier:
|
|
21
|
+
| OptionalNode<ExpandableModifier>
|
|
22
|
+
| undefined,
|
|
23
|
+
public readonly abstractKeyword: OptionalNode<Token>,
|
|
24
|
+
public readonly classKeyword: RequiredNode<Token>,
|
|
25
|
+
public readonly identifier: RequiredNode<Identifier>,
|
|
26
|
+
public readonly parameterList: OptionalNode<ParameterList>,
|
|
27
|
+
public readonly extendsModifier: OptionalNode<ExtendsModifier>,
|
|
28
|
+
public readonly bitModifier: OptionalNode<BitModifier>,
|
|
29
|
+
public readonly openBracePunctuator: RequiredNode<Token>,
|
|
30
|
+
public readonly statements: ZeroToManyList<AbstractStatement>,
|
|
31
|
+
public readonly closeBracePunctuator: RequiredNode<Token>,
|
|
32
|
+
children: Array<AbstractNode>,
|
|
33
|
+
) {
|
|
34
|
+
super(
|
|
35
|
+
StatementKind.CLASS_DECLARATION,
|
|
36
|
+
children,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OptionalNode, RequiredNode } from "../util/types.ts";
|
|
2
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
3
|
+
import { AbstractStatement } from "./abstract-statement.ts";
|
|
4
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
5
|
+
import type { Identifier } from "./identifier.ts";
|
|
6
|
+
import type { ParameterValueList } from "./parameter-value-list.ts";
|
|
7
|
+
import type { Token } from "./token.ts";
|
|
8
|
+
|
|
9
|
+
export class ClassDefinition extends AbstractStatement {
|
|
10
|
+
constructor(
|
|
11
|
+
public readonly legacyKeyword: OptionalNode<Token>,
|
|
12
|
+
public readonly classIdentifier: RequiredNode<Identifier>,
|
|
13
|
+
public readonly identifier: RequiredNode<Identifier>,
|
|
14
|
+
public readonly parameterValueList: OptionalNode<ParameterValueList>,
|
|
15
|
+
public readonly semicolonPunctuator: RequiredNode<Token>,
|
|
16
|
+
children: Array<AbstractNode>,
|
|
17
|
+
) {
|
|
18
|
+
super(
|
|
19
|
+
StatementKind.CLASS_DEFINITION,
|
|
20
|
+
children,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractClassId } from "./abstract-class-id.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import type { ClassId } from "./class-id.ts";
|
|
5
|
+
import { ClassIdKind } from "./enum/class-id-kind.ts";
|
|
6
|
+
import type { Token } from "./token.ts";
|
|
7
|
+
|
|
8
|
+
export class ClassIdRange extends AbstractClassId {
|
|
9
|
+
constructor(
|
|
10
|
+
public readonly startClassId: RequiredNode<ClassId>,
|
|
11
|
+
public readonly rangeOperator: RequiredNode<Token>,
|
|
12
|
+
public readonly endClassId: RequiredNode<ClassId>,
|
|
13
|
+
children: Array<AbstractNode>,
|
|
14
|
+
) {
|
|
15
|
+
super(ClassIdKind.RANGE, children);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractClassId } from "./abstract-class-id.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import { ClassIdKind } from "./enum/class-id-kind.ts";
|
|
5
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
6
|
+
|
|
7
|
+
export class ClassId extends AbstractClassId {
|
|
8
|
+
constructor(
|
|
9
|
+
public readonly value: RequiredNode<NumberLiteral>,
|
|
10
|
+
children: Array<AbstractNode>,
|
|
11
|
+
) {
|
|
12
|
+
super(ClassIdKind.SINGLE, children);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
5
|
+
import type { Identifier } from "./identifier.ts";
|
|
6
|
+
import type { Token } from "./token.ts";
|
|
7
|
+
|
|
8
|
+
export class ClassMemberAccess extends AbstractCompositeNode {
|
|
9
|
+
constructor(
|
|
10
|
+
public readonly classMemberAccessOperator: RequiredNode<Token>,
|
|
11
|
+
public readonly memberIdentifier: RequiredNode<Identifier>,
|
|
12
|
+
children: Array<AbstractNode>,
|
|
13
|
+
) {
|
|
14
|
+
super(
|
|
15
|
+
NodeKind.CLASS_MEMBER_ACCESS,
|
|
16
|
+
children,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RequiredNode, ZeroToManyList } from "../util/types.ts";
|
|
2
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
3
|
+
import { AbstractStatement } from "./abstract-statement.ts";
|
|
4
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
5
|
+
import type { Token } from "./token.ts";
|
|
6
|
+
|
|
7
|
+
export class CompoundStatement extends AbstractStatement {
|
|
8
|
+
constructor(
|
|
9
|
+
public readonly openBracePunctuator: RequiredNode<Token>,
|
|
10
|
+
public readonly statements: ZeroToManyList<AbstractStatement>,
|
|
11
|
+
public readonly closeBracePunctuator: RequiredNode<Token>,
|
|
12
|
+
children: Array<AbstractNode>,
|
|
13
|
+
) {
|
|
14
|
+
super(
|
|
15
|
+
StatementKind.COMPOUND,
|
|
16
|
+
children,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OneToManyList, RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractArrayDefinition } from "./abstract-array-definition.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import type { ElementaryType } from "./elementary-type.ts";
|
|
5
|
+
import type { ExplicitArrayDimension } from "./explicit-array-dimension.ts";
|
|
6
|
+
import type { Identifier } from "./identifier.ts";
|
|
7
|
+
import type { Token } from "./token.ts";
|
|
8
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
9
|
+
|
|
10
|
+
export class ComputedArrayDefinition extends AbstractArrayDefinition {
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly computedKeyword: RequiredNode<Token>,
|
|
13
|
+
public readonly elementaryType: RequiredNode<ElementaryType>,
|
|
14
|
+
identifier: RequiredNode<Identifier>,
|
|
15
|
+
public readonly dimensions: OneToManyList<ExplicitArrayDimension>,
|
|
16
|
+
semicolonPunctuator: RequiredNode<Token>,
|
|
17
|
+
children: Array<AbstractNode>,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
StatementKind.COMPUTED_ARRAY_DEFINITION,
|
|
21
|
+
identifier,
|
|
22
|
+
semicolonPunctuator,
|
|
23
|
+
children,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { OptionalNode, RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractElementaryTypeDefinition } from "./abstract-elementary-type-definition.ts";
|
|
3
|
+
import type { AbstractExpression } from "./abstract-expression.ts";
|
|
4
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
5
|
+
import type { ElementaryType } from "./elementary-type.ts";
|
|
6
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
7
|
+
import type { Identifier } from "./identifier.ts";
|
|
8
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
9
|
+
import type { Token } from "./token.ts";
|
|
10
|
+
|
|
11
|
+
export class ComputedElementaryTypeDefinition
|
|
12
|
+
extends AbstractElementaryTypeDefinition {
|
|
13
|
+
constructor(
|
|
14
|
+
public readonly computedKeyword: RequiredNode<Token>,
|
|
15
|
+
constKeyword: OptionalNode<Token>,
|
|
16
|
+
elementaryType: RequiredNode<ElementaryType>,
|
|
17
|
+
identifier: RequiredNode<Identifier>,
|
|
18
|
+
assignmentOperator: OptionalNode<Token>,
|
|
19
|
+
value: OptionalNode<AbstractExpression | Identifier | NumberLiteral>,
|
|
20
|
+
semicolonPunctuator: RequiredNode<Token>,
|
|
21
|
+
children: Array<AbstractNode>,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
StatementKind.COMPUTED_ELEMENTARY_TYPE_DEFINITION,
|
|
25
|
+
constKeyword,
|
|
26
|
+
elementaryType,
|
|
27
|
+
identifier,
|
|
28
|
+
assignmentOperator,
|
|
29
|
+
value,
|
|
30
|
+
semicolonPunctuator,
|
|
31
|
+
children,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OptionalNode,
|
|
3
|
+
RequiredNode,
|
|
4
|
+
ZeroToManyList,
|
|
5
|
+
} from "../util/types.ts";
|
|
6
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
7
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
8
|
+
import type { AbstractStatement } from "./abstract-statement.ts";
|
|
9
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
10
|
+
import type { Token } from "./token.ts";
|
|
11
|
+
|
|
12
|
+
export class DefaultClause extends AbstractCompositeNode {
|
|
13
|
+
constructor(
|
|
14
|
+
public readonly defaultKeyword: RequiredNode<Token>,
|
|
15
|
+
public readonly colonPunctuator: RequiredNode<Token>,
|
|
16
|
+
public readonly openBracePunctuator: OptionalNode<Token>,
|
|
17
|
+
public readonly statements: ZeroToManyList<AbstractStatement>,
|
|
18
|
+
public readonly closeBracePunctuator: OptionalNode<Token>,
|
|
19
|
+
children: Array<AbstractNode>,
|
|
20
|
+
) {
|
|
21
|
+
super(
|
|
22
|
+
NodeKind.DEFAULT_CLAUSE,
|
|
23
|
+
children,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RequiredNode } from "../util/types.ts";
|
|
2
|
+
import type { AbstractExpression } from "./abstract-expression.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import { AbstractStatement } from "./abstract-statement.ts";
|
|
5
|
+
import type { CompoundStatement } from "./compound-statement.ts";
|
|
6
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
7
|
+
import type { Identifier } from "./identifier.ts";
|
|
8
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
9
|
+
import type { Token } from "./token.ts";
|
|
10
|
+
|
|
11
|
+
export class DoStatement extends AbstractStatement {
|
|
12
|
+
constructor(
|
|
13
|
+
public readonly doKeyword: RequiredNode<Token>,
|
|
14
|
+
public readonly compoundStatement: RequiredNode<CompoundStatement>,
|
|
15
|
+
public readonly whileKeyword: RequiredNode<Token>,
|
|
16
|
+
public readonly openParenthesisPunctuator: RequiredNode<Token>,
|
|
17
|
+
public readonly condition: RequiredNode<
|
|
18
|
+
| AbstractExpression
|
|
19
|
+
| Identifier
|
|
20
|
+
| NumberLiteral
|
|
21
|
+
>,
|
|
22
|
+
public readonly closeParenthesisPunctuator: RequiredNode<Token>,
|
|
23
|
+
public readonly semicolonPunctuator: RequiredNode<Token>,
|
|
24
|
+
children: Array<AbstractNode>,
|
|
25
|
+
) {
|
|
26
|
+
super(StatementKind.DO, children);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { OptionalNode, RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractElementaryTypeDefinition } from "./abstract-elementary-type-definition.ts";
|
|
3
|
+
import type { AbstractExpression } from "./abstract-expression.ts";
|
|
4
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
5
|
+
import type { AlignedModifier } from "./aligned-modifier.ts";
|
|
6
|
+
import type { ElementaryType } from "./elementary-type.ts";
|
|
7
|
+
import type { Identifier } from "./identifier.ts";
|
|
8
|
+
import type { LengthAttribute } from "./length-attribute.ts";
|
|
9
|
+
import type { NumberLiteral } from "./number-literal.ts";
|
|
10
|
+
import type { Token } from "./token.ts";
|
|
11
|
+
import { StatementKind } from "./enum/statement-kind.ts";
|
|
12
|
+
|
|
13
|
+
export class ElementaryTypeDefinition extends AbstractElementaryTypeDefinition {
|
|
14
|
+
constructor(
|
|
15
|
+
public readonly reservedKeyword: OptionalNode<Token>,
|
|
16
|
+
public readonly legacyKeyword: OptionalNode<Token>,
|
|
17
|
+
constKeyword: OptionalNode<Token>,
|
|
18
|
+
public readonly alignedModifier: OptionalNode<AlignedModifier>,
|
|
19
|
+
elementaryType: RequiredNode<ElementaryType>,
|
|
20
|
+
public readonly lengthAttribute: RequiredNode<LengthAttribute>,
|
|
21
|
+
public readonly lookAheadOperator: OptionalNode<Token>,
|
|
22
|
+
identifier: RequiredNode<Identifier>,
|
|
23
|
+
assignmentOperator: OptionalNode<Token>,
|
|
24
|
+
value: OptionalNode<
|
|
25
|
+
| AbstractExpression
|
|
26
|
+
| NumberLiteral
|
|
27
|
+
| Identifier
|
|
28
|
+
>,
|
|
29
|
+
public readonly rangeOperator: OptionalNode<Token>,
|
|
30
|
+
public readonly endValue: OptionalNode<
|
|
31
|
+
| AbstractExpression
|
|
32
|
+
| NumberLiteral
|
|
33
|
+
| Identifier
|
|
34
|
+
>,
|
|
35
|
+
semicolonPunctuator: RequiredNode<Token>,
|
|
36
|
+
children: Array<AbstractNode>,
|
|
37
|
+
) {
|
|
38
|
+
super(
|
|
39
|
+
StatementKind.ELEMENTARY_TYPE_DEFINITION,
|
|
40
|
+
constKeyword,
|
|
41
|
+
elementaryType,
|
|
42
|
+
identifier,
|
|
43
|
+
assignmentOperator,
|
|
44
|
+
value,
|
|
45
|
+
semicolonPunctuator,
|
|
46
|
+
children,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
2
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
3
|
+
import type { LengthAttribute } from "./length-attribute.ts";
|
|
4
|
+
import type { ElementaryType } from "./elementary-type.ts";
|
|
5
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
6
|
+
import type { RequiredNode } from "../util/types.ts";
|
|
7
|
+
|
|
8
|
+
export class ElementaryTypeOutputValue extends AbstractCompositeNode {
|
|
9
|
+
constructor(
|
|
10
|
+
public readonly elementaryType: RequiredNode<ElementaryType>,
|
|
11
|
+
public readonly lengthAttribute: RequiredNode<LengthAttribute>,
|
|
12
|
+
children: Array<AbstractNode>,
|
|
13
|
+
) {
|
|
14
|
+
super(
|
|
15
|
+
NodeKind.ELEMENTARY_TYPE_OUTPUT_VALUE,
|
|
16
|
+
children,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OptionalNode, RequiredNode } from "../util/types.ts";
|
|
2
|
+
import { AbstractCompositeNode } from "./abstract-composite-node.ts";
|
|
3
|
+
import type { AbstractNode } from "./abstract-node.ts";
|
|
4
|
+
import { NodeKind } from "./enum/node-kind.ts";
|
|
5
|
+
import type { Token } from "./token.ts";
|
|
6
|
+
|
|
7
|
+
export class ElementaryType extends AbstractCompositeNode {
|
|
8
|
+
constructor(
|
|
9
|
+
public readonly unsignedQualifierKeyword: OptionalNode<Token>,
|
|
10
|
+
public readonly typeKeyword: RequiredNode<Token>,
|
|
11
|
+
children: Array<AbstractNode>,
|
|
12
|
+
) {
|
|
13
|
+
super(
|
|
14
|
+
NodeKind.ELEMENTARY_TYPE,
|
|
15
|
+
children,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different kinds of binary operators.
|
|
3
|
+
*/
|
|
4
|
+
export enum BinaryOperatorKind {
|
|
5
|
+
/** Assignment operator */
|
|
6
|
+
ASSIGNMENT,
|
|
7
|
+
/** Multiplication operator */
|
|
8
|
+
MULTIPLY,
|
|
9
|
+
/** Division operator */
|
|
10
|
+
DIVIDE,
|
|
11
|
+
/** Modulus operator */
|
|
12
|
+
MODULUS,
|
|
13
|
+
/** Addition operator */
|
|
14
|
+
ADD,
|
|
15
|
+
/** Subtraction operator */
|
|
16
|
+
SUBTRACT,
|
|
17
|
+
/** Shift left operator */
|
|
18
|
+
SHIFT_LEFT,
|
|
19
|
+
/** Shift right operator */
|
|
20
|
+
SHIFT_RIGHT,
|
|
21
|
+
/** Less than operator */
|
|
22
|
+
LESS_THAN,
|
|
23
|
+
/** Less than or equal operator */
|
|
24
|
+
LESS_THAN_OR_EQUAL,
|
|
25
|
+
/** Greater than operator */
|
|
26
|
+
GREATER_THAN,
|
|
27
|
+
/** Greater than or equal operator */
|
|
28
|
+
GREATER_THAN_OR_EQUAL,
|
|
29
|
+
/** Equal operator */
|
|
30
|
+
EQUAL,
|
|
31
|
+
/** Not equal operator */
|
|
32
|
+
NOT_EQUAL,
|
|
33
|
+
/** Bitwise AND operator */
|
|
34
|
+
BITWISE_AND,
|
|
35
|
+
/** Bitwise OR operator */
|
|
36
|
+
BITWISE_OR,
|
|
37
|
+
/** Logical AND operator */
|
|
38
|
+
LOGICAL_AND,
|
|
39
|
+
/** Logical OR operator */
|
|
40
|
+
LOGICAL_OR,
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different kinds of class IDs.
|
|
3
|
+
* This enum is used to categorize different types of class IDs.
|
|
4
|
+
*/
|
|
5
|
+
export enum ClassIdKind {
|
|
6
|
+
/** Single class ID */
|
|
7
|
+
SINGLE,
|
|
8
|
+
/** Range class ID */
|
|
9
|
+
RANGE,
|
|
10
|
+
/** Extended range class ID */
|
|
11
|
+
EXTENDED_RANGE,
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different kinds of elementary types.
|
|
3
|
+
*/
|
|
4
|
+
export enum ElementaryTypeKind {
|
|
5
|
+
/** Integer type */
|
|
6
|
+
INTEGER,
|
|
7
|
+
/** Unsigned integer type */
|
|
8
|
+
UNSIGNED_INTEGER,
|
|
9
|
+
/** Floating point type */
|
|
10
|
+
FLOATING_POINT,
|
|
11
|
+
/** Bit type */
|
|
12
|
+
BIT,
|
|
13
|
+
}
|