brighterscript 1.0.0-alpha.5 → 1.0.0-alpha.51
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/README.md +79 -138
- package/bsconfig.schema.json +196 -5
- 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 +45 -0
- package/dist/AstValidationSegmenter.js +322 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +161 -43
- package/dist/BusyStatusTracker.d.ts +61 -0
- package/dist/BusyStatusTracker.js +148 -0
- package/dist/BusyStatusTracker.js.map +1 -0
- package/dist/Cache.d.ts +3 -8
- package/dist/Cache.js +9 -14
- 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 +29 -4
- package/dist/CodeActionUtil.js +22 -5
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +20 -15
- package/dist/CommentFlagProcessor.js +143 -58
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/CrossScopeValidator.d.ts +68 -0
- package/dist/CrossScopeValidator.js +650 -0
- package/dist/CrossScopeValidator.js.map +1 -0
- 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 +21 -5
- package/dist/DiagnosticCollection.js +77 -24
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +27 -6
- package/dist/DiagnosticFilterer.js +273 -60
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticManager.d.ts +83 -0
- package/dist/DiagnosticManager.js +422 -0
- package/dist/DiagnosticManager.js.map +1 -0
- package/dist/DiagnosticMessages.d.ts +602 -196
- package/dist/DiagnosticMessages.js +926 -342
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
- package/dist/DiagnosticSeverityAdjuster.js +45 -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 +136 -104
- package/dist/LanguageServer.js +577 -741
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +17 -13
- package/dist/Logger.js +64 -34
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +32 -10
- package/dist/PluginInterface.js +117 -7
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +302 -98
- package/dist/Program.js +1613 -726
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +39 -22
- package/dist/ProgramBuilder.js +245 -179
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +227 -106
- package/dist/Scope.js +609 -557
- package/dist/Scope.js.map +1 -1
- package/dist/ScopeNamespaceLookup.d.ts +73 -0
- package/dist/ScopeNamespaceLookup.js +242 -0
- package/dist/ScopeNamespaceLookup.js.map +1 -0
- package/dist/SemanticTokenUtils.js +5 -1
- package/dist/SemanticTokenUtils.js.map +1 -1
- 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 +145 -26
- package/dist/SymbolTable.js +575 -64
- package/dist/SymbolTable.js.map +1 -1
- package/dist/SymbolTypeFlag.d.ts +9 -0
- package/dist/SymbolTypeFlag.js +14 -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 +34 -90
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/CachedLookups.d.ts +50 -0
- package/dist/astUtils/CachedLookups.js +337 -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/creators.d.ts +54 -19
- package/dist/astUtils/creators.js +242 -42
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +199 -85
- package/dist/astUtils/reflection.js +518 -145
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/stackedVisitor.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +117 -53
- package/dist/astUtils/visitors.js +95 -15
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/xml.d.ts +9 -8
- package/dist/astUtils/xml.js +12 -7
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +26 -4
- package/dist/bscPlugin/BscPlugin.js +96 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
- package/dist/bscPlugin/CallExpressionInfo.js +142 -0
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
- package/dist/bscPlugin/FileWriter.d.ts +19 -0
- package/dist/bscPlugin/FileWriter.js +79 -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 +109 -7
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +676 -26
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.d.ts +17 -0
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.js +66 -0
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.js.map +1 -0
- package/dist/bscPlugin/codeActions/codeActionHelpers.d.ts +18 -0
- package/dist/bscPlugin/codeActions/codeActionHelpers.js +31 -0
- package/dist/bscPlugin/codeActions/codeActionHelpers.js.map +1 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +65 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js +633 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js +220 -0
- package/dist/bscPlugin/definition/DefinitionProvider.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 +238 -0
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
- package/dist/bscPlugin/references/ReferencesProvider.js +57 -0
- package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
- package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.d.ts +7 -0
- package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.js +77 -0
- package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +14 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +164 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +12 -0
- package/dist/bscPlugin/serialize/BslibManager.js +46 -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 +80 -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/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/symbolUtils.d.ts +5 -0
- package/dist/bscPlugin/symbols/symbolUtils.js +141 -0
- package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +34 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +504 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.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/BrsFileAfterValidator.d.ts +7 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidator.js +18 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidator.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +51 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +714 -0
- package/dist/bscPlugin/validation/BrsFileValidator.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 +158 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +1481 -0
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
- package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +50 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
- package/dist/cli.js +140 -28
- package/dist/cli.js.map +1 -1
- package/dist/common/Sequencer.d.ts +53 -0
- package/dist/common/Sequencer.js +233 -0
- package/dist/common/Sequencer.js.map +1 -0
- package/dist/deferred.d.ts +5 -3
- package/dist/deferred.js +10 -0
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +61 -4
- package/dist/diagnosticUtils.js +285 -25
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.d.ts +2 -2
- 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.d.ts +161 -87
- package/dist/files/BrsFile.js +919 -936
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BscFile.d.ts +102 -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 +21 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/XmlFile.d.ts +80 -41
- package/dist/files/XmlFile.js +162 -137
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/globalCallables.d.ts +3 -1
- package/dist/globalCallables.js +424 -184
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +32 -4
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +987 -125
- package/dist/interfaces.js +21 -0
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +51 -12
- package/dist/lexer/Lexer.js +214 -65
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Token.d.ts +27 -11
- package/dist/lexer/Token.js +10 -2
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +48 -2
- package/dist/lexer/TokenKind.js +167 -10
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/logging.d.ts +14 -0
- package/dist/logging.js +29 -0
- package/dist/logging.js.map +1 -0
- package/dist/lsp/ActionQueue.d.ts +35 -0
- package/dist/lsp/ActionQueue.js +115 -0
- package/dist/lsp/ActionQueue.js.map +1 -0
- package/dist/lsp/DocumentManager.d.ts +63 -0
- package/dist/lsp/DocumentManager.js +122 -0
- package/dist/lsp/DocumentManager.js.map +1 -0
- package/dist/lsp/LspProject.d.ts +287 -0
- package/dist/lsp/LspProject.js +3 -0
- package/dist/lsp/LspProject.js.map +1 -0
- package/dist/lsp/PathFilterer.d.ts +75 -0
- package/dist/lsp/PathFilterer.js +196 -0
- package/dist/lsp/PathFilterer.js.map +1 -0
- package/dist/lsp/Project.d.ts +200 -0
- package/dist/lsp/Project.js +562 -0
- package/dist/lsp/Project.js.map +1 -0
- package/dist/lsp/ProjectManager.d.ts +288 -0
- package/dist/lsp/ProjectManager.js +967 -0
- package/dist/lsp/ProjectManager.js.map +1 -0
- package/dist/lsp/ReaderWriterManager.d.ts +21 -0
- package/dist/lsp/ReaderWriterManager.js +60 -0
- package/dist/lsp/ReaderWriterManager.js.map +1 -0
- package/dist/lsp/worker/MessageHandler.d.ts +99 -0
- package/dist/lsp/worker/MessageHandler.js +138 -0
- package/dist/lsp/worker/MessageHandler.js.map +1 -0
- package/dist/lsp/worker/WorkerPool.d.ts +38 -0
- package/dist/lsp/worker/WorkerPool.js +78 -0
- package/dist/lsp/worker/WorkerPool.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.d.ts +168 -0
- package/dist/lsp/worker/WorkerThreadProject.js +205 -0
- package/dist/lsp/worker/WorkerThreadProject.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.d.ts +15 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js +58 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js.map +1 -0
- package/dist/lsp/worker/run.js +14 -0
- package/dist/lsp/worker/run.js.map +1 -0
- package/dist/parser/AstNode.d.ts +205 -0
- package/dist/parser/AstNode.js +305 -0
- package/dist/parser/AstNode.js.map +1 -0
- package/dist/parser/BrightScriptDocParser.d.ts +56 -0
- package/dist/parser/BrightScriptDocParser.js +294 -0
- package/dist/parser/BrightScriptDocParser.js.map +1 -0
- package/dist/parser/BrsTranspileState.d.ts +22 -3
- package/dist/parser/BrsTranspileState.js +19 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +601 -220
- package/dist/parser/Expression.js +1516 -502
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.d.ts +137 -121
- package/dist/parser/Parser.js +1808 -982
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/SGParser.d.ts +30 -13
- package/dist/parser/SGParser.js +94 -56
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +134 -46
- package/dist/parser/SGTypes.js +206 -115
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +854 -267
- package/dist/parser/Statement.js +2416 -621
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +30 -14
- package/dist/parser/TranspileState.js +124 -27
- package/dist/parser/TranspileState.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/roku-types/data.json +20554 -0
- package/dist/roku-types/index.d.ts +5726 -0
- package/dist/roku-types/index.js +11 -0
- package/dist/roku-types/index.js.map +1 -0
- package/dist/types/ArrayType.d.ts +12 -5
- package/dist/types/ArrayType.js +95 -25
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +15 -0
- package/dist/types/AssociativeArrayType.js +64 -0
- package/dist/types/AssociativeArrayType.js.map +1 -0
- package/dist/types/BaseFunctionType.d.ts +10 -0
- package/dist/types/BaseFunctionType.js +26 -0
- package/dist/types/BaseFunctionType.js.map +1 -0
- package/dist/types/BooleanType.d.ts +9 -5
- package/dist/types/BooleanType.js +19 -8
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BscType.d.ts +41 -3
- package/dist/types/BscType.js +152 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BscTypeKind.d.ts +28 -0
- package/dist/types/BscTypeKind.js +33 -0
- package/dist/types/BscTypeKind.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.d.ts +28 -0
- package/dist/types/BuiltInInterfaceAdder.js +212 -0
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
- package/dist/types/CallFuncableType.d.ts +24 -0
- package/dist/types/CallFuncableType.js +91 -0
- package/dist/types/CallFuncableType.js.map +1 -0
- package/dist/types/ClassType.d.ts +17 -0
- package/dist/types/ClassType.js +63 -0
- package/dist/types/ClassType.js.map +1 -0
- package/dist/types/ComponentType.d.ts +22 -0
- package/dist/types/ComponentType.js +110 -0
- package/dist/types/ComponentType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +10 -5
- package/dist/types/DoubleType.js +21 -17
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DynamicType.d.ts +13 -5
- package/dist/types/DynamicType.js +26 -5
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/EnumType.d.ts +42 -0
- package/dist/types/EnumType.js +101 -0
- package/dist/types/EnumType.js.map +1 -0
- package/dist/types/FloatType.d.ts +10 -5
- package/dist/types/FloatType.js +21 -17
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FunctionType.d.ts +8 -22
- package/dist/types/FunctionType.js +25 -63
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +29 -0
- package/dist/types/InheritableType.js +173 -0
- package/dist/types/InheritableType.js.map +1 -0
- package/dist/types/InlineInterfaceType.d.ts +5 -0
- package/dist/types/InlineInterfaceType.js +17 -0
- package/dist/types/InlineInterfaceType.js.map +1 -0
- package/dist/types/IntegerType.d.ts +10 -5
- package/dist/types/IntegerType.js +21 -17
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +14 -6
- package/dist/types/InterfaceType.js +30 -15
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/IntersectionType.d.ts +29 -0
- package/dist/types/IntersectionType.js +256 -0
- package/dist/types/IntersectionType.js.map +1 -0
- package/dist/types/InvalidType.d.ts +10 -5
- package/dist/types/InvalidType.js +21 -9
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +10 -5
- package/dist/types/LongIntegerType.js +21 -17
- package/dist/types/LongIntegerType.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 +12 -5
- package/dist/types/ObjectType.js +25 -8
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +123 -0
- package/dist/types/ReferenceType.js +726 -0
- package/dist/types/ReferenceType.js.map +1 -0
- package/dist/types/StringType.d.ts +12 -5
- package/dist/types/StringType.js +23 -8
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/TypeStatementType.d.ts +19 -0
- package/dist/types/TypeStatementType.js +56 -0
- package/dist/types/TypeStatementType.js.map +1 -0
- package/dist/types/TypedFunctionType.d.ts +34 -0
- package/dist/types/TypedFunctionType.js +157 -0
- package/dist/types/TypedFunctionType.js.map +1 -0
- package/dist/types/UninitializedType.d.ts +11 -6
- package/dist/types/UninitializedType.js +20 -11
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/UnionType.d.ts +27 -0
- package/dist/types/UnionType.js +196 -0
- package/dist/types/UnionType.js.map +1 -0
- package/dist/types/VoidType.d.ts +11 -5
- package/dist/types/VoidType.js +22 -8
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/helpers.d.ts +51 -0
- package/dist/types/helpers.js +329 -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/types/roFunctionType.d.ts +11 -0
- package/dist/types/roFunctionType.js +37 -0
- package/dist/types/roFunctionType.js.map +1 -0
- package/dist/util.d.ts +325 -185
- package/dist/util.js +2135 -568
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +9 -15
- package/dist/validators/ClassValidator.js +93 -138
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +183 -138
- package/CHANGELOG.md +0 -1188
- package/dist/astUtils/creators.spec.js +0 -21
- package/dist/astUtils/creators.spec.js.map +0 -1
- 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/astUtils/reflection.spec.d.ts +0 -1
- package/dist/astUtils/reflection.spec.js +0 -292
- package/dist/astUtils/reflection.spec.js.map +0 -1
- package/dist/astUtils/stackedVisitor.spec.d.ts +0 -1
- package/dist/astUtils/stackedVisitor.spec.js +0 -79
- package/dist/astUtils/stackedVisitor.spec.js.map +0 -1
- package/dist/astUtils/visitors.spec.d.ts +0 -1
- package/dist/astUtils/visitors.spec.js +0 -854
- package/dist/astUtils/visitors.spec.js.map +0 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.d.ts +0 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +0 -194
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.d.ts +0 -7
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js +0 -63
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js.map +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.d.ts +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js +0 -45
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js.map +0 -1
- package/dist/files/BrsFile.Class.spec.d.ts +0 -1
- package/dist/files/BrsFile.Class.spec.js +0 -1081
- package/dist/files/BrsFile.Class.spec.js.map +0 -1
- package/dist/files/BrsFile.spec.d.ts +0 -1
- package/dist/files/BrsFile.spec.js +0 -2524
- package/dist/files/BrsFile.spec.js.map +0 -1
- package/dist/files/XmlFile.spec.d.ts +0 -1
- package/dist/files/XmlFile.spec.js +0 -1065
- package/dist/files/XmlFile.spec.js.map +0 -1
- package/dist/files/tests/imports.spec.d.ts +0 -1
- package/dist/files/tests/imports.spec.js +0 -241
- package/dist/files/tests/imports.spec.js.map +0 -1
- package/dist/lexer/Character.spec.d.ts +0 -1
- package/dist/lexer/Character.spec.js +0 -27
- package/dist/lexer/Character.spec.js.map +0 -1
- package/dist/lexer/Lexer.spec.d.ts +0 -1
- package/dist/lexer/Lexer.spec.js +0 -1101
- package/dist/lexer/Lexer.spec.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/Parser.Class.spec.d.ts +0 -1
- package/dist/parser/Parser.Class.spec.js +0 -390
- package/dist/parser/Parser.Class.spec.js.map +0 -1
- package/dist/parser/Parser.spec.d.ts +0 -4
- package/dist/parser/Parser.spec.js +0 -1216
- package/dist/parser/Parser.spec.js.map +0 -1
- package/dist/parser/SGParser.spec.d.ts +0 -1
- package/dist/parser/SGParser.spec.js +0 -145
- package/dist/parser/SGParser.spec.js.map +0 -1
- package/dist/parser/SGTypes.spec.d.ts +0 -1
- package/dist/parser/SGTypes.spec.js +0 -351
- package/dist/parser/SGTypes.spec.js.map +0 -1
- package/dist/parser/Statement.spec.d.ts +0 -1
- package/dist/parser/Statement.spec.js +0 -94
- package/dist/parser/Statement.spec.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/parser/tests/Parser.spec.d.ts +0 -18
- package/dist/parser/tests/Parser.spec.js +0 -35
- package/dist/parser/tests/Parser.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/For.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/For.spec.js +0 -161
- package/dist/parser/tests/controlFlow/For.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +0 -106
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/If.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/If.spec.js +0 -551
- package/dist/parser/tests/controlFlow/If.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/While.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/While.spec.js +0 -107
- package/dist/parser/tests/controlFlow/While.spec.js.map +0 -1
- package/dist/parser/tests/expression/Additive.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Additive.spec.js +0 -99
- package/dist/parser/tests/expression/Additive.spec.js.map +0 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.d.ts +0 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +0 -254
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +0 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.d.ts +0 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +0 -266
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +0 -1
- package/dist/parser/tests/expression/Boolean.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Boolean.spec.js +0 -83
- package/dist/parser/tests/expression/Boolean.spec.js.map +0 -1
- package/dist/parser/tests/expression/Call.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Call.spec.js +0 -134
- package/dist/parser/tests/expression/Call.spec.js.map +0 -1
- package/dist/parser/tests/expression/Exponential.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Exponential.spec.js +0 -37
- package/dist/parser/tests/expression/Exponential.spec.js.map +0 -1
- package/dist/parser/tests/expression/Function.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Function.spec.js +0 -403
- package/dist/parser/tests/expression/Function.spec.js.map +0 -1
- package/dist/parser/tests/expression/Indexing.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Indexing.spec.js +0 -219
- package/dist/parser/tests/expression/Indexing.spec.js.map +0 -1
- package/dist/parser/tests/expression/Multiplicative.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +0 -67
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +0 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +0 -201
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +0 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.d.ts +0 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +0 -105
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +0 -1
- package/dist/parser/tests/expression/Primary.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Primary.spec.js +0 -149
- package/dist/parser/tests/expression/Primary.spec.js.map +0 -1
- package/dist/parser/tests/expression/Relational.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Relational.spec.js +0 -83
- package/dist/parser/tests/expression/Relational.spec.js.map +0 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +0 -201
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +0 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +0 -202
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +0 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +0 -323
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +0 -1
- package/dist/parser/tests/statement/AssignmentOperators.spec.d.ts +0 -1
- package/dist/parser/tests/statement/AssignmentOperators.spec.js +0 -79
- package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +0 -1
- package/dist/parser/tests/statement/Declaration.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Declaration.spec.js +0 -108
- package/dist/parser/tests/statement/Declaration.spec.js.map +0 -1
- package/dist/parser/tests/statement/Dim.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Dim.spec.js +0 -73
- package/dist/parser/tests/statement/Dim.spec.js.map +0 -1
- package/dist/parser/tests/statement/Function.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Function.spec.js +0 -332
- package/dist/parser/tests/statement/Function.spec.js.map +0 -1
- package/dist/parser/tests/statement/Goto.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Goto.spec.js +0 -50
- package/dist/parser/tests/statement/Goto.spec.js.map +0 -1
- package/dist/parser/tests/statement/Increment.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Increment.spec.js +0 -117
- package/dist/parser/tests/statement/Increment.spec.js.map +0 -1
- package/dist/parser/tests/statement/LibraryStatement.spec.d.ts +0 -1
- package/dist/parser/tests/statement/LibraryStatement.spec.js +0 -74
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +0 -1
- package/dist/parser/tests/statement/Misc.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Misc.spec.js +0 -333
- package/dist/parser/tests/statement/Misc.spec.js.map +0 -1
- package/dist/parser/tests/statement/PrintStatement.spec.d.ts +0 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +0 -181
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +0 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.d.ts +0 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +0 -94
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +0 -1
- package/dist/parser/tests/statement/Set.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Set.spec.js +0 -218
- package/dist/parser/tests/statement/Set.spec.js.map +0 -1
- package/dist/parser/tests/statement/Stop.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Stop.spec.js +0 -37
- package/dist/parser/tests/statement/Stop.spec.js.map +0 -1
- package/dist/parser/tests/statement/Throw.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Throw.spec.js +0 -35
- package/dist/parser/tests/statement/Throw.spec.js.map +0 -1
- package/dist/parser/tests/statement/TryCatch.spec.d.ts +0 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +0 -140
- package/dist/parser/tests/statement/TryCatch.spec.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/Manifest.spec.d.ts +0 -0
- package/dist/preprocessor/Manifest.spec.js +0 -105
- package/dist/preprocessor/Manifest.spec.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.d.ts +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.d.ts +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/ArrayType.spec.d.ts +0 -1
- package/dist/types/ArrayType.spec.js +0 -30
- package/dist/types/ArrayType.spec.js.map +0 -1
- package/dist/types/BooleanType.spec.d.ts +0 -1
- package/dist/types/BooleanType.spec.js +0 -12
- package/dist/types/BooleanType.spec.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/DoubleType.spec.d.ts +0 -1
- package/dist/types/DoubleType.spec.js +0 -12
- package/dist/types/DoubleType.spec.js.map +0 -1
- package/dist/types/DynamicType.spec.d.ts +0 -1
- package/dist/types/DynamicType.spec.js +0 -12
- package/dist/types/DynamicType.spec.js.map +0 -1
- package/dist/types/FloatType.spec.d.ts +0 -1
- package/dist/types/FloatType.spec.js +0 -12
- package/dist/types/FloatType.spec.js.map +0 -1
- package/dist/types/FunctionType.spec.d.ts +0 -1
- package/dist/types/FunctionType.spec.js +0 -29
- package/dist/types/FunctionType.spec.js.map +0 -1
- package/dist/types/IntegerType.spec.d.ts +0 -1
- package/dist/types/IntegerType.spec.js +0 -12
- package/dist/types/IntegerType.spec.js.map +0 -1
- package/dist/types/InvalidType.spec.d.ts +0 -1
- package/dist/types/InvalidType.spec.js +0 -12
- package/dist/types/InvalidType.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/types/LongIntegerType.spec.d.ts +0 -1
- package/dist/types/LongIntegerType.spec.js +0 -12
- package/dist/types/LongIntegerType.spec.js.map +0 -1
- package/dist/types/ObjectType.spec.d.ts +0 -1
- package/dist/types/ObjectType.spec.js +0 -12
- package/dist/types/ObjectType.spec.js.map +0 -1
- package/dist/types/StringType.spec.d.ts +0 -1
- package/dist/types/StringType.spec.js +0 -12
- package/dist/types/StringType.spec.js.map +0 -1
- package/dist/types/VoidType.spec.d.ts +0 -1
- package/dist/types/VoidType.spec.js +0 -12
- package/dist/types/VoidType.spec.js.map +0 -1
- /package/dist/{astUtils/creators.spec.d.ts → lsp/worker/run.d.ts} +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import * as fsExtra from 'fs';
|
|
3
|
-
// import { expect } from 'chai';
|
|
4
|
-
// import { getManifest, getBsConst } from './Manifest';
|
|
5
|
-
// import { createSandbox, SinonSandbox } from 'sinon';
|
|
6
|
-
// let sinon: SinonSandbox;
|
|
7
|
-
// describe('manifest support', () => {
|
|
8
|
-
// beforeEach(() => {
|
|
9
|
-
// sinon = createSandbox();
|
|
10
|
-
// });
|
|
11
|
-
// afterEach(() => {
|
|
12
|
-
// sinon.restore();
|
|
13
|
-
// });
|
|
14
|
-
// describe('manifest parser', () => {
|
|
15
|
-
// it('returns an empty map if manifest not found', async () => {
|
|
16
|
-
// // sinon.stub(fsExtra, 'readFile').returns(<any>
|
|
17
|
-
// // Promise.reject(
|
|
18
|
-
// // new Error('File not found')
|
|
19
|
-
// // )
|
|
20
|
-
// // );
|
|
21
|
-
// sinon.stub(fsExtra, 'readFile').returns(<any>
|
|
22
|
-
// Promise.reject(
|
|
23
|
-
// new Error('File not found')
|
|
24
|
-
// )
|
|
25
|
-
// );
|
|
26
|
-
// return expect(await getManifest('/no/manifest/here')).to.eql(new Map());
|
|
27
|
-
// });
|
|
28
|
-
// it('rejects key-value pairs with no \'=\'', () => {
|
|
29
|
-
// fs.readFile.mockImplementation((filename, encoding, cb) => cb(/* no error */ null, 'no_equal')
|
|
30
|
-
// );
|
|
31
|
-
// return expect(getManifest('/has/key/but/no/equal')).rejects.toThrowError(
|
|
32
|
-
// 'No \'=\' detected'
|
|
33
|
-
// );
|
|
34
|
-
// });
|
|
35
|
-
// it('ignores comments', () => {
|
|
36
|
-
// fs.readFile.mockImplementation((filename, encoding, cb) => cb(/* no error */ null, '# this line is ignored!')
|
|
37
|
-
// );
|
|
38
|
-
// return expect(getManifest('/has/a/manifest')).resolves.to.eql(new Map());
|
|
39
|
-
// });
|
|
40
|
-
// it('ignores empty keys and values', () => {
|
|
41
|
-
// fs.readFile.mockImplementation((filename, encoding, cb) => cb(/* no error */ null, [' =lorem', 'ipsum= '].join('\n'))
|
|
42
|
-
// );
|
|
43
|
-
// return expect(getManifest('/has/blank/keys/and/values')).resolves.to.eql(new Map());
|
|
44
|
-
// });
|
|
45
|
-
// it('trims whitespace from keys and values', () => {
|
|
46
|
-
// fs.readFile.mockImplementation((filename, encoding, cb) => cb(/* no error */ null, ' key = value ')
|
|
47
|
-
// );
|
|
48
|
-
// return expect(getManifest('/has/extra/whitespace')).resolves.to.eql(
|
|
49
|
-
// new Map([['key', 'value']])
|
|
50
|
-
// );
|
|
51
|
-
// });
|
|
52
|
-
// it('parses key-value pairs', () => {
|
|
53
|
-
// fs.readFile.mockImplementation((filename, encoding, cb) => cb(
|
|
54
|
-
// /* no error */ null,
|
|
55
|
-
// ['foo=bar=baz', 'lorem=true', 'five=5', 'six=6.000', 'version=1.2.3'].join('\n')
|
|
56
|
-
// )
|
|
57
|
-
// );
|
|
58
|
-
// return expect(getManifest('/has/a/manifest')).resolves.to.eql(
|
|
59
|
-
// new Map([
|
|
60
|
-
// ['foo', 'bar=baz'],
|
|
61
|
-
// ['lorem', true],
|
|
62
|
-
// ['five', 5],
|
|
63
|
-
// ['six', 6],
|
|
64
|
-
// ['version', '1.2.3']
|
|
65
|
-
// ])
|
|
66
|
-
// );
|
|
67
|
-
// });
|
|
68
|
-
// });
|
|
69
|
-
// describe('bs_const parser', () => {
|
|
70
|
-
// it('returns an empty map if \'bs_const\' isn\'t found', () => {
|
|
71
|
-
// let manifest = new Map([['containsBsConst', false]]);
|
|
72
|
-
// expect(getBsConst(manifest)).to.eql(new Map());
|
|
73
|
-
// });
|
|
74
|
-
// it('requires a string value for \'bs_const\' attributes', () => {
|
|
75
|
-
// let manifest = new Map([['bs_const', 1.2345]]);
|
|
76
|
-
// expect(() => getBsConst(manifest)).toThrowError('Invalid bs_const right-hand side');
|
|
77
|
-
// });
|
|
78
|
-
// it('ignores empty key-value pairs', () => {
|
|
79
|
-
// let manifest = new Map([['bs_const', ';;;;']]);
|
|
80
|
-
// expect(getBsConst(manifest)).to.eql(new Map());
|
|
81
|
-
// });
|
|
82
|
-
// it('rejects key-value pairs with no \'=\'', () => {
|
|
83
|
-
// let manifest = new Map([['bs_const', 'i-have-no-equal']]);
|
|
84
|
-
// expect(() => getBsConst(manifest)).toThrowError('No \'=\' detected');
|
|
85
|
-
// });
|
|
86
|
-
// it('trims whitespace from keys and values', () => {
|
|
87
|
-
// let manifest = new Map([['bs_const', ' key = true ']]);
|
|
88
|
-
// expect(getBsConst(manifest)).to.eql(new Map([['key', true]]));
|
|
89
|
-
// });
|
|
90
|
-
// it('rejects non-boolean values', () => {
|
|
91
|
-
// let manifest = new Map([['bs_const', 'string=word']]);
|
|
92
|
-
// expect(() => getBsConst(manifest)).to.throw;
|
|
93
|
-
// });
|
|
94
|
-
// it('allows case-insensitive booleans', () => {
|
|
95
|
-
// let manifest = new Map([['bs_const', 'foo=true;bar=FalSE']]);
|
|
96
|
-
// expect(getBsConst(manifest)).to.eql(
|
|
97
|
-
// new Map([
|
|
98
|
-
// ['foo', true],
|
|
99
|
-
// ['bar', false]
|
|
100
|
-
// ])
|
|
101
|
-
// );
|
|
102
|
-
// });
|
|
103
|
-
// });
|
|
104
|
-
// });
|
|
105
|
-
//# sourceMappingURL=Manifest.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Manifest.spec.js","sourceRoot":"","sources":["../../src/preprocessor/Manifest.spec.ts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AEd,8DAA8D;AAC9D,4EAA4E;AAC5E,6EAA6E;AAC7E,cAAc;AAEd,mDAAmD;AACnD,qEAAqE;AAErE,2DAA2D;AAC3D,cAAc;AAEd,yDAAyD;AACzD,4EAA4E;AAE5E,mDAAmD;AACnD,4BAA4B;AAC5B,qCAAqC;AACrC,qCAAqC;AACrC,qBAAqB;AACrB,iBAAiB;AACjB,cAAc;AACd,UAAU;AACV,MAAM"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { Token } from '../lexer';
|
|
2
|
-
import type * as CC from './Chunk';
|
|
3
|
-
import type { Diagnostic } from 'vscode-languageserver';
|
|
4
|
-
import type { Manifest } from './Manifest';
|
|
5
|
-
/**
|
|
6
|
-
* A simple pre-processor that executes BrightScript's conditional compilation directives by
|
|
7
|
-
* selecting chunks of tokens to be considered for later evaluation.
|
|
8
|
-
*/
|
|
9
|
-
export declare class Preprocessor implements CC.Visitor {
|
|
10
|
-
private constants;
|
|
11
|
-
/** The set of errors encountered when pre-processing conditional compilation directives. */
|
|
12
|
-
diagnostics: Diagnostic[];
|
|
13
|
-
processedTokens: Token[];
|
|
14
|
-
/**
|
|
15
|
-
* Filters the tokens contained within a set of chunks based on a set of constants.
|
|
16
|
-
* @param chunks the chunks from which to retrieve tokens
|
|
17
|
-
* @param bsConst the set of constants defined in a BrightScript `manifest` file's `bs_const` property
|
|
18
|
-
* @returns an object containing an array of `errors` and an array of `processedTokens` filtered by conditional
|
|
19
|
-
* compilation directives included within
|
|
20
|
-
*/
|
|
21
|
-
process(tokens: Token[], manifest: Manifest): this;
|
|
22
|
-
filter(chunks: ReadonlyArray<CC.Chunk>, bsConst?: Map<string, boolean>): this;
|
|
23
|
-
static process(tokens: Token[], manifest: Manifest): Preprocessor;
|
|
24
|
-
/**
|
|
25
|
-
* Emits an error via this processor's `events` property, then throws it.
|
|
26
|
-
* @param diagnostic the ParseError to emit then throw
|
|
27
|
-
*/
|
|
28
|
-
private addError;
|
|
29
|
-
/**
|
|
30
|
-
* Handles a simple chunk of BrightScript tokens by returning the tokens contained within.
|
|
31
|
-
* @param chunk the chunk to extract tokens from
|
|
32
|
-
* @returns the array of tokens contained within `chunk`
|
|
33
|
-
*/
|
|
34
|
-
visitBrightScript(chunk: CC.BrightScriptChunk): Token[];
|
|
35
|
-
/**
|
|
36
|
-
* Handles a BrightScript `#const` directive, creating a variable in-scope only for the
|
|
37
|
-
* conditional compilation pass.
|
|
38
|
-
* @param chunk the `#const` directive, including the name and variable to use for the constant
|
|
39
|
-
* @returns an empty array, since `#const` directives are always removed from the evaluated script.
|
|
40
|
-
*/
|
|
41
|
-
visitDeclaration(chunk: CC.DeclarationChunk): any[];
|
|
42
|
-
/**
|
|
43
|
-
* Throws an error, stopping "compilation" of the program.
|
|
44
|
-
* @param chunk the error to report to users
|
|
45
|
-
* @throws a JavaScript error with the provided message
|
|
46
|
-
*/
|
|
47
|
-
visitError(chunk: CC.ErrorChunk): never;
|
|
48
|
-
/**
|
|
49
|
-
* Produces tokens from a branch of a conditional-compilation `#if`, or no tokens if no branches evaluate to `true`.
|
|
50
|
-
* @param chunk the `#if` directive, any `#else if` or `#else` directives, and their associated BrightScript chunks.
|
|
51
|
-
* @returns an array of tokens to include in the final executed script.
|
|
52
|
-
*/
|
|
53
|
-
visitIf(chunk: CC.HashIfStatement): Token[];
|
|
54
|
-
/**
|
|
55
|
-
* Resolves a token to a JavaScript boolean value, or throws an error.
|
|
56
|
-
* @param token the token to resolve to either `true`, `false`, or an error
|
|
57
|
-
* @throws if attempting to reference an undefined `#const` or if `token` is neither `true`, `false`, nor an identifier.
|
|
58
|
-
*/
|
|
59
|
-
evaluateCondition(token: Token): boolean;
|
|
60
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Preprocessor = void 0;
|
|
4
|
-
const lexer_1 = require("../lexer");
|
|
5
|
-
const DiagnosticMessages_1 = require("../DiagnosticMessages");
|
|
6
|
-
const PreprocessorParser_1 = require("./PreprocessorParser");
|
|
7
|
-
const Manifest_1 = require("./Manifest");
|
|
8
|
-
/**
|
|
9
|
-
* A simple pre-processor that executes BrightScript's conditional compilation directives by
|
|
10
|
-
* selecting chunks of tokens to be considered for later evaluation.
|
|
11
|
-
*/
|
|
12
|
-
class Preprocessor {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.constants = new Map();
|
|
15
|
-
/** The set of errors encountered when pre-processing conditional compilation directives. */
|
|
16
|
-
this.diagnostics = [];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Filters the tokens contained within a set of chunks based on a set of constants.
|
|
20
|
-
* @param chunks the chunks from which to retrieve tokens
|
|
21
|
-
* @param bsConst the set of constants defined in a BrightScript `manifest` file's `bs_const` property
|
|
22
|
-
* @returns an object containing an array of `errors` and an array of `processedTokens` filtered by conditional
|
|
23
|
-
* compilation directives included within
|
|
24
|
-
*/
|
|
25
|
-
process(tokens, manifest) {
|
|
26
|
-
this.processedTokens = [];
|
|
27
|
-
let parser = PreprocessorParser_1.PreprocessorParser.parse(tokens);
|
|
28
|
-
//absorb the parser's diagnostic messages
|
|
29
|
-
this.diagnostics.push(...parser.diagnostics);
|
|
30
|
-
//if we found diagnostics, quit now
|
|
31
|
-
if (parser.diagnostics.length > 0) {
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
let bsConst = Manifest_1.getBsConst(manifest);
|
|
35
|
-
this.filter(parser.chunks, bsConst);
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
filter(chunks, bsConst) {
|
|
39
|
-
this.constants = new Map(bsConst);
|
|
40
|
-
this.processedTokens = chunks
|
|
41
|
-
.map(chunk => chunk.accept(this))
|
|
42
|
-
.reduce((allTokens, chunkTokens) => [
|
|
43
|
-
...allTokens,
|
|
44
|
-
...chunkTokens
|
|
45
|
-
], []);
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
static process(tokens, manifest) {
|
|
49
|
-
return new Preprocessor().process(tokens, manifest);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Emits an error via this processor's `events` property, then throws it.
|
|
53
|
-
* @param diagnostic the ParseError to emit then throw
|
|
54
|
-
*/
|
|
55
|
-
addError(diagnostic) {
|
|
56
|
-
this.diagnostics.push(diagnostic);
|
|
57
|
-
return diagnostic;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Handles a simple chunk of BrightScript tokens by returning the tokens contained within.
|
|
61
|
-
* @param chunk the chunk to extract tokens from
|
|
62
|
-
* @returns the array of tokens contained within `chunk`
|
|
63
|
-
*/
|
|
64
|
-
visitBrightScript(chunk) {
|
|
65
|
-
return chunk.tokens;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Handles a BrightScript `#const` directive, creating a variable in-scope only for the
|
|
69
|
-
* conditional compilation pass.
|
|
70
|
-
* @param chunk the `#const` directive, including the name and variable to use for the constant
|
|
71
|
-
* @returns an empty array, since `#const` directives are always removed from the evaluated script.
|
|
72
|
-
*/
|
|
73
|
-
visitDeclaration(chunk) {
|
|
74
|
-
if (this.constants.has(chunk.name.text)) {
|
|
75
|
-
this.addError(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.duplicateConstDeclaration(chunk.name.text)), { range: chunk.name.range }));
|
|
76
|
-
}
|
|
77
|
-
let value;
|
|
78
|
-
switch (chunk.value.kind) {
|
|
79
|
-
case lexer_1.TokenKind.True:
|
|
80
|
-
value = true;
|
|
81
|
-
break;
|
|
82
|
-
case lexer_1.TokenKind.False:
|
|
83
|
-
value = false;
|
|
84
|
-
break;
|
|
85
|
-
case lexer_1.TokenKind.Identifier:
|
|
86
|
-
if (this.constants.has(chunk.value.text)) {
|
|
87
|
-
value = this.constants.get(chunk.value.text);
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
this.addError(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.constAliasDoesNotExist(chunk.value.text)), { range: chunk.value.range }));
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
this.addError(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.invalidHashConstValue()), { range: chunk.value.range }));
|
|
94
|
-
}
|
|
95
|
-
this.constants.set(chunk.name.text, value);
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Throws an error, stopping "compilation" of the program.
|
|
100
|
-
* @param chunk the error to report to users
|
|
101
|
-
* @throws a JavaScript error with the provided message
|
|
102
|
-
*/
|
|
103
|
-
visitError(chunk) {
|
|
104
|
-
throw this.addError(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.hashError(chunk.message.text)), { range: chunk.range }));
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Produces tokens from a branch of a conditional-compilation `#if`, or no tokens if no branches evaluate to `true`.
|
|
108
|
-
* @param chunk the `#if` directive, any `#else if` or `#else` directives, and their associated BrightScript chunks.
|
|
109
|
-
* @returns an array of tokens to include in the final executed script.
|
|
110
|
-
*/
|
|
111
|
-
visitIf(chunk) {
|
|
112
|
-
if (this.evaluateCondition(chunk.condition)) {
|
|
113
|
-
return chunk.thenChunks
|
|
114
|
-
.map(chunk => chunk.accept(this))
|
|
115
|
-
.reduce((allTokens, chunkTokens) => [...allTokens, ...chunkTokens], []);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
for (const elseIf of chunk.elseIfs) {
|
|
119
|
-
if (this.evaluateCondition(elseIf.condition)) {
|
|
120
|
-
return elseIf.thenChunks
|
|
121
|
-
.map(chunk => chunk.accept(this))
|
|
122
|
-
.reduce((allTokens, chunkTokens) => [...allTokens, ...chunkTokens], []);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (chunk.elseChunks) {
|
|
127
|
-
return chunk.elseChunks
|
|
128
|
-
.map(chunk => chunk.accept(this))
|
|
129
|
-
.reduce((allTokens, chunkTokens) => [...allTokens, ...chunkTokens], []);
|
|
130
|
-
}
|
|
131
|
-
return [];
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Resolves a token to a JavaScript boolean value, or throws an error.
|
|
135
|
-
* @param token the token to resolve to either `true`, `false`, or an error
|
|
136
|
-
* @throws if attempting to reference an undefined `#const` or if `token` is neither `true`, `false`, nor an identifier.
|
|
137
|
-
*/
|
|
138
|
-
evaluateCondition(token) {
|
|
139
|
-
switch (token.kind) {
|
|
140
|
-
case lexer_1.TokenKind.True:
|
|
141
|
-
return true;
|
|
142
|
-
case lexer_1.TokenKind.False:
|
|
143
|
-
return false;
|
|
144
|
-
case lexer_1.TokenKind.Identifier:
|
|
145
|
-
if (this.constants.has(token.text)) {
|
|
146
|
-
return !!this.constants.get(token.text);
|
|
147
|
-
}
|
|
148
|
-
this.addError(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.referencedConstDoesNotExist()), { range: token.range }));
|
|
149
|
-
break;
|
|
150
|
-
default:
|
|
151
|
-
this.addError(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.invalidHashIfValue()), { range: token.range }));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
exports.Preprocessor = Preprocessor;
|
|
156
|
-
//# sourceMappingURL=Preprocessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Preprocessor.js","sourceRoot":"","sources":["../../src/preprocessor/Preprocessor.ts"],"names":[],"mappings":";;;AACA,oCAAqC;AAGrC,8DAA2D;AAC3D,6DAA0D;AAE1D,yCAAwC;AAExC;;;GAGG;AACH,MAAa,YAAY;IAAzB;QACY,cAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;QAE/C,4FAA4F;QACrF,gBAAW,GAAG,EAAkB,CAAC;IAmL5C,CAAC;IA/KG;;;;;;OAMG;IACI,OAAO,CAAC,MAAe,EAAE,QAAkB;QAC9C,IAAI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,CAAC,KAAY;QACjC,QAAQ,KAAK,CAAC,IAAI,EAAE;YAChB,KAAK,iBAAS,CAAC,IAAI;gBACf,OAAO,IAAI,CAAC;YAChB,KAAK,iBAAS,CAAC,KAAK;gBAChB,OAAO,KAAK,CAAC;YACjB,KAAK,iBAAS,CAAC,UAAU;gBACrB,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;oBAChC,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBAC3C;gBACD,IAAI,CAAC,QAAQ,iCACN,uCAAkB,CAAC,2BAA2B,EAAE,KACnD,KAAK,EAAE,KAAK,CAAC,KAAK,IACpB,CAAC;gBACH,MAAM;YACV;gBACI,IAAI,CAAC,QAAQ,iCACN,uCAAkB,CAAC,kBAAkB,EAAE,KAC1C,KAAK,EAAE,KAAK,CAAC,KAAK,IACpB,CAAC;SACV;IACL,CAAC;CACJ;AAvLD,oCAuLC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Parser_spec_1 = require("../parser/tests/Parser.spec");
|
|
4
|
-
const TokenKind_1 = require("../lexer/TokenKind");
|
|
5
|
-
const Preprocessor_1 = require("./Preprocessor");
|
|
6
|
-
const Chunk_1 = require("./Chunk");
|
|
7
|
-
const chai_1 = require("chai");
|
|
8
|
-
const sinon_1 = require("sinon");
|
|
9
|
-
let sinon = sinon_1.createSandbox();
|
|
10
|
-
describe('preprocessor', () => {
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
sinon.restore();
|
|
13
|
-
});
|
|
14
|
-
it('forwards brightscript chunk contents unmodified', () => {
|
|
15
|
-
let unprocessed = [
|
|
16
|
-
Parser_spec_1.identifier('foo'),
|
|
17
|
-
Parser_spec_1.token(TokenKind_1.TokenKind.LeftParen, '('),
|
|
18
|
-
Parser_spec_1.token(TokenKind_1.TokenKind.RightParen, ')'),
|
|
19
|
-
Parser_spec_1.token(TokenKind_1.TokenKind.Newline, '\n'),
|
|
20
|
-
Parser_spec_1.EOF
|
|
21
|
-
];
|
|
22
|
-
let { processedTokens } = new Preprocessor_1.Preprocessor().filter([new Chunk_1.BrightScriptChunk(unprocessed)]);
|
|
23
|
-
chai_1.expect(processedTokens).to.eql(unprocessed);
|
|
24
|
-
});
|
|
25
|
-
describe('#const', () => {
|
|
26
|
-
it('removes #const declarations from output', () => {
|
|
27
|
-
let { processedTokens } = new Preprocessor_1.Preprocessor().filter([
|
|
28
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('lorem'), Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false'))
|
|
29
|
-
]);
|
|
30
|
-
chai_1.expect(processedTokens).to.eql([]);
|
|
31
|
-
});
|
|
32
|
-
describe('values', () => {
|
|
33
|
-
it('allows `true`', () => {
|
|
34
|
-
chai_1.expect(() => new Preprocessor_1.Preprocessor().filter([
|
|
35
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('lorem'), Parser_spec_1.token(TokenKind_1.TokenKind.True, 'true'))
|
|
36
|
-
])).not.to.throw;
|
|
37
|
-
});
|
|
38
|
-
it('allows `false`', () => {
|
|
39
|
-
chai_1.expect(() => new Preprocessor_1.Preprocessor().filter([
|
|
40
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('ipsum'), Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false'))
|
|
41
|
-
])).not.to.throw;
|
|
42
|
-
});
|
|
43
|
-
it('allows identifiers', () => {
|
|
44
|
-
chai_1.expect(() => new Preprocessor_1.Preprocessor().filter([
|
|
45
|
-
// 'ipsum' must be defined before it's referenced
|
|
46
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('ipsum'), Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false')),
|
|
47
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('dolor'), Parser_spec_1.token(TokenKind_1.TokenKind.True, 'true'))
|
|
48
|
-
])).not.to.throw;
|
|
49
|
-
});
|
|
50
|
-
it('disallows strings', () => {
|
|
51
|
-
chai_1.expect(() => new Preprocessor_1.Preprocessor().filter([
|
|
52
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('sit'), Parser_spec_1.token(TokenKind_1.TokenKind.String, 'good boy!'))
|
|
53
|
-
])).to.throw; //('#const declarations can only have');
|
|
54
|
-
});
|
|
55
|
-
it('disallows re-declaration of values', () => {
|
|
56
|
-
chai_1.expect(() => new Preprocessor_1.Preprocessor().filter([
|
|
57
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('lorem'), Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false')),
|
|
58
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('lorem'), Parser_spec_1.token(TokenKind_1.TokenKind.True, 'true'))
|
|
59
|
-
])).to.throw;
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('#error', () => {
|
|
64
|
-
it('throws error when #error directives encountered', () => {
|
|
65
|
-
chai_1.expect(() => new Preprocessor_1.Preprocessor().filter([
|
|
66
|
-
new Chunk_1.ErrorChunk(Parser_spec_1.token(TokenKind_1.TokenKind.HashError, '#error'), Parser_spec_1.token(TokenKind_1.TokenKind.HashError, 'I\'m an error message!'))
|
|
67
|
-
])).to.throw;
|
|
68
|
-
});
|
|
69
|
-
it('doesn\'t throw when branched around', () => {
|
|
70
|
-
chai_1.expect(() => new Preprocessor_1.Preprocessor().filter([
|
|
71
|
-
new Chunk_1.HashIfStatement(Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false'), [
|
|
72
|
-
new Chunk_1.ErrorChunk(Parser_spec_1.token(TokenKind_1.TokenKind.HashError, '#error'), Parser_spec_1.token(TokenKind_1.TokenKind.HashError, 'I\'m an error message!'))
|
|
73
|
-
], [] // no else-ifs necessary
|
|
74
|
-
)
|
|
75
|
-
])).not.to.throw;
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
describe('#if', () => {
|
|
79
|
-
let elseChunk;
|
|
80
|
-
let elseIfChunk;
|
|
81
|
-
let ifChunk;
|
|
82
|
-
beforeEach(() => {
|
|
83
|
-
ifChunk = new Chunk_1.BrightScriptChunk([]);
|
|
84
|
-
elseIfChunk = new Chunk_1.BrightScriptChunk([]);
|
|
85
|
-
elseChunk = new Chunk_1.BrightScriptChunk([]);
|
|
86
|
-
sinon.spy(ifChunk, 'accept');
|
|
87
|
-
sinon.spy(elseIfChunk, 'accept');
|
|
88
|
-
sinon.spy(elseChunk, 'accept');
|
|
89
|
-
});
|
|
90
|
-
it('enters #if branch', () => {
|
|
91
|
-
new Preprocessor_1.Preprocessor().filter([
|
|
92
|
-
new Chunk_1.HashIfStatement(Parser_spec_1.token(TokenKind_1.TokenKind.True, 'true'), [ifChunk], [
|
|
93
|
-
{
|
|
94
|
-
condition: Parser_spec_1.token(TokenKind_1.TokenKind.True, 'true'),
|
|
95
|
-
thenChunks: [elseIfChunk]
|
|
96
|
-
}
|
|
97
|
-
], [elseChunk])
|
|
98
|
-
]);
|
|
99
|
-
chai_1.expect(ifChunk.accept.callCount).to.equal(1);
|
|
100
|
-
chai_1.expect(elseIfChunk.accept.callCount).to.equal(0);
|
|
101
|
-
chai_1.expect(elseChunk.accept.callCount).to.equal(0);
|
|
102
|
-
});
|
|
103
|
-
it('enters #else if branch', () => {
|
|
104
|
-
new Preprocessor_1.Preprocessor().filter([
|
|
105
|
-
new Chunk_1.HashIfStatement(Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false'), [ifChunk], [
|
|
106
|
-
{
|
|
107
|
-
condition: Parser_spec_1.token(TokenKind_1.TokenKind.True, 'true'),
|
|
108
|
-
thenChunks: [elseIfChunk]
|
|
109
|
-
}
|
|
110
|
-
], [elseChunk])
|
|
111
|
-
]);
|
|
112
|
-
chai_1.expect(ifChunk.accept.callCount).to.equal(0);
|
|
113
|
-
chai_1.expect(elseIfChunk.accept.callCount).to.equal(1);
|
|
114
|
-
chai_1.expect(elseChunk.accept.callCount).to.equal(0);
|
|
115
|
-
});
|
|
116
|
-
it('enters #else branch', () => {
|
|
117
|
-
new Preprocessor_1.Preprocessor().filter([
|
|
118
|
-
new Chunk_1.HashIfStatement(Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false'), [ifChunk], [
|
|
119
|
-
{
|
|
120
|
-
condition: Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false'),
|
|
121
|
-
thenChunks: [elseIfChunk]
|
|
122
|
-
}
|
|
123
|
-
], [elseChunk])
|
|
124
|
-
]);
|
|
125
|
-
chai_1.expect(ifChunk.accept.callCount).to.equal(0);
|
|
126
|
-
chai_1.expect(elseIfChunk.accept.callCount).to.equal(0);
|
|
127
|
-
chai_1.expect(elseChunk.accept.callCount).to.equal(1);
|
|
128
|
-
});
|
|
129
|
-
it('enters no branches if none pass', () => {
|
|
130
|
-
new Preprocessor_1.Preprocessor().filter([
|
|
131
|
-
new Chunk_1.HashIfStatement(Parser_spec_1.token(TokenKind_1.TokenKind.False, 'false'), [ifChunk], [] // no else-if chunks
|
|
132
|
-
// NOTE: no 'else" chunk!
|
|
133
|
-
)
|
|
134
|
-
]);
|
|
135
|
-
chai_1.expect(ifChunk.accept.callCount).to.equal(0);
|
|
136
|
-
chai_1.expect(elseIfChunk.accept.callCount).to.equal(0);
|
|
137
|
-
chai_1.expect(elseChunk.accept.callCount).to.equal(0);
|
|
138
|
-
});
|
|
139
|
-
it('uses #const values to determine truth', () => {
|
|
140
|
-
new Preprocessor_1.Preprocessor().filter([
|
|
141
|
-
new Chunk_1.DeclarationChunk(Parser_spec_1.identifier('lorem'), Parser_spec_1.token(TokenKind_1.TokenKind.True, 'true')),
|
|
142
|
-
new Chunk_1.HashIfStatement(Parser_spec_1.identifier('lorem'), [ifChunk], [] // no else-if chunks
|
|
143
|
-
// NOTE: no 'else" chunk!
|
|
144
|
-
)
|
|
145
|
-
]);
|
|
146
|
-
chai_1.expect(ifChunk.accept.callCount).to.equal(1);
|
|
147
|
-
chai_1.expect(elseIfChunk.accept.callCount).to.equal(0);
|
|
148
|
-
chai_1.expect(elseChunk.accept.callCount).to.equal(0);
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
//# sourceMappingURL=Preprocessor.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Preprocessor.spec.js","sourceRoot":"","sources":["../../src/preprocessor/Preprocessor.spec.ts"],"names":[],"mappings":";;AAAA,6DAAqE;AACrE,kDAA+C;AAC/C,iDAA8C;AAC9C,mCAA2F;AAC3F,+BAA8B;AAC9B,iCAAsC;AACtC,IAAI,KAAK,GAAG,qBAAa,EAAE,CAAC;AAE5B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,SAAS,CAAC,GAAG,EAAE;QACX,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACvD,IAAI,WAAW,GAAG;YACd,wBAAU,CAAC,KAAK,CAAC;YACjB,mBAAK,CAAC,qBAAS,CAAC,SAAS,EAAE,GAAG,CAAC;YAC/B,mBAAK,CAAC,qBAAS,CAAC,UAAU,EAAE,GAAG,CAAC;YAChC,mBAAK,CAAC,qBAAS,CAAC,OAAO,EAAE,IAAI,CAAC;YAC9B,iBAAG;SACN,CAAC;QAEF,IAAI,EAAE,eAAe,EAAE,GAAG,IAAI,2BAAY,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,yBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC1F,aAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,EA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AW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjD,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC7C,IAAI,2BAAY,EAAE,CAAC,MAAM,CAAC;gBACtB,IAAI,wBAAgB,CAChB,wBAAU,CAAC,OAAO,CAAC,EACnB,mBAAK,CAAC,qBAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAChC;gBACD,IAAI,uBAAe,CACf,wBAAU,CAAC,OAAO,CAAC,EACnB,CAAC,OAAO,CAAC,EACT,EAAE,CAAC,oBAAoB;gBACvB,yBAAyB;iBAC5B;aACJ,CAAC,CAAC;YAEH,aAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC7C,aAAM,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjD,aAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { Token } from '../lexer/Token';
|
|
2
|
-
import * as CC from './Chunk';
|
|
3
|
-
import type { Diagnostic } from 'vscode-languageserver';
|
|
4
|
-
/** * Parses `Tokens` into chunks of tokens, excluding conditional compilation directives. */
|
|
5
|
-
export declare class PreprocessorParser {
|
|
6
|
-
diagnostics: Diagnostic[];
|
|
7
|
-
tokens: Token[];
|
|
8
|
-
private current;
|
|
9
|
-
/**
|
|
10
|
-
* an array of chunks (conditional compilation directives and the associated BrightScript)
|
|
11
|
-
*/
|
|
12
|
-
chunks: CC.Chunk[];
|
|
13
|
-
/**
|
|
14
|
-
* Parses an array of tokens into an array of "chunks" - conditional compilation directives and their
|
|
15
|
-
* associated BrightScript.
|
|
16
|
-
*
|
|
17
|
-
* @param toParse the array of tokens to parse
|
|
18
|
-
*/
|
|
19
|
-
parse(tokens: Token[]): this;
|
|
20
|
-
static parse(tokens: Token[]): PreprocessorParser;
|
|
21
|
-
/**
|
|
22
|
-
* Parses tokens to produce an array containing a variable number of heterogeneous chunks.
|
|
23
|
-
* @returns a heterogeneous array of chunks
|
|
24
|
-
*/
|
|
25
|
-
private nChunks;
|
|
26
|
-
/**
|
|
27
|
-
* Parses tokens to produce a "declaration" chunk if possible, otherwise falls back to `hashIf`.
|
|
28
|
-
* @returns a "declaration" chunk if one is detected, otherwise whatever `hashIf` returns
|
|
29
|
-
*/
|
|
30
|
-
private hashConst;
|
|
31
|
-
/**
|
|
32
|
-
* Parses tokens to produce an "if" chunk (including "else if" and "else" chunks) if possible,
|
|
33
|
-
* otherwise falls back to `hashError`.
|
|
34
|
-
* @returns an "if" chunk if one is detected, otherwise whatever `hashError` returns
|
|
35
|
-
*/
|
|
36
|
-
private hashIf;
|
|
37
|
-
/**
|
|
38
|
-
* Parses tokens to produce an "error" chunk (including the associated message) if possible,
|
|
39
|
-
* otherwise falls back to a chunk of plain BrightScript.
|
|
40
|
-
* @returns an "error" chunk if one is detected, otherwise whatever `brightScriptChunk` returns
|
|
41
|
-
*/
|
|
42
|
-
private hashError;
|
|
43
|
-
/**
|
|
44
|
-
* Parses tokens to produce a chunk of BrightScript.
|
|
45
|
-
* @returns a chunk of plain BrightScript if any is detected, otherwise `undefined` to indicate
|
|
46
|
-
* that no non-conditional compilation directives were found.
|
|
47
|
-
*/
|
|
48
|
-
private brightScriptChunk;
|
|
49
|
-
private eof;
|
|
50
|
-
/**
|
|
51
|
-
* If the next token is any of the provided tokenKinds, advance and return true.
|
|
52
|
-
* Otherwise return false
|
|
53
|
-
*/
|
|
54
|
-
private match;
|
|
55
|
-
private consume;
|
|
56
|
-
private advance;
|
|
57
|
-
private check;
|
|
58
|
-
private isAtEnd;
|
|
59
|
-
private peek;
|
|
60
|
-
private previous;
|
|
61
|
-
}
|