brighterscript 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +1230 -285
- package/README.md +61 -131
- package/bsconfig.schema.json +68 -2
- package/dist/ActionPipeline.d.ts +10 -0
- package/dist/ActionPipeline.js +40 -0
- package/dist/ActionPipeline.js.map +1 -0
- package/dist/AstValidationSegmenter.d.ts +35 -0
- package/dist/AstValidationSegmenter.js +209 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +51 -6
- package/dist/BusyStatusTracker.d.ts +31 -0
- package/dist/BusyStatusTracker.js +83 -0
- package/dist/BusyStatusTracker.js.map +1 -0
- package/dist/Cache.d.ts +5 -6
- package/dist/Cache.js +12 -11
- package/dist/Cache.js.map +1 -1
- package/dist/CacheVerifier.d.ts +7 -0
- package/dist/CacheVerifier.js +20 -0
- package/dist/CacheVerifier.js.map +1 -0
- 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 +7 -6
- package/dist/CommentFlagProcessor.js +10 -7
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DependencyGraph.d.ts +8 -3
- package/dist/DependencyGraph.js +49 -16
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticCollection.d.ts +5 -3
- package/dist/DiagnosticCollection.js +18 -16
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +8 -4
- package/dist/DiagnosticFilterer.js +77 -44
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticManager.d.ts +55 -0
- package/dist/DiagnosticManager.js +214 -0
- package/dist/DiagnosticManager.js.map +1 -0
- package/dist/DiagnosticMessages.d.ts +184 -17
- package/dist/DiagnosticMessages.js +242 -24
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
- package/dist/DiagnosticSeverityAdjuster.js +41 -0
- package/dist/DiagnosticSeverityAdjuster.js.map +1 -0
- package/dist/FunctionScope.d.ts +28 -0
- package/dist/FunctionScope.js +52 -0
- package/dist/FunctionScope.js.map +1 -0
- package/dist/KeyedThrottler.d.ts +3 -3
- package/dist/KeyedThrottler.js +3 -3
- package/dist/KeyedThrottler.js.map +1 -1
- package/dist/LanguageServer.d.ts +72 -47
- package/dist/LanguageServer.js +544 -312
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +9 -10
- package/dist/Logger.js +36 -30
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +29 -7
- package/dist/PluginInterface.js +90 -7
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +204 -99
- package/dist/Program.js +1060 -699
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +29 -18
- package/dist/ProgramBuilder.js +170 -132
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +144 -109
- package/dist/Scope.js +538 -551
- 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/Stopwatch.d.ts +4 -0
- package/dist/Stopwatch.js +8 -1
- package/dist/Stopwatch.js.map +1 -1
- package/dist/SymbolTable.d.ts +91 -24
- package/dist/SymbolTable.js +286 -63
- package/dist/SymbolTable.js.map +1 -1
- package/dist/SymbolTypeFlag.d.ts +8 -0
- package/dist/SymbolTypeFlag.js +13 -0
- package/dist/SymbolTypeFlag.js.map +1 -0
- package/dist/Throttler.d.ts +12 -0
- package/dist/Throttler.js +39 -0
- package/dist/Throttler.js.map +1 -1
- package/dist/Watcher.d.ts +0 -3
- package/dist/Watcher.js +0 -3
- package/dist/Watcher.js.map +1 -1
- package/dist/XmlScope.d.ts +5 -15
- package/dist/XmlScope.js +35 -87
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/CachedLookups.d.ts +49 -0
- package/dist/astUtils/CachedLookups.js +324 -0
- package/dist/astUtils/CachedLookups.js.map +1 -0
- package/dist/astUtils/Editor.d.ts +69 -0
- package/dist/astUtils/Editor.js +245 -0
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/Editor.spec.js +258 -0
- package/dist/astUtils/Editor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +33 -10
- package/dist/astUtils/creators.js +224 -30
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/creators.spec.js +5 -5
- package/dist/astUtils/creators.spec.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +145 -82
- package/dist/astUtils/reflection.js +304 -132
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +267 -162
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/stackedVisitor.js.map +1 -1
- package/dist/astUtils/stackedVisitor.spec.js +14 -14
- package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +114 -53
- package/dist/astUtils/visitors.js +70 -13
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +465 -51
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/astUtils/xml.d.ts +9 -8
- package/dist/astUtils/xml.js +10 -5
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +22 -1
- package/dist/bscPlugin/BscPlugin.js +88 -0
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
- package/dist/bscPlugin/CallExpressionInfo.js +131 -0
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
- package/dist/bscPlugin/FileWriter.d.ts +6 -0
- package/dist/bscPlugin/FileWriter.js +24 -0
- package/dist/bscPlugin/FileWriter.js.map +1 -0
- package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
- package/dist/bscPlugin/SignatureHelpUtil.js +137 -0
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +26 -17
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +94 -20
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +60 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js +601 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +2139 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js +210 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js +88 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
- package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +18 -0
- package/dist/bscPlugin/hover/HoverProcessor.js +218 -0
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +737 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
- package/dist/bscPlugin/references/ReferencesProvider.js +56 -0
- package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.d.ts +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js +51 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +14 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +138 -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 +491 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.d.ts +1 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
- package/dist/bscPlugin/serialize/BslibManager.js +40 -0
- package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
- package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
- package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js +22 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js +291 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js +26 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js +245 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/symbols/symbolUtils.d.ts +5 -0
- package/dist/bscPlugin/symbols/symbolUtils.js +140 -0
- package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +21 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +202 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +12 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +99 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidatior.d.ts +7 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidatior.js +18 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidatior.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +34 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +462 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js +758 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/ProgramValidator.d.ts +11 -0
- package/dist/bscPlugin/validation/ProgramValidator.js +33 -0
- package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +131 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +1097 -0
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +2796 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +44 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
- package/dist/cli.js +117 -11
- package/dist/cli.js.map +1 -1
- package/dist/deferred.d.ts +3 -3
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +10 -3
- package/dist/diagnosticUtils.js +58 -21
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +8 -12
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +24 -0
- package/dist/files/AssetFile.js +25 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.Class.spec.js +858 -153
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +144 -82
- package/dist/files/BrsFile.js +847 -911
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +2928 -834
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/BscFile.d.ts +101 -0
- package/dist/files/BscFile.js +15 -0
- package/dist/files/BscFile.js.map +1 -0
- package/dist/files/Factory.d.ts +25 -0
- package/dist/files/Factory.js +22 -0
- package/dist/files/Factory.js.map +1 -0
- package/dist/files/LazyFileData.d.ts +20 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/LazyFileData.spec.d.ts +1 -0
- package/dist/files/LazyFileData.spec.js +27 -0
- package/dist/files/LazyFileData.spec.js.map +1 -0
- package/dist/files/XmlFile.d.ts +73 -41
- package/dist/files/XmlFile.js +126 -138
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +450 -318
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +62 -52
- 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 +152 -0
- package/dist/files/tests/optionalChaning.spec.js.map +1 -0
- package/dist/globalCallables.d.ts +3 -1
- package/dist/globalCallables.js +416 -162
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +25 -3
- package/dist/index.js +42 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +722 -119
- package/dist/interfaces.js +31 -0
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Character.spec.js +5 -5
- package/dist/lexer/Character.spec.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +40 -9
- package/dist/lexer/Lexer.js +191 -49
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +775 -563
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +11 -3
- package/dist/lexer/Token.js +10 -2
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +27 -1
- package/dist/lexer/TokenKind.js +112 -5
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/logging.d.ts +9 -0
- package/dist/logging.js +16 -0
- package/dist/logging.js.map +1 -0
- package/dist/parser/AstNode.d.ts +180 -0
- package/dist/parser/AstNode.js +245 -0
- package/dist/parser/AstNode.js.map +1 -0
- package/dist/parser/AstNode.spec.d.ts +1 -0
- package/dist/parser/AstNode.spec.js +165 -0
- package/dist/parser/AstNode.spec.js.map +1 -0
- package/dist/parser/BrsTranspileState.d.ts +12 -2
- package/dist/parser/BrsTranspileState.js +6 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +454 -210
- package/dist/parser/Expression.js +953 -498
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +200 -95
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +105 -120
- package/dist/parser/Parser.js +1406 -912
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.d.ts +3 -1
- package/dist/parser/Parser.spec.js +1383 -456
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +44 -6
- package/dist/parser/SGParser.js +212 -185
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +30 -28
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +293 -50
- package/dist/parser/SGTypes.js +540 -187
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +734 -244
- package/dist/parser/Statement.js +1758 -611
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +45 -34
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +17 -8
- package/dist/parser/TranspileState.js +73 -11
- 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 +18 -14
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +79 -69
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +53 -47
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js +217 -196
- package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +48 -42
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Additive.spec.js +31 -31
- package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +157 -120
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +202 -139
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/Boolean.spec.js +25 -25
- package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +150 -41
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/Exponential.spec.js +18 -18
- package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
- package/dist/parser/tests/expression/Function.spec.js +257 -257
- package/dist/parser/tests/expression/Function.spec.js.map +1 -1
- package/dist/parser/tests/expression/Indexing.spec.js +160 -90
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +38 -38
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +196 -98
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +42 -42
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
- package/dist/parser/tests/expression/Primary.spec.js +42 -42
- 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 +44 -44
- package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +31 -31
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +230 -90
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +377 -148
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/TypeExpression.spec.js +126 -0
- package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
- package/dist/parser/tests/statement/AssignmentOperators.spec.js +37 -37
- package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.d.ts +1 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js +262 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/Continue.spec.d.ts +1 -0
- package/dist/parser/tests/statement/Continue.spec.js +119 -0
- package/dist/parser/tests/statement/Continue.spec.js.map +1 -0
- package/dist/parser/tests/statement/Declaration.spec.js +45 -45
- package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
- package/dist/parser/tests/statement/Dim.spec.js +22 -22
- 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 +684 -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 +45 -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 +36 -0
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
- package/dist/parser/tests/statement/Function.spec.js +208 -198
- package/dist/parser/tests/statement/Function.spec.js.map +1 -1
- package/dist/parser/tests/statement/Goto.spec.js +16 -15
- package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
- package/dist/parser/tests/statement/Increment.spec.js +51 -51
- 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 +109 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/LibraryStatement.spec.js +18 -18
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +123 -163
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +125 -108
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +51 -49
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +110 -97
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/parser/tests/statement/Stop.spec.js +13 -12
- package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
- package/dist/parser/tests/statement/Throw.spec.js +6 -6
- package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +26 -15
- package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +6 -6
- package/dist/preprocessor/Manifest.js +17 -38
- 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/roku-types/data.json +19351 -0
- package/dist/roku-types/index.d.ts +5483 -0
- package/dist/roku-types/index.js +11 -0
- package/dist/roku-types/index.js.map +1 -0
- package/dist/types/ArrayType.d.ts +9 -5
- package/dist/types/ArrayType.js +68 -24
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +39 -11
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +14 -0
- package/dist/types/AssociativeArrayType.js +60 -0
- package/dist/types/AssociativeArrayType.js.map +1 -0
- package/dist/types/BaseFunctionType.d.ts +9 -0
- package/dist/types/BaseFunctionType.js +25 -0
- package/dist/types/BaseFunctionType.js.map +1 -0
- package/dist/types/BooleanType.d.ts +10 -5
- package/dist/types/BooleanType.js +21 -9
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BooleanType.spec.js +10 -4
- package/dist/types/BooleanType.spec.js.map +1 -1
- package/dist/types/BscType.d.ts +29 -3
- package/dist/types/BscType.js +121 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BscTypeKind.d.ts +25 -0
- package/dist/types/BscTypeKind.js +30 -0
- package/dist/types/BscTypeKind.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.d.ts +23 -0
- package/dist/types/BuiltInInterfaceAdder.js +174 -0
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js +115 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
- package/dist/types/ClassType.d.ts +17 -0
- package/dist/types/ClassType.js +58 -0
- package/dist/types/ClassType.js.map +1 -0
- package/dist/types/ClassType.spec.d.ts +1 -0
- package/dist/types/ClassType.spec.js +76 -0
- package/dist/types/ClassType.spec.js.map +1 -0
- package/dist/types/ComponentType.d.ts +27 -0
- package/dist/types/ComponentType.js +83 -0
- package/dist/types/ComponentType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +10 -5
- package/dist/types/DoubleType.js +25 -18
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DoubleType.spec.js +12 -4
- package/dist/types/DoubleType.spec.js.map +1 -1
- package/dist/types/DynamicType.d.ts +12 -5
- package/dist/types/DynamicType.js +22 -6
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/DynamicType.spec.js +16 -5
- package/dist/types/DynamicType.spec.js.map +1 -1
- package/dist/types/EnumType.d.ts +40 -0
- package/dist/types/EnumType.js +80 -0
- package/dist/types/EnumType.js.map +1 -0
- package/dist/types/EnumType.spec.d.ts +1 -0
- package/dist/types/EnumType.spec.js +33 -0
- package/dist/types/EnumType.spec.js.map +1 -0
- package/dist/types/FloatType.d.ts +10 -5
- package/dist/types/FloatType.js +25 -18
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FloatType.spec.js +4 -4
- package/dist/types/FloatType.spec.js.map +1 -1
- package/dist/types/FunctionType.d.ts +10 -22
- package/dist/types/FunctionType.js +26 -63
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +28 -0
- package/dist/types/InheritableType.js +157 -0
- package/dist/types/InheritableType.js.map +1 -0
- package/dist/types/IntegerType.d.ts +10 -5
- package/dist/types/IntegerType.js +25 -18
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/IntegerType.spec.js +8 -4
- package/dist/types/IntegerType.spec.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +14 -6
- package/dist/types/InterfaceType.js +26 -15
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.d.ts +1 -0
- package/dist/types/InterfaceType.spec.js +227 -0
- package/dist/types/InterfaceType.spec.js.map +1 -0
- package/dist/types/InvalidType.d.ts +9 -5
- package/dist/types/InvalidType.js +20 -9
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/InvalidType.spec.js +8 -4
- package/dist/types/InvalidType.spec.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +10 -5
- package/dist/types/LongIntegerType.js +25 -18
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/LongIntegerType.spec.js +10 -4
- package/dist/types/LongIntegerType.spec.js.map +1 -1
- package/dist/types/NamespaceType.d.ts +12 -0
- package/dist/types/NamespaceType.js +28 -0
- package/dist/types/NamespaceType.js.map +1 -0
- package/dist/types/ObjectType.d.ts +10 -5
- package/dist/types/ObjectType.js +23 -9
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ObjectType.spec.js +3 -3
- package/dist/types/ObjectType.spec.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +71 -0
- package/dist/types/ReferenceType.js +467 -0
- package/dist/types/ReferenceType.js.map +1 -0
- package/dist/types/ReferenceType.spec.d.ts +1 -0
- package/dist/types/ReferenceType.spec.js +151 -0
- package/dist/types/ReferenceType.spec.js.map +1 -0
- package/dist/types/StringType.d.ts +13 -5
- package/dist/types/StringType.js +25 -9
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/StringType.spec.js +3 -3
- package/dist/types/StringType.spec.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +33 -0
- package/dist/types/TypedFunctionType.js +106 -0
- package/dist/types/TypedFunctionType.js.map +1 -0
- package/dist/types/TypedFunctionType.spec.d.ts +1 -0
- package/dist/types/TypedFunctionType.spec.js +122 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -0
- package/dist/types/UninitializedType.d.ts +8 -6
- package/dist/types/UninitializedType.js +15 -9
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/UnionType.d.ts +20 -0
- package/dist/types/UnionType.js +127 -0
- package/dist/types/UnionType.js.map +1 -0
- package/dist/types/UnionType.spec.d.ts +1 -0
- package/dist/types/UnionType.spec.js +129 -0
- package/dist/types/UnionType.spec.js.map +1 -0
- package/dist/types/VoidType.d.ts +10 -5
- package/dist/types/VoidType.js +20 -9
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/VoidType.spec.js +3 -3
- package/dist/types/VoidType.spec.js.map +1 -1
- package/dist/types/helper.spec.d.ts +1 -0
- package/dist/types/helper.spec.js +144 -0
- package/dist/types/helper.spec.js.map +1 -0
- package/dist/types/helpers.d.ts +24 -0
- package/dist/types/helpers.js +178 -0
- package/dist/types/helpers.js.map +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.js +39 -0
- package/dist/types/index.js.map +1 -0
- package/dist/util.d.ts +216 -106
- package/dist/util.js +1289 -319
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +9 -15
- package/dist/validators/ClassValidator.js +81 -134
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +169 -138
- 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/Chunk.d.ts +0 -82
- package/dist/preprocessor/Chunk.js +0 -77
- package/dist/preprocessor/Chunk.js.map +0 -1
- package/dist/preprocessor/Preprocessor.d.ts +0 -60
- package/dist/preprocessor/Preprocessor.js +0 -156
- package/dist/preprocessor/Preprocessor.js.map +0 -1
- package/dist/preprocessor/Preprocessor.spec.js +0 -152
- package/dist/preprocessor/Preprocessor.spec.js.map +0 -1
- package/dist/preprocessor/PreprocessorParser.d.ts +0 -61
- package/dist/preprocessor/PreprocessorParser.js +0 -194
- package/dist/preprocessor/PreprocessorParser.js.map +0 -1
- package/dist/preprocessor/PreprocessorParser.spec.js +0 -116
- package/dist/preprocessor/PreprocessorParser.spec.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/CustomType.d.ts +0 -10
- package/dist/types/CustomType.js +0 -35
- package/dist/types/CustomType.js.map +0 -1
- package/dist/types/FunctionType.spec.js +0 -29
- package/dist/types/FunctionType.spec.js.map +0 -1
- package/dist/types/LazyType.d.ts +0 -15
- package/dist/types/LazyType.js +0 -32
- package/dist/types/LazyType.js.map +0 -1
- /package/dist/{preprocessor/Preprocessor.spec.d.ts → astUtils/Editor.spec.d.ts} +0 -0
- /package/dist/{preprocessor/PreprocessorParser.spec.d.ts → bscPlugin/completions/CompletionsProcessor.spec.d.ts} +0 -0
- /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/definition/DefinitionProvider.spec.d.ts} +0 -0
package/dist/parser/Parser.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type { Token
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
import type { Diagnostic, Position } from 'vscode-languageserver';
|
|
8
|
-
import { Logger } from '../Logger';
|
|
9
|
-
import type { BscType } from '../types/BscType';
|
|
10
|
-
import { SymbolTable } from '../SymbolTable';
|
|
1
|
+
import type { Token } from '../lexer/Token';
|
|
2
|
+
import { Body } from './Statement';
|
|
3
|
+
import { AnnotationExpression } from './Expression';
|
|
4
|
+
import type { Diagnostic } from 'vscode-languageserver';
|
|
5
|
+
import type { Logger } from '../logging';
|
|
6
|
+
import type { Statement } from './AstNode';
|
|
11
7
|
export declare class Parser {
|
|
12
8
|
/**
|
|
13
9
|
* The array of tokens passed to `parse()`
|
|
@@ -21,22 +17,12 @@ export declare class Parser {
|
|
|
21
17
|
* The list of statements for the parsed file
|
|
22
18
|
*/
|
|
23
19
|
ast: Body;
|
|
20
|
+
get eofToken(): Token;
|
|
24
21
|
get statements(): Statement[];
|
|
25
|
-
symbolTable: SymbolTable;
|
|
26
|
-
private get currentSymbolTable();
|
|
27
22
|
/**
|
|
28
|
-
*
|
|
29
|
-
* These are initially extracted during parse-time to improve performance, but will also be dynamically regenerated if need be.
|
|
30
|
-
*
|
|
31
|
-
* If a plugin modifies the AST, then the plugin should call Parser#invalidateReferences() to force this object to refresh
|
|
32
|
-
*/
|
|
33
|
-
get references(): References;
|
|
34
|
-
private _references;
|
|
35
|
-
/**
|
|
36
|
-
* Invalidates (clears) the references collection. This should be called anytime the AST has been manipulated.
|
|
23
|
+
* The top-level symbol table for the body of this file.
|
|
37
24
|
*/
|
|
38
|
-
|
|
39
|
-
private addPropertyHints;
|
|
25
|
+
get symbolTable(): import("..").SymbolTable;
|
|
40
26
|
/**
|
|
41
27
|
* The list of diagnostics found during the parse process
|
|
42
28
|
*/
|
|
@@ -50,18 +36,6 @@ export declare class Parser {
|
|
|
50
36
|
*/
|
|
51
37
|
options: ParseOptions;
|
|
52
38
|
private globalTerminators;
|
|
53
|
-
/**
|
|
54
|
-
* When a namespace has been started, this gets set. When it's done, this gets unset.
|
|
55
|
-
* It is useful for passing the namespace into certain statements that need it
|
|
56
|
-
*/
|
|
57
|
-
private currentNamespace;
|
|
58
|
-
private get currentNamespaceName();
|
|
59
|
-
/**
|
|
60
|
-
* When a FunctionExpression has been started, this gets set. When it's done, this gets unset.
|
|
61
|
-
* It's useful for passing the function into statements and expressions that need to be located
|
|
62
|
-
* by function later on.
|
|
63
|
-
*/
|
|
64
|
-
private currentFunctionExpression;
|
|
65
39
|
/**
|
|
66
40
|
* A list of identifiers that are permitted to be used as local variables. We store this in a property because we augment the list in the constructor
|
|
67
41
|
* based on the parse mode
|
|
@@ -78,14 +52,13 @@ export declare class Parser {
|
|
|
78
52
|
/**
|
|
79
53
|
* Static wrapper around creating a new parser and parsing a list of tokens
|
|
80
54
|
*/
|
|
81
|
-
static parse(
|
|
82
|
-
static parse(tokens: Token[], options?: ParseOptions): Parser;
|
|
55
|
+
static parse(toParse: Token[] | string, options?: ParseOptions): Parser;
|
|
83
56
|
/**
|
|
84
57
|
* Parses an array of `Token`s into an abstract syntax tree
|
|
85
58
|
* @param toParse the array of tokens to parse. May not contain any whitespace tokens
|
|
86
59
|
* @returns the same instance of the parser which contains the diagnostics and statements
|
|
87
60
|
*/
|
|
88
|
-
parse(
|
|
61
|
+
parse(toParse: Token[] | string, options?: ParseOptions): this;
|
|
89
62
|
private logger;
|
|
90
63
|
private body;
|
|
91
64
|
private sanitizeParseOptions;
|
|
@@ -102,53 +75,83 @@ export declare class Parser {
|
|
|
102
75
|
*/
|
|
103
76
|
private lastDiagnosticAsError;
|
|
104
77
|
private declaration;
|
|
78
|
+
/**
|
|
79
|
+
* Try to get an identifier. If not found, add diagnostic and return undefined
|
|
80
|
+
*/
|
|
81
|
+
private tryIdentifier;
|
|
82
|
+
private identifier;
|
|
83
|
+
private enumMemberStatement;
|
|
84
|
+
/**
|
|
85
|
+
* Create a new InterfaceMethodStatement. This should only be called from within `interfaceDeclaration`
|
|
86
|
+
*/
|
|
87
|
+
private interfaceFieldStatement;
|
|
88
|
+
private consumeAsTokenAndTypeExpression;
|
|
89
|
+
/**
|
|
90
|
+
* Create a new InterfaceMethodStatement. This should only be called from within `interfaceDeclaration()`
|
|
91
|
+
*/
|
|
92
|
+
private interfaceMethodStatement;
|
|
93
|
+
private interfaceDeclaration;
|
|
94
|
+
private enumDeclaration;
|
|
105
95
|
/**
|
|
106
96
|
* A BrighterScript class declaration
|
|
107
97
|
*/
|
|
108
98
|
private classDeclaration;
|
|
109
|
-
private
|
|
99
|
+
private fieldDeclaration;
|
|
110
100
|
/**
|
|
111
101
|
* An array of CallExpression for the current function body
|
|
112
102
|
*/
|
|
113
103
|
private callExpressions;
|
|
114
104
|
private functionDeclaration;
|
|
115
|
-
private identifier;
|
|
116
105
|
private functionParameter;
|
|
117
106
|
private assignment;
|
|
118
107
|
private checkLibrary;
|
|
108
|
+
private checkAlias;
|
|
119
109
|
private statement;
|
|
120
110
|
private whileStatement;
|
|
121
111
|
private exitWhile;
|
|
122
112
|
private forStatement;
|
|
123
113
|
private forEachStatement;
|
|
124
114
|
private exitFor;
|
|
125
|
-
private commentStatement;
|
|
126
115
|
private namespaceStatement;
|
|
127
116
|
/**
|
|
128
117
|
* Get an expression with identifiers separated by periods. Useful for namespaces and class extends
|
|
129
118
|
*/
|
|
130
|
-
private
|
|
119
|
+
private identifyingExpression;
|
|
131
120
|
/**
|
|
132
121
|
* Add an 'unexpected token' diagnostic for any token found between current and the first stopToken found.
|
|
133
122
|
*/
|
|
134
123
|
private flagUntil;
|
|
135
124
|
/**
|
|
136
125
|
* Consume tokens until one of the `stopTokenKinds` is encountered
|
|
137
|
-
* @param tokenKinds
|
|
138
|
-
* @
|
|
126
|
+
* @param stopTokenKinds a list of tokenKinds where any tokenKind in this list will result in a match
|
|
127
|
+
* @returns - the list of tokens consumed, EXCLUDING the `stopTokenKind` (you can use `this.peek()` to see which one it was)
|
|
139
128
|
*/
|
|
140
129
|
private consumeUntil;
|
|
130
|
+
private constDeclaration;
|
|
141
131
|
private libraryStatement;
|
|
142
132
|
private importStatement;
|
|
133
|
+
private typecastStatement;
|
|
134
|
+
private aliasStatement;
|
|
143
135
|
private annotationExpression;
|
|
144
136
|
private ternaryExpression;
|
|
145
137
|
private nullCoalescingExpression;
|
|
138
|
+
private regexLiteralExpression;
|
|
146
139
|
private templateString;
|
|
147
140
|
private tryCatchStatement;
|
|
148
141
|
private throwStatement;
|
|
149
142
|
private dimStatement;
|
|
150
143
|
private ifStatement;
|
|
151
144
|
private blockConditionalBranch;
|
|
145
|
+
private conditionalCompileStatement;
|
|
146
|
+
private blockConditionalCompileBranch;
|
|
147
|
+
/**
|
|
148
|
+
* Parses a block, looking for a specific terminating TokenKind to denote completion.
|
|
149
|
+
* Always looks for `#end if` or `#else`
|
|
150
|
+
*/
|
|
151
|
+
private conditionalCompileBlock;
|
|
152
|
+
private conditionalCompileConstStatement;
|
|
153
|
+
private conditionalCompileErrorStatement;
|
|
154
|
+
private ensureNewLine;
|
|
152
155
|
private ensureNewLineOrColon;
|
|
153
156
|
private ensureInline;
|
|
154
157
|
private inlineConditionalBranch;
|
|
@@ -165,6 +168,10 @@ export declare class Parser {
|
|
|
165
168
|
* @returns an AST representation of an `label` statement.
|
|
166
169
|
*/
|
|
167
170
|
private labelStatement;
|
|
171
|
+
/**
|
|
172
|
+
* Parses a `continue` statement
|
|
173
|
+
*/
|
|
174
|
+
private continueStatement;
|
|
168
175
|
/**
|
|
169
176
|
* Parses a `goto` statement
|
|
170
177
|
* @returns an AST representation of an `goto` statement.
|
|
@@ -211,33 +218,57 @@ export declare class Parser {
|
|
|
211
218
|
private call;
|
|
212
219
|
private finishCall;
|
|
213
220
|
/**
|
|
214
|
-
*
|
|
215
|
-
* Allows for built-in types (double, string, etc.) or namespaced custom types in Brighterscript mode
|
|
216
|
-
* Will always return a token of whatever is next to be parsed
|
|
221
|
+
* Creates a TypeExpression, which wraps standard ASTNodes that represent a BscType
|
|
217
222
|
*/
|
|
218
|
-
private
|
|
223
|
+
private typeExpression;
|
|
224
|
+
/**
|
|
225
|
+
* Gets a single "part" of a type of a potential Union type
|
|
226
|
+
* Note: this does not NEED to be part of a union type, but the logic is the same
|
|
227
|
+
*
|
|
228
|
+
* @param changedTokens an array that is modified with any tokens that have been changed from their default kind to identifiers - eg. when a keyword is used as type
|
|
229
|
+
* @returns an expression that was successfully parsed
|
|
230
|
+
*/
|
|
231
|
+
private getTypeExpressionPart;
|
|
219
232
|
private primary;
|
|
233
|
+
private arrayLiteral;
|
|
234
|
+
private aaLiteral;
|
|
220
235
|
/**
|
|
221
236
|
* Pop token if we encounter specified token
|
|
222
237
|
*/
|
|
223
238
|
private match;
|
|
224
239
|
/**
|
|
225
240
|
* Pop token if we encounter a token in the specified list
|
|
226
|
-
* @param tokenKinds
|
|
241
|
+
* @param tokenKinds a list of tokenKinds where any tokenKind in this list will result in a match
|
|
227
242
|
*/
|
|
228
243
|
private matchAny;
|
|
244
|
+
/**
|
|
245
|
+
* If the next series of tokens matches the given set of tokens, pop them all
|
|
246
|
+
* @param tokenKinds a list of tokenKinds used to match the next set of tokens
|
|
247
|
+
*/
|
|
248
|
+
private matchSequence;
|
|
229
249
|
/**
|
|
230
250
|
* Get next token matching a specified list, or fail with an error
|
|
231
251
|
*/
|
|
232
252
|
private consume;
|
|
253
|
+
/**
|
|
254
|
+
* Consume next token IF it matches the specified kind. Otherwise, do nothing and return undefined
|
|
255
|
+
*/
|
|
256
|
+
private consumeTokenIf;
|
|
257
|
+
private consumeToken;
|
|
233
258
|
/**
|
|
234
259
|
* Consume, or add a message if not found. But then continue and return undefined
|
|
235
260
|
*/
|
|
236
261
|
private tryConsume;
|
|
262
|
+
private tryConsumeToken;
|
|
237
263
|
private consumeStatementSeparators;
|
|
238
264
|
private advance;
|
|
239
265
|
private checkEndOfStatement;
|
|
240
266
|
private checkPrevious;
|
|
267
|
+
/**
|
|
268
|
+
* Check that the next token kind is the expected kind
|
|
269
|
+
* @param tokenKind the expected next kind
|
|
270
|
+
* @returns true if the next tokenKind is the expected value
|
|
271
|
+
*/
|
|
241
272
|
private check;
|
|
242
273
|
private checkAny;
|
|
243
274
|
private checkNext;
|
|
@@ -246,29 +277,25 @@ export declare class Parser {
|
|
|
246
277
|
private peekNext;
|
|
247
278
|
private peek;
|
|
248
279
|
private previous;
|
|
249
|
-
private synchronize;
|
|
250
|
-
/**
|
|
251
|
-
* Get the token at the specified position
|
|
252
|
-
* @param position
|
|
253
|
-
*/
|
|
254
|
-
getTokenAt(position: Position): Token;
|
|
255
280
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
281
|
+
* Sometimes we catch an error that is a diagnostic.
|
|
282
|
+
* If that's the case, we want to continue parsing.
|
|
283
|
+
* Otherwise, re-throw the error
|
|
284
|
+
*
|
|
285
|
+
* @param error error caught in a try/catch
|
|
259
286
|
*/
|
|
260
|
-
|
|
261
|
-
isPositionNextToTokenKind(position: Position, tokenKind: TokenKind): boolean;
|
|
262
|
-
getTokenBefore(currentToken: Token, tokenKind: TokenKind): Token;
|
|
263
|
-
tokenFollows(currentToken: Token, tokenKind: TokenKind): boolean;
|
|
264
|
-
getTokensUntil(currentToken: Token, tokenKind: TokenKind, direction?: -1 | 1): any[];
|
|
265
|
-
getPreviousToken(token: Token): Token;
|
|
287
|
+
private rethrowNonDiagnosticError;
|
|
266
288
|
/**
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
289
|
+
* Get the token that is {offset} indexes away from {this.current}
|
|
290
|
+
* @param offset the number of index steps away from current index to fetch
|
|
291
|
+
* @param tokenKinds the desired token must match one of these
|
|
292
|
+
* @example
|
|
293
|
+
* getToken(-1); //returns the previous token.
|
|
294
|
+
* getToken(0); //returns current token.
|
|
295
|
+
* getToken(1); //returns next token
|
|
270
296
|
*/
|
|
271
|
-
private
|
|
297
|
+
private getMatchingTokenAtOffset;
|
|
298
|
+
private synchronize;
|
|
272
299
|
dispose(): void;
|
|
273
300
|
}
|
|
274
301
|
export declare enum ParseMode {
|
|
@@ -279,60 +306,18 @@ export interface ParseOptions {
|
|
|
279
306
|
/**
|
|
280
307
|
* The parse mode. When in 'BrightScript' mode, no BrighterScript syntax is allowed, and will emit diagnostics.
|
|
281
308
|
*/
|
|
282
|
-
mode
|
|
309
|
+
mode?: ParseMode;
|
|
283
310
|
/**
|
|
284
311
|
* A logger that should be used for logging. If omitted, a default logger is used
|
|
285
312
|
*/
|
|
286
313
|
logger?: Logger;
|
|
314
|
+
/**
|
|
315
|
+
* Should locations be tracked. If false, the `range` property will be omitted
|
|
316
|
+
* @default true
|
|
317
|
+
*/
|
|
318
|
+
trackLocations?: boolean;
|
|
319
|
+
/**
|
|
320
|
+
*
|
|
321
|
+
*/
|
|
322
|
+
bsConsts?: Map<string, boolean>;
|
|
287
323
|
}
|
|
288
|
-
export declare class References {
|
|
289
|
-
assignmentStatements: AssignmentStatement[];
|
|
290
|
-
classStatements: ClassStatement[];
|
|
291
|
-
get classStatementLookup(): Map<string, ClassStatement>;
|
|
292
|
-
private _classStatementLookup;
|
|
293
|
-
functionExpressions: FunctionExpression[];
|
|
294
|
-
functionStatements: FunctionStatement[];
|
|
295
|
-
/**
|
|
296
|
-
* A map of function statements, indexed by fully-namespaced lower function name.
|
|
297
|
-
*/
|
|
298
|
-
get functionStatementLookup(): Map<string, FunctionStatement>;
|
|
299
|
-
private _functionStatementLookup;
|
|
300
|
-
importStatements: ImportStatement[];
|
|
301
|
-
libraryStatements: LibraryStatement[];
|
|
302
|
-
namespaceStatements: NamespaceStatement[];
|
|
303
|
-
newExpressions: NewExpression[];
|
|
304
|
-
propertyHints: Record<string, string>;
|
|
305
|
-
}
|
|
306
|
-
export interface LocalVarEntry {
|
|
307
|
-
lowerName: string;
|
|
308
|
-
nameToken: Identifier;
|
|
309
|
-
type: BscType;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Gets the type of an expression. If it can not be processed, will return DynamicType
|
|
313
|
-
*
|
|
314
|
-
* @param expression the Expression to process
|
|
315
|
-
* @param functionExpression the wrapping function expression
|
|
316
|
-
* @return the best guess type of that expression
|
|
317
|
-
*/
|
|
318
|
-
export declare function getBscTypeFromExpression(expression: Expression, functionExpression: FunctionExpression): BscType;
|
|
319
|
-
/**
|
|
320
|
-
* Gets the return type of a function, taking into account that the function may not have been declared yet
|
|
321
|
-
* If the callee already exists in symbol table, use that return type
|
|
322
|
-
* otherwise, make a lazy type which will not compute its type until the file is done parsing
|
|
323
|
-
*
|
|
324
|
-
* @param call the Expression to process
|
|
325
|
-
* @param functionExpression the wrapping function expression
|
|
326
|
-
* @return the best guess type of that expression
|
|
327
|
-
*/
|
|
328
|
-
export declare function getTypeFromCallExpression(call: CallExpression, functionExpression: FunctionExpression): BscType;
|
|
329
|
-
/**
|
|
330
|
-
* Gets the type of a variable
|
|
331
|
-
* if it already exists in symbol table, use that type
|
|
332
|
-
* otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
|
|
333
|
-
*
|
|
334
|
-
* @param variable the Expression to process
|
|
335
|
-
* @param functionExpression the wrapping function expression
|
|
336
|
-
* @return the best guess type of that expression
|
|
337
|
-
*/
|
|
338
|
-
export declare function getTypeFromVariableExpression(variable: VariableExpression, functionExpression: FunctionExpression): BscType;
|