brighterscript 1.0.0-alpha.2 → 1.0.0-alpha.22
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/CHANGELOG.md +643 -253
- package/README.md +33 -9
- package/bsconfig.schema.json +22 -2
- package/dist/BsConfig.d.ts +9 -0
- package/dist/Cache.d.ts +5 -6
- package/dist/Cache.js +12 -11
- package/dist/Cache.js.map +1 -1
- package/dist/CodeActionUtil.d.ts +11 -2
- package/dist/CodeActionUtil.js +17 -3
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +4 -4
- package/dist/CommentFlagProcessor.js +5 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DependencyGraph.d.ts +2 -2
- package/dist/DependencyGraph.js +20 -7
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticCollection.d.ts +3 -3
- package/dist/DiagnosticCollection.js +11 -11
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.js +5 -4
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +59 -4
- package/dist/DiagnosticMessages.js +65 -7
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/LanguageServer.d.ts +51 -39
- package/dist/LanguageServer.js +316 -232
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +2 -0
- package/dist/Logger.js +10 -8
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +7 -3
- package/dist/PluginInterface.js +9 -0
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +43 -25
- package/dist/Program.js +212 -95
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +4 -0
- package/dist/ProgramBuilder.js +36 -20
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +126 -29
- package/dist/Scope.js +433 -156
- package/dist/Scope.js.map +1 -1
- package/dist/SemanticTokenUtils.d.ts +14 -0
- package/dist/SemanticTokenUtils.js +81 -0
- package/dist/SemanticTokenUtils.js.map +1 -0
- package/dist/SymbolTable.d.ts +10 -4
- package/dist/SymbolTable.js +55 -13
- package/dist/SymbolTable.js.map +1 -1
- package/dist/XmlScope.d.ts +7 -2
- package/dist/XmlScope.js +65 -27
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/AstEditor.d.ts +65 -0
- package/dist/astUtils/AstEditor.js +239 -0
- package/dist/astUtils/AstEditor.js.map +1 -0
- package/dist/{types/FunctionType.spec.d.ts → astUtils/AstEditor.spec.d.ts} +0 -0
- package/dist/astUtils/AstEditor.spec.js +254 -0
- package/dist/astUtils/AstEditor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +28 -6
- package/dist/astUtils/creators.js +137 -19
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/creators.spec.js +14 -4
- package/dist/astUtils/creators.spec.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +32 -10
- package/dist/astUtils/reflection.js +82 -7
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +130 -119
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/stackedVisitor.js.map +1 -1
- package/dist/astUtils/stackedVisitor.spec.js +13 -13
- package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +76 -51
- package/dist/astUtils/visitors.js +31 -11
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +126 -32
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/astUtils/xml.d.ts +4 -3
- package/dist/astUtils/xml.js +8 -3
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +7 -1
- package/dist/bscPlugin/BscPlugin.js +28 -0
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +4 -4
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +26 -26
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +9 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +108 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +130 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.d.ts +8 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +52 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +32 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +9 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +66 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +29 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +183 -0
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
- package/dist/cli.js +10 -3
- package/dist/cli.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -0
- package/dist/diagnosticUtils.js +15 -8
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +12 -14
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/BrsFile.Class.spec.js +717 -147
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +70 -30
- package/dist/files/BrsFile.js +719 -353
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1238 -449
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/XmlFile.d.ts +6 -5
- package/dist/files/XmlFile.js +38 -30
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +302 -237
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +44 -42
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
- package/dist/files/tests/optionalChaning.spec.js +88 -0
- package/dist/files/tests/optionalChaning.spec.js.map +1 -0
- package/dist/globalCallables.d.ts +3 -1
- package/dist/globalCallables.js +424 -152
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +28 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +133 -16
- package/dist/lexer/Lexer.d.ts +19 -1
- package/dist/lexer/Lexer.js +127 -21
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +657 -536
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +2 -2
- package/dist/lexer/TokenKind.d.ts +13 -1
- package/dist/lexer/TokenKind.js +60 -3
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +9 -0
- package/dist/parser/BrsTranspileState.js +14 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +150 -34
- package/dist/parser/Expression.js +335 -165
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +189 -89
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +153 -30
- package/dist/parser/Parser.js +1100 -503
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +687 -266
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +41 -4
- package/dist/parser/SGParser.js +186 -175
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +35 -22
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +206 -38
- package/dist/parser/SGTypes.js +470 -161
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/SGTypes.spec.d.ts +1 -0
- package/dist/parser/SGTypes.spec.js +351 -0
- package/dist/parser/SGTypes.spec.js.map +1 -0
- package/dist/parser/Statement.d.ts +202 -48
- package/dist/parser/Statement.js +648 -193
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +11 -11
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +1 -1
- package/dist/parser/TranspileState.js +15 -7
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/parser/tests/Parser.spec.d.ts +10 -9
- package/dist/parser/tests/Parser.spec.js +15 -11
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +60 -60
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +40 -39
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js +213 -194
- package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +37 -37
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Additive.spec.js +30 -30
- package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +119 -119
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +162 -138
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/Boolean.spec.js +24 -24
- package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +41 -40
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/Exponential.spec.js +17 -17
- package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
- package/dist/parser/tests/expression/Function.spec.js +256 -256
- package/dist/parser/tests/expression/Function.spec.js.map +1 -1
- package/dist/parser/tests/expression/Indexing.spec.js +87 -87
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +37 -37
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +75 -63
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +41 -41
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
- package/dist/parser/tests/expression/Primary.spec.js +41 -41
- package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
- package/dist/parser/tests/expression/Relational.spec.js +43 -43
- package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +9 -9
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +28 -28
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +102 -102
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/statement/AssignmentOperators.spec.js +36 -36
- package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
- package/dist/parser/tests/statement/Declaration.spec.js +44 -44
- package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
- package/dist/parser/tests/statement/Dim.spec.js +21 -21
- package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
- package/dist/parser/tests/statement/Enum.spec.js +840 -0
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
- package/dist/parser/tests/statement/For.spec.d.ts +1 -0
- package/dist/parser/tests/statement/For.spec.js +46 -0
- package/dist/parser/tests/statement/For.spec.js.map +1 -0
- package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
- package/dist/parser/tests/statement/ForEach.spec.js +37 -0
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
- package/dist/parser/tests/statement/Function.spec.js +198 -197
- package/dist/parser/tests/statement/Function.spec.js.map +1 -1
- package/dist/parser/tests/statement/Goto.spec.js +15 -14
- package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
- package/dist/parser/tests/statement/Increment.spec.js +50 -50
- package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +254 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/LibraryStatement.spec.js +17 -17
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +108 -106
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +40 -40
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +46 -46
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +83 -83
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/parser/tests/statement/Stop.spec.js +12 -11
- package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
- package/dist/parser/tests/statement/Throw.spec.js +5 -5
- package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +15 -13
- package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
- package/dist/preprocessor/Chunk.d.ts +1 -1
- package/dist/preprocessor/Chunk.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +5 -5
- package/dist/preprocessor/Manifest.js +14 -35
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/preprocessor/Manifest.spec.d.ts +1 -0
- package/dist/preprocessor/Manifest.spec.js +78 -103
- package/dist/preprocessor/Manifest.spec.js.map +1 -1
- package/dist/preprocessor/Preprocessor.d.ts +1 -1
- package/dist/preprocessor/Preprocessor.js +8 -8
- package/dist/preprocessor/Preprocessor.js.map +1 -1
- package/dist/preprocessor/Preprocessor.spec.js +49 -49
- package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
- package/dist/preprocessor/PreprocessorParser.spec.js +72 -72
- package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
- package/dist/roku-types/data.json +21891 -0
- package/dist/roku-types/index.d.ts +6776 -0
- package/dist/roku-types/index.js +11 -0
- package/dist/roku-types/index.js.map +1 -0
- package/dist/types/ArrayType.d.ts +8 -5
- package/dist/types/ArrayType.js +52 -12
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +72 -11
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/BooleanType.d.ts +4 -2
- package/dist/types/BooleanType.js +9 -4
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BooleanType.spec.js +5 -3
- package/dist/types/BooleanType.spec.js.map +1 -1
- package/dist/types/BscType.d.ts +20 -5
- package/dist/types/BscType.js +24 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/CustomType.d.ts +8 -6
- package/dist/types/CustomType.js +20 -11
- package/dist/types/CustomType.js.map +1 -1
- package/dist/types/DoubleType.d.ts +2 -0
- package/dist/types/DoubleType.js +14 -9
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DoubleType.spec.js +5 -3
- package/dist/types/DoubleType.spec.js.map +1 -1
- package/dist/types/DynamicType.d.ts +2 -0
- package/dist/types/DynamicType.js +6 -2
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/DynamicType.spec.js +2 -2
- package/dist/types/DynamicType.spec.js.map +1 -1
- package/dist/types/EnumType.d.ts +22 -0
- package/dist/types/EnumType.js +55 -0
- package/dist/types/EnumType.js.map +1 -0
- package/dist/types/FloatType.d.ts +2 -0
- package/dist/types/FloatType.js +14 -9
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FloatType.spec.js +4 -2
- package/dist/types/FloatType.spec.js.map +1 -1
- package/dist/types/FunctionType.d.ts +7 -31
- package/dist/types/FunctionType.js +11 -57
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/IntegerType.d.ts +2 -0
- package/dist/types/IntegerType.js +14 -9
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/IntegerType.spec.js +5 -3
- package/dist/types/IntegerType.spec.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +13 -4
- package/dist/types/InterfaceType.js +48 -8
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.d.ts +1 -0
- package/dist/types/InterfaceType.spec.js +194 -0
- package/dist/types/InterfaceType.spec.js.map +1 -0
- package/dist/types/InvalidType.d.ts +4 -2
- package/dist/types/InvalidType.js +10 -5
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/InvalidType.spec.js +4 -2
- package/dist/types/InvalidType.spec.js.map +1 -1
- package/dist/types/LazyType.d.ts +8 -7
- package/dist/types/LazyType.js +22 -10
- package/dist/types/LazyType.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +2 -0
- package/dist/types/LongIntegerType.js +14 -9
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/LongIntegerType.spec.js +4 -2
- package/dist/types/LongIntegerType.spec.js.map +1 -1
- package/dist/types/ObjectType.d.ts +8 -4
- package/dist/types/ObjectType.js +9 -4
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ObjectType.spec.js +2 -2
- package/dist/types/ObjectType.spec.js.map +1 -1
- package/dist/types/StringType.d.ts +4 -2
- package/dist/types/StringType.js +9 -4
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/StringType.spec.js +4 -2
- package/dist/types/StringType.spec.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +28 -0
- package/dist/types/TypedFunctionType.js +88 -0
- package/dist/types/TypedFunctionType.js.map +1 -0
- package/dist/types/TypedFunctionType.spec.d.ts +1 -0
- package/dist/types/TypedFunctionType.spec.js +37 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -0
- package/dist/types/UninitializedType.js +3 -3
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/VoidType.d.ts +4 -2
- package/dist/types/VoidType.js +8 -4
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/VoidType.spec.js +2 -2
- package/dist/types/VoidType.spec.js.map +1 -1
- package/dist/types/helpers.d.ts +42 -0
- package/dist/types/helpers.js +118 -0
- package/dist/types/helpers.js.map +1 -0
- package/dist/util.d.ts +91 -21
- package/dist/util.js +364 -114
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +19 -2
- package/dist/validators/ClassValidator.js +164 -103
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +30 -19
- package/dist/astUtils/index.d.ts +0 -7
- package/dist/astUtils/index.js +0 -26
- package/dist/astUtils/index.js.map +0 -1
- package/dist/lexer/index.d.ts +0 -3
- package/dist/lexer/index.js +0 -17
- package/dist/lexer/index.js.map +0 -1
- package/dist/parser/index.d.ts +0 -3
- package/dist/parser/index.js +0 -16
- package/dist/parser/index.js.map +0 -1
- package/dist/preprocessor/index.d.ts +0 -3
- package/dist/preprocessor/index.js +0 -16
- package/dist/preprocessor/index.js.map +0 -1
- package/dist/types/FunctionType.spec.js +0 -23
- package/dist/types/FunctionType.spec.js.map +0 -1
package/dist/parser/SGTypes.d.ts
CHANGED
|
@@ -1,53 +1,143 @@
|
|
|
1
1
|
import { SourceNode } from 'source-map';
|
|
2
2
|
import type { Range } from 'vscode-languageserver';
|
|
3
|
-
import type { FileReference
|
|
3
|
+
import type { FileReference } from '../interfaces';
|
|
4
|
+
import { BooleanType } from '../types/BooleanType';
|
|
5
|
+
import { DynamicType } from '../types/DynamicType';
|
|
6
|
+
import { FloatType } from '../types/FloatType';
|
|
7
|
+
import { TypedFunctionType } from '../types/TypedFunctionType';
|
|
8
|
+
import { IntegerType } from '../types/IntegerType';
|
|
9
|
+
import { LongIntegerType } from '../types/LongIntegerType';
|
|
10
|
+
import { StringType } from '../types/StringType';
|
|
4
11
|
import type { TranspileState } from './TranspileState';
|
|
5
12
|
export interface SGToken {
|
|
6
13
|
text: string;
|
|
7
14
|
range?: Range;
|
|
8
15
|
}
|
|
9
|
-
export
|
|
10
|
-
key: SGToken;
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
export declare class SGAttribute {
|
|
17
|
+
constructor(key: SGToken, equals?: SGToken, openingQuote?: SGToken, value?: SGToken, closingQuote?: SGToken);
|
|
18
|
+
tokens: {
|
|
19
|
+
key: SGToken;
|
|
20
|
+
equals?: SGToken;
|
|
21
|
+
openingQuote?: SGToken;
|
|
22
|
+
value?: SGToken;
|
|
23
|
+
closingQuote?: SGToken;
|
|
24
|
+
};
|
|
25
|
+
get key(): string;
|
|
26
|
+
/**
|
|
27
|
+
* The value of this attribute. This does not including the opening or closing quote
|
|
28
|
+
*/
|
|
29
|
+
get value(): string | undefined;
|
|
30
|
+
set value(val: string | undefined);
|
|
31
|
+
get range(): Range;
|
|
32
|
+
private _range;
|
|
33
|
+
transpile(state: TranspileState): SourceNode;
|
|
13
34
|
}
|
|
14
35
|
export declare class SGTag {
|
|
15
|
-
|
|
36
|
+
constructor(startTagOpen: SGToken, startTagName: SGToken, attributes?: SGAttribute[], startTagClose?: SGToken, childNodes?: SGTag[], endTagOpen?: SGToken, endTagName?: SGToken, endTagClose?: SGToken);
|
|
37
|
+
tokens: {
|
|
38
|
+
/**
|
|
39
|
+
* The first portion of the startTag. (i.e. `<` or `<?`)
|
|
40
|
+
*/
|
|
41
|
+
startTagOpen: SGToken;
|
|
42
|
+
/**
|
|
43
|
+
* The name of the opening tag (i.e. CoolTag in `<CoolTag>`).
|
|
44
|
+
*/
|
|
45
|
+
startTagName: SGToken;
|
|
46
|
+
/**
|
|
47
|
+
* The last bit of the startTag (i.e. `/>` for self-closing, `?>` for xml prologue, or `>` for tag with children)
|
|
48
|
+
*/
|
|
49
|
+
startTagClose?: SGToken;
|
|
50
|
+
/**
|
|
51
|
+
* The endTag opening char `<`
|
|
52
|
+
*/
|
|
53
|
+
endTagOpen?: SGToken;
|
|
54
|
+
/**
|
|
55
|
+
* The name of the ending tag (i.e. CoolTag in `</CoolTag>`)
|
|
56
|
+
*/
|
|
57
|
+
endTagName?: SGToken;
|
|
58
|
+
/**
|
|
59
|
+
* The endTag closing char `>`
|
|
60
|
+
*/
|
|
61
|
+
endTagClose?: SGToken;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Array of attributes found on this tag
|
|
65
|
+
*/
|
|
16
66
|
attributes: SGAttribute[];
|
|
17
|
-
|
|
18
|
-
|
|
67
|
+
/**
|
|
68
|
+
* The array of direct children AST elements of this AST node
|
|
69
|
+
*/
|
|
70
|
+
childNodes: SGTag[];
|
|
71
|
+
get range(): Range;
|
|
72
|
+
private _range;
|
|
73
|
+
/**
|
|
74
|
+
* Is this a self-closing tag?
|
|
75
|
+
*/
|
|
76
|
+
get isSelfClosing(): boolean;
|
|
19
77
|
get id(): string;
|
|
20
78
|
set id(value: string);
|
|
79
|
+
/**
|
|
80
|
+
* Get the lower-case name of this tag.
|
|
81
|
+
*/
|
|
82
|
+
get tagName(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Find all direct children by their tag name (case insensitive).
|
|
85
|
+
* This does not step into children's children.
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
getChildNodesByTagName<T extends SGTag>(tagName: string): readonly T[];
|
|
89
|
+
/**
|
|
90
|
+
* Add a child to the end of the children array
|
|
91
|
+
*/
|
|
92
|
+
addChild<T extends SGTag>(tag: T): T;
|
|
93
|
+
/**
|
|
94
|
+
* Remove a child from the children array.
|
|
95
|
+
* @returns true if node was found and removed, false if the node wasn't there and thus nothing was done
|
|
96
|
+
*/
|
|
97
|
+
removeChild(tag: SGTag): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Does this node have the specified attribute?
|
|
100
|
+
*/
|
|
101
|
+
hasAttribute(name: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Get an SGAttribute by its name
|
|
104
|
+
*/
|
|
21
105
|
getAttribute(name: string): SGAttribute | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Get an attribute value by its name
|
|
108
|
+
*/
|
|
22
109
|
getAttributeValue(name: string): string | undefined;
|
|
23
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Set an attribute value by its name. If no attribute exists with this name, it is created
|
|
112
|
+
*/
|
|
113
|
+
setAttributeValue(name: string, value: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Remove an attribute by its name
|
|
116
|
+
* @returns true if an attribute was found and removed. False if no attribute was found
|
|
117
|
+
*/
|
|
118
|
+
removeAttribute(name: string): boolean;
|
|
24
119
|
transpile(state: TranspileState): SourceNode;
|
|
25
|
-
protected transpileBody(state: TranspileState):
|
|
26
|
-
protected transpileAttributes(state: TranspileState, attributes: SGAttribute[]):
|
|
120
|
+
protected transpileBody(state: TranspileState): SourceNode;
|
|
121
|
+
protected transpileAttributes(state: TranspileState, attributes: SGAttribute[]): SourceNode;
|
|
27
122
|
}
|
|
28
123
|
export declare class SGProlog extends SGTag {
|
|
29
|
-
transpile(state: TranspileState): SourceNode;
|
|
30
124
|
}
|
|
31
125
|
export declare class SGNode extends SGTag {
|
|
32
|
-
children: SGNode[];
|
|
33
|
-
constructor(tag: SGToken, attributes?: SGAttribute[], children?: SGNode[], range?: Range);
|
|
34
|
-
protected transpileBody(state: TranspileState): (string | SourceNode)[];
|
|
35
126
|
}
|
|
36
|
-
export declare class SGChildren extends
|
|
37
|
-
|
|
127
|
+
export declare class SGChildren extends SGTag {
|
|
128
|
+
}
|
|
129
|
+
export declare class SGCustomization extends SGTag {
|
|
38
130
|
}
|
|
39
131
|
export declare class SGScript extends SGTag {
|
|
40
132
|
cdata?: SGToken;
|
|
41
|
-
constructor(tag?: SGToken, attributes?: SGAttribute[], cdata?: SGToken, range?: Range);
|
|
42
133
|
get type(): string;
|
|
43
134
|
set type(value: string);
|
|
44
135
|
get uri(): string;
|
|
45
136
|
set uri(value: string);
|
|
46
|
-
protected transpileBody(state: TranspileState):
|
|
47
|
-
protected transpileAttributes(state: TranspileState, attributes: SGAttribute[]):
|
|
137
|
+
protected transpileBody(state: TranspileState): SourceNode;
|
|
138
|
+
protected transpileAttributes(state: TranspileState, attributes: SGAttribute[]): SourceNode;
|
|
48
139
|
}
|
|
49
|
-
export declare class
|
|
50
|
-
constructor(tag?: SGToken, attributes?: SGAttribute[], range?: Range);
|
|
140
|
+
export declare class SGInterfaceField extends SGTag {
|
|
51
141
|
get type(): string;
|
|
52
142
|
set type(value: string);
|
|
53
143
|
get alias(): string;
|
|
@@ -58,33 +148,111 @@ export declare class SGField extends SGTag {
|
|
|
58
148
|
set onChange(value: string);
|
|
59
149
|
get alwaysNotify(): string;
|
|
60
150
|
set alwaysNotify(value: string);
|
|
151
|
+
get bscType(): DynamicType | FloatType | IntegerType | LongIntegerType | StringType | BooleanType;
|
|
61
152
|
}
|
|
62
153
|
export declare const SGFieldTypes: string[];
|
|
63
|
-
export declare
|
|
64
|
-
|
|
154
|
+
export declare function getBscTypeFromSGFieldType(sgFieldType: string): DynamicType | FloatType | IntegerType | LongIntegerType | StringType | BooleanType;
|
|
155
|
+
export declare class SGInterfaceFunction extends SGTag {
|
|
65
156
|
get name(): string;
|
|
66
157
|
set name(value: string);
|
|
158
|
+
get functionType(): TypedFunctionType;
|
|
67
159
|
}
|
|
160
|
+
export declare type SGInterfaceMember = SGInterfaceField | SGInterfaceFunction;
|
|
68
161
|
export declare class SGInterface extends SGTag {
|
|
69
|
-
fields:
|
|
70
|
-
functions:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
162
|
+
get fields(): readonly SGInterfaceField[];
|
|
163
|
+
get functions(): readonly SGInterfaceFunction[];
|
|
164
|
+
get members(): readonly SGInterfaceMember[];
|
|
165
|
+
/**
|
|
166
|
+
* Check if there's an SGField with the specified name
|
|
167
|
+
*/
|
|
168
|
+
hasField(id: string): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Check if there's an SGFunction with the specified name
|
|
171
|
+
*/
|
|
172
|
+
hasFunction(name: string): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Find a field by its ID
|
|
175
|
+
*/
|
|
176
|
+
getField(id: string): SGInterfaceField;
|
|
177
|
+
/**
|
|
178
|
+
* Set the value of a field. Creates a new field if one does not already exist with this ID
|
|
179
|
+
*/
|
|
180
|
+
setField(id: string, type: string, onChange?: string, alwaysNotify?: boolean, alias?: string): SGInterfaceField;
|
|
181
|
+
/**
|
|
182
|
+
* Remove a field from the interface
|
|
183
|
+
* @returns true if a field was found and removed. Returns false if no field was found with that name
|
|
184
|
+
*/
|
|
185
|
+
removeField(id: string): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Get the interface function with the specified name
|
|
188
|
+
*/
|
|
189
|
+
getFunction(name: string): SGInterfaceFunction;
|
|
190
|
+
/**
|
|
191
|
+
* Add or replace a function on the interface
|
|
192
|
+
*/
|
|
193
|
+
setFunction(name: string): SGInterfaceFunction;
|
|
194
|
+
/**
|
|
195
|
+
* Remove a function from the interface
|
|
196
|
+
* @returns true if a function was found and removed. Returns false if no function was found with that name
|
|
197
|
+
*/
|
|
198
|
+
removeFunction(name: string): boolean;
|
|
77
199
|
}
|
|
78
200
|
export declare class SGComponent extends SGTag {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Get all the <Field> and <Function> elements across all <Interface> nodes in this component
|
|
203
|
+
*/
|
|
204
|
+
get interfaceMembers(): readonly SGInterfaceMember[];
|
|
205
|
+
get scripts(): readonly SGScript[];
|
|
206
|
+
/**
|
|
207
|
+
* Get the `<children>` element of this component. (not to be confused with the AST `childNodes` property).
|
|
208
|
+
* If there are multiope `<children>` elements, this function will return the last `<children>` tag because that's what Roku devices do.
|
|
209
|
+
*/
|
|
210
|
+
get children(): SGChildren;
|
|
211
|
+
get customizations(): readonly SGCustomization[];
|
|
83
212
|
get name(): string;
|
|
84
213
|
set name(value: string);
|
|
85
214
|
get extends(): string;
|
|
86
215
|
set extends(value: string);
|
|
87
|
-
|
|
216
|
+
/**
|
|
217
|
+
* Does the specified field exist in the component interface?
|
|
218
|
+
*/
|
|
219
|
+
hasInterfaceField(id: string): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Does the specified function exist in the component interface?
|
|
222
|
+
*/
|
|
223
|
+
hasInterfaceFunction(name: string): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Get an interface field with the specified name
|
|
226
|
+
*/
|
|
227
|
+
getInterfaceField(name: string): SGInterfaceField | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* Return the first SGInterface node found, or insert a new one then return it
|
|
230
|
+
*/
|
|
231
|
+
private ensureInterfaceNode;
|
|
232
|
+
/**
|
|
233
|
+
* Create or update a <field> interface element.
|
|
234
|
+
* This will create a new `<interface>` element if there are none on the component already
|
|
235
|
+
*/
|
|
236
|
+
setInterfaceField(id: string, type: string, onChange?: string, alwaysNotify?: boolean, alias?: string): SGInterfaceField;
|
|
237
|
+
/**
|
|
238
|
+
* Create or update a <function> interface element.
|
|
239
|
+
* This will create a new `<interface>` element if there are none on the component already
|
|
240
|
+
*/
|
|
241
|
+
setInterfaceFunction(name: string): SGInterfaceFunction;
|
|
242
|
+
/**
|
|
243
|
+
* Remove an interface field.
|
|
244
|
+
* @returns true if a field was found and removed. Returns false if no field was found with that name
|
|
245
|
+
*/
|
|
246
|
+
removeInterfaceField(id: string): boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Get an interface field with the specified name
|
|
249
|
+
*/
|
|
250
|
+
getInterfaceFunction(name: string): SGInterfaceFunction | undefined;
|
|
251
|
+
/**
|
|
252
|
+
* Remove an interface function.
|
|
253
|
+
* @returns true if a function was found and removed. Returns false if no function was found with that name
|
|
254
|
+
*/
|
|
255
|
+
removeInterfaceFunction(name: string): boolean;
|
|
88
256
|
}
|
|
89
257
|
export interface SGReferences {
|
|
90
258
|
name?: SGToken;
|
|
@@ -96,5 +264,5 @@ export declare class SGAst {
|
|
|
96
264
|
root?: SGTag;
|
|
97
265
|
component?: SGComponent;
|
|
98
266
|
constructor(prolog?: SGProlog, root?: SGTag, component?: SGComponent);
|
|
99
|
-
transpile(state: TranspileState):
|
|
267
|
+
transpile(state: TranspileState): SourceNode;
|
|
100
268
|
}
|