brighterscript 1.0.0-alpha.5 → 1.0.0-alpha.50
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 +76 -138
- package/bsconfig.schema.json +121 -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 +72 -39
- 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 +12 -4
- package/dist/CodeActionUtil.js +22 -5
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +7 -6
- package/dist/CommentFlagProcessor.js +11 -8
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/CrossScopeValidator.d.ts +68 -0
- package/dist/CrossScopeValidator.js +642 -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 +82 -0
- package/dist/DiagnosticManager.js +406 -0
- package/dist/DiagnosticManager.js.map +1 -0
- package/dist/DiagnosticMessages.d.ts +558 -196
- package/dist/DiagnosticMessages.js +870 -340
- 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 +100 -105
- package/dist/LanguageServer.js +444 -745
- 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 +241 -98
- package/dist/Program.js +1432 -717
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +47 -23
- package/dist/ProgramBuilder.js +224 -178
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +149 -109
- package/dist/Scope.js +557 -550
- package/dist/Scope.js.map +1 -1
- 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 +136 -24
- package/dist/SymbolTable.js +565 -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 +334 -0
- package/dist/astUtils/CachedLookups.js.map +1 -0
- package/dist/astUtils/CachedLookups.spec.js +39 -0
- package/dist/astUtils/CachedLookups.spec.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 +54 -19
- package/dist/astUtils/creators.js +242 -42
- 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 +196 -85
- package/dist/astUtils/reflection.js +497 -144
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +267 -167
- 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 +116 -53
- package/dist/astUtils/visitors.js +95 -15
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +629 -51
- package/dist/astUtils/visitors.spec.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 +24 -4
- package/dist/bscPlugin/BscPlugin.js +88 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
- package/dist/bscPlugin/CallExpressionInfo.js +143 -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 +6 -5
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +173 -27
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +138 -21
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- 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/completions/CompletionsProcessor.spec.js +2512 -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 +212 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js +87 -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 +230 -0
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +991 -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 +57 -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 +164 -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 +564 -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 +33 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.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 +75 -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 +141 -0
- package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +27 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +418 -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 +75 -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/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 +37 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +638 -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 +1517 -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 +141 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +1323 -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 +6135 -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 +36 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
- package/dist/cli.js +126 -27
- 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/common/Sequencer.spec.d.ts +1 -0
- package/dist/common/Sequencer.spec.js +75 -0
- package/dist/common/Sequencer.spec.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 +10 -3
- package/dist/diagnosticUtils.js +64 -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.Class.spec.js +1213 -259
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +145 -87
- package/dist/files/BrsFile.js +836 -934
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +4226 -902
- package/dist/files/BrsFile.spec.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/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 +80 -41
- package/dist/files/XmlFile.js +161 -137
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +444 -336
- 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 +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 +942 -125
- package/dist/interfaces.js +21 -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 +51 -12
- package/dist/lexer/Lexer.js +215 -65
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +812 -568
- package/dist/lexer/Lexer.spec.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 +40 -2
- package/dist/lexer/TokenKind.js +147 -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/ActionQueue.spec.d.ts +1 -0
- package/dist/lsp/ActionQueue.spec.js +80 -0
- package/dist/lsp/ActionQueue.spec.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/DocumentManager.spec.d.ts +1 -0
- package/dist/lsp/DocumentManager.spec.js +103 -0
- package/dist/lsp/DocumentManager.spec.js.map +1 -0
- package/dist/lsp/LspProject.d.ts +239 -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/PathFilterer.spec.d.ts +1 -0
- package/dist/lsp/PathFilterer.spec.js +182 -0
- package/dist/lsp/PathFilterer.spec.js.map +1 -0
- package/dist/lsp/Project.d.ts +168 -0
- package/dist/lsp/Project.js +437 -0
- package/dist/lsp/Project.js.map +1 -0
- package/dist/lsp/Project.spec.d.ts +1 -0
- package/dist/lsp/Project.spec.js +267 -0
- package/dist/lsp/Project.spec.js.map +1 -0
- package/dist/lsp/ProjectManager.d.ts +242 -0
- package/dist/lsp/ProjectManager.js +824 -0
- package/dist/lsp/ProjectManager.js.map +1 -0
- package/dist/lsp/ProjectManager.spec.d.ts +1 -0
- package/dist/lsp/ProjectManager.spec.js +913 -0
- package/dist/lsp/ProjectManager.spec.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/MessageHandler.spec.d.ts +1 -0
- package/dist/lsp/worker/MessageHandler.spec.js +64 -0
- package/dist/lsp/worker/MessageHandler.spec.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/WorkerPool.spec.d.ts +1 -0
- package/dist/lsp/worker/WorkerPool.spec.js +59 -0
- package/dist/lsp/worker/WorkerPool.spec.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.d.ts +143 -0
- package/dist/lsp/worker/WorkerThreadProject.js +189 -0
- package/dist/lsp/worker/WorkerThreadProject.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.d.ts +2 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.js +71 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.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.d.ts +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 +203 -0
- package/dist/parser/AstNode.js +303 -0
- package/dist/parser/AstNode.js.map +1 -0
- package/dist/parser/AstNode.spec.d.ts +1 -0
- package/dist/parser/AstNode.spec.js +1455 -0
- package/dist/parser/AstNode.spec.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/BrightScriptDocParser.spec.d.ts +1 -0
- package/dist/parser/BrightScriptDocParser.spec.js +310 -0
- package/dist/parser/BrightScriptDocParser.spec.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 +553 -221
- package/dist/parser/Expression.js +1414 -505
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Expression.spec.d.ts +1 -0
- package/dist/parser/Expression.spec.js +40 -0
- package/dist/parser/Expression.spec.js.map +1 -0
- package/dist/parser/Parser.Class.spec.js +255 -125
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +117 -124
- package/dist/parser/Parser.js +1669 -982
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.d.ts +3 -1
- package/dist/parser/Parser.spec.js +2111 -525
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +29 -13
- package/dist/parser/SGParser.js +85 -56
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +30 -45
- package/dist/parser/SGParser.spec.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 +849 -267
- package/dist/parser/Statement.js +2412 -625
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +133 -36
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +26 -12
- package/dist/parser/TranspileState.js +115 -24
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/parser/tests/Parser.spec.d.ts +3 -9
- package/dist/parser/tests/Parser.spec.js +7 -13
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +83 -75
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +85 -51
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js +382 -239
- package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +52 -45
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Additive.spec.js +51 -43
- package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +192 -142
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +236 -160
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/Boolean.spec.js +41 -34
- package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +173 -55
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/Exponential.spec.js +20 -20
- package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
- package/dist/parser/tests/expression/Function.spec.js +291 -282
- package/dist/parser/tests/expression/Function.spec.js.map +1 -1
- package/dist/parser/tests/expression/Indexing.spec.js +193 -110
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +42 -42
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +260 -115
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +58 -52
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
- package/dist/parser/tests/expression/Primary.spec.js +76 -60
- 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 +50 -50
- 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 +281 -94
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +747 -192
- 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 +44 -44
- 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 +500 -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 +61 -55
- package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
- package/dist/parser/tests/statement/Dim.spec.js +29 -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 +744 -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 +226 -215
- 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 +64 -61
- 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 +110 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/LibraryStatement.spec.js +22 -22
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +127 -168
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +133 -114
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +57 -54
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +131 -117
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/parser/tests/statement/Stop.spec.js +14 -13
- package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
- package/dist/parser/tests/statement/Throw.spec.js +11 -8
- 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 +20347 -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 +89 -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 +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/BooleanType.spec.js +10 -4
- package/dist/types/BooleanType.spec.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/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/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 +60 -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 +22 -0
- package/dist/types/ComponentType.js +107 -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/DoubleType.spec.js +12 -4
- package/dist/types/DoubleType.spec.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/DynamicType.spec.js +16 -5
- package/dist/types/DynamicType.spec.js.map +1 -1
- package/dist/types/EnumType.d.ts +42 -0
- package/dist/types/EnumType.js +98 -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 +21 -17
- 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 +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/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 +30 -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/IntersectionType.d.ts +29 -0
- package/dist/types/IntersectionType.js +253 -0
- package/dist/types/IntersectionType.js.map +1 -0
- package/dist/types/IntersectionType.spec.d.ts +1 -0
- package/dist/types/IntersectionType.spec.js +150 -0
- package/dist/types/IntersectionType.spec.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/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 +21 -17
- 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 +12 -5
- package/dist/types/ObjectType.js +25 -8
- 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 +123 -0
- package/dist/types/ReferenceType.js +720 -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 +12 -5
- package/dist/types/StringType.js +23 -8
- 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/TypeStatementType.d.ts +18 -0
- package/dist/types/TypeStatementType.js +45 -0
- package/dist/types/TypeStatementType.js.map +1 -0
- package/dist/types/TypedFunctionType.d.ts +34 -0
- package/dist/types/TypedFunctionType.js +147 -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 +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 +193 -0
- package/dist/types/UnionType.js.map +1 -0
- package/dist/types/UnionType.spec.d.ts +1 -0
- package/dist/types/UnionType.spec.js +205 -0
- package/dist/types/UnionType.spec.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/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 +174 -0
- package/dist/types/helper.spec.js.map +1 -0
- package/dist/types/helpers.d.ts +51 -0
- package/dist/types/helpers.js +323 -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/types/roFunctionType.spec.d.ts +1 -0
- package/dist/types/roFunctionType.spec.js +20 -0
- package/dist/types/roFunctionType.spec.js.map +1 -0
- package/dist/util.d.ts +288 -187
- package/dist/util.js +2018 -575
- 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 +185 -138
- package/CHANGELOG.md +0 -1188
- 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/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.js +0 -45
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.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/SGTypes.spec.js +0 -351
- package/dist/parser/SGTypes.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/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/{bscPlugin/semanticTokens/SemanticTokensProcessor.spec.d.ts → astUtils/CachedLookups.spec.d.ts} +0 -0
- /package/dist/{parser/SGTypes.spec.d.ts → astUtils/Editor.spec.d.ts} +0 -0
- /package/dist/{preprocessor/Preprocessor.spec.d.ts → bscPlugin/completions/CompletionsProcessor.spec.d.ts} +0 -0
- /package/dist/{preprocessor/PreprocessorParser.spec.d.ts → bscPlugin/definition/DefinitionProvider.spec.d.ts} +0 -0
- /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/hover/HoverProcessor.spec.d.ts} +0 -0
package/dist/parser/SGTypes.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SGAst = exports.SGComponent = exports.SGInterface = exports.SGInterfaceFunction = exports.SGFieldTypes = exports.SGInterfaceField = exports.SGScript = exports.SGChildren = exports.SGNode = exports.SGProlog = exports.
|
|
3
|
+
exports.SGAst = exports.SGComponent = exports.SGInterface = exports.SGInterfaceFunction = exports.SGFieldTypes = exports.SGFieldType = exports.SGInterfaceField = exports.SGScript = exports.SGCustomization = exports.SGChildren = exports.SGNode = exports.SGProlog = exports.SGElement = exports.SGAttribute = void 0;
|
|
4
4
|
const source_map_1 = require("source-map");
|
|
5
|
-
const astUtils_1 = require("../astUtils");
|
|
6
5
|
const creators_1 = require("../astUtils/creators");
|
|
7
6
|
const util_1 = require("../util");
|
|
8
7
|
class SGAttribute {
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this._location = null;
|
|
10
|
+
this.tokens = {
|
|
11
|
+
key: options.key,
|
|
12
|
+
equals: options.equals,
|
|
13
|
+
openingQuote: options.openingQuote,
|
|
14
|
+
value: options.value,
|
|
15
|
+
closingQuote: options.closingQuote
|
|
16
|
+
};
|
|
17
17
|
}
|
|
18
18
|
get key() {
|
|
19
19
|
return this.tokens.key.text;
|
|
@@ -39,11 +39,11 @@ class SGAttribute {
|
|
|
39
39
|
this.tokens.value = { text: val };
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
get
|
|
43
|
-
if (!this.
|
|
44
|
-
this.
|
|
42
|
+
get location() {
|
|
43
|
+
if (!this._location) {
|
|
44
|
+
this._location = util_1.default.createBoundingLocation(this.tokens.key, this.tokens.equals, this.tokens.openingQuote, this.tokens.value, this.tokens.closingQuote);
|
|
45
45
|
}
|
|
46
|
-
return this.
|
|
46
|
+
return this._location;
|
|
47
47
|
}
|
|
48
48
|
transpile(state) {
|
|
49
49
|
const result = [
|
|
@@ -52,13 +52,16 @@ class SGAttribute {
|
|
|
52
52
|
if (this.tokens.value) {
|
|
53
53
|
result.push(state.transpileToken(this.tokens.equals, '='), state.transpileToken(this.tokens.openingQuote, '"'), state.transpileToken(this.tokens.value), state.transpileToken(this.tokens.closingQuote, '"'));
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return util_1.default.sourceNodeFromTranspileResult(null, null, null, result);
|
|
56
|
+
}
|
|
57
|
+
clone() {
|
|
58
|
+
return new SGAttribute(this.tokens);
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
exports.SGAttribute = SGAttribute;
|
|
59
|
-
class
|
|
60
|
-
constructor(
|
|
61
|
-
|
|
62
|
+
class SGElement {
|
|
63
|
+
constructor(options) {
|
|
64
|
+
var _a, _b;
|
|
62
65
|
/**
|
|
63
66
|
* Array of attributes found on this tag
|
|
64
67
|
*/
|
|
@@ -66,29 +69,32 @@ class SGTag {
|
|
|
66
69
|
/**
|
|
67
70
|
* The array of direct children AST elements of this AST node
|
|
68
71
|
*/
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.tokens
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
this.elements = [];
|
|
73
|
+
this._location = null;
|
|
74
|
+
this.tokens = {
|
|
75
|
+
startTagOpen: options.startTagOpen,
|
|
76
|
+
startTagName: options.startTagName,
|
|
77
|
+
startTagClose: options.startTagClose,
|
|
78
|
+
endTagOpen: options.endTagOpen,
|
|
79
|
+
endTagName: options.endTagName,
|
|
80
|
+
endTagClose: options.endTagClose
|
|
81
|
+
};
|
|
82
|
+
this.attributes = (_a = options.attributes) !== null && _a !== void 0 ? _a : [];
|
|
83
|
+
this.elements = (_b = options.elements) !== null && _b !== void 0 ? _b : [];
|
|
84
|
+
}
|
|
85
|
+
get location() {
|
|
81
86
|
var _a, _b, _c, _d;
|
|
82
|
-
if (!this.
|
|
83
|
-
this.
|
|
87
|
+
if (!this._location) {
|
|
88
|
+
this._location = util_1.default.createBoundingLocation(this.tokens.startTagOpen, this.tokens.startTagName, (_a = this.attributes) === null || _a === void 0 ? void 0 : _a[((_b = this.attributes) === null || _b === void 0 ? void 0 : _b.length) - 1], this.tokens.startTagClose, (_c = this.elements) === null || _c === void 0 ? void 0 : _c[((_d = this.elements) === null || _d === void 0 ? void 0 : _d.length) - 1], this.tokens.endTagOpen, this.tokens.endTagName, this.tokens.endTagClose);
|
|
84
89
|
}
|
|
85
|
-
return this.
|
|
90
|
+
return this._location;
|
|
86
91
|
}
|
|
87
92
|
/**
|
|
88
93
|
* Is this a self-closing tag?
|
|
89
94
|
*/
|
|
90
95
|
get isSelfClosing() {
|
|
91
|
-
|
|
96
|
+
var _a;
|
|
97
|
+
return this.tokens.startTagClose && ((_a = this.tokens.startTagClose) === null || _a === void 0 ? void 0 : _a.text) !== '>';
|
|
92
98
|
}
|
|
93
99
|
get id() {
|
|
94
100
|
return this.getAttributeValue('id');
|
|
@@ -97,7 +103,7 @@ class SGTag {
|
|
|
97
103
|
this.setAttributeValue('id', value);
|
|
98
104
|
}
|
|
99
105
|
/**
|
|
100
|
-
* Get the
|
|
106
|
+
* Get the name of this tag.
|
|
101
107
|
*/
|
|
102
108
|
get tagName() {
|
|
103
109
|
var _a;
|
|
@@ -108,10 +114,10 @@ class SGTag {
|
|
|
108
114
|
* This does not step into children's children.
|
|
109
115
|
*
|
|
110
116
|
*/
|
|
111
|
-
|
|
117
|
+
getElementsByTagName(tagName) {
|
|
112
118
|
const result = [];
|
|
113
119
|
const lowerTagName = tagName.toLowerCase();
|
|
114
|
-
for (const el of this.
|
|
120
|
+
for (const el of this.elements) {
|
|
115
121
|
if (el.tokens.startTagName.text.toLowerCase() === lowerTagName) {
|
|
116
122
|
result.push(el);
|
|
117
123
|
}
|
|
@@ -122,7 +128,7 @@ class SGTag {
|
|
|
122
128
|
* Add a child to the end of the children array
|
|
123
129
|
*/
|
|
124
130
|
addChild(tag) {
|
|
125
|
-
this.
|
|
131
|
+
this.elements.push(tag);
|
|
126
132
|
return tag;
|
|
127
133
|
}
|
|
128
134
|
/**
|
|
@@ -130,9 +136,9 @@ class SGTag {
|
|
|
130
136
|
* @returns true if node was found and removed, false if the node wasn't there and thus nothing was done
|
|
131
137
|
*/
|
|
132
138
|
removeChild(tag) {
|
|
133
|
-
const idx = this.
|
|
139
|
+
const idx = this.elements.indexOf(tag);
|
|
134
140
|
if (idx > -1) {
|
|
135
|
-
this.
|
|
141
|
+
this.elements.splice(idx, 1);
|
|
136
142
|
return true;
|
|
137
143
|
}
|
|
138
144
|
return false;
|
|
@@ -144,7 +150,7 @@ class SGTag {
|
|
|
144
150
|
return !!this.getAttribute(name);
|
|
145
151
|
}
|
|
146
152
|
/**
|
|
147
|
-
* Get an SGAttribute by its name
|
|
153
|
+
* Get an SGAttribute by its name (case INsensitive)
|
|
148
154
|
*/
|
|
149
155
|
getAttribute(name) {
|
|
150
156
|
var _a;
|
|
@@ -166,16 +172,21 @@ class SGTag {
|
|
|
166
172
|
* Set an attribute value by its name. If no attribute exists with this name, it is created
|
|
167
173
|
*/
|
|
168
174
|
setAttributeValue(name, value) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this.
|
|
175
|
+
if (value === undefined) {
|
|
176
|
+
this.removeAttribute(name);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
let attr = this.getAttribute(name);
|
|
180
|
+
//create an attribute with this name if we don't have one yet
|
|
181
|
+
if (!attr) {
|
|
182
|
+
attr = (0, creators_1.createSGAttribute)(name, value);
|
|
183
|
+
this.attributes.push(attr);
|
|
184
|
+
}
|
|
185
|
+
attr.value = value;
|
|
174
186
|
}
|
|
175
|
-
attr.value = value;
|
|
176
187
|
}
|
|
177
188
|
/**
|
|
178
|
-
* Remove an attribute by its name
|
|
189
|
+
* Remove an attribute by its name. DO NOT USE this to edit AST (use ASTEditor)
|
|
179
190
|
* @returns true if an attribute was found and removed. False if no attribute was found
|
|
180
191
|
*/
|
|
181
192
|
removeAttribute(name) {
|
|
@@ -190,7 +201,7 @@ class SGTag {
|
|
|
190
201
|
return false;
|
|
191
202
|
}
|
|
192
203
|
transpile(state) {
|
|
193
|
-
return
|
|
204
|
+
return util_1.default.sourceNodeFromTranspileResult(null, null, null, [
|
|
194
205
|
state.transpileToken(this.tokens.startTagOpen, '<'),
|
|
195
206
|
state.transpileToken(this.tokens.startTagName),
|
|
196
207
|
this.transpileAttributes(state, this.attributes),
|
|
@@ -199,25 +210,28 @@ class SGTag {
|
|
|
199
210
|
}
|
|
200
211
|
transpileBody(state) {
|
|
201
212
|
var _a;
|
|
202
|
-
if (this.isSelfClosing) {
|
|
203
|
-
return
|
|
213
|
+
if (this.isSelfClosing && this.elements.length === 0) {
|
|
214
|
+
return util_1.default.sourceNodeFromTranspileResult(null, null, null, [
|
|
204
215
|
' ',
|
|
205
216
|
state.transpileToken(this.tokens.startTagClose, '/>'),
|
|
206
217
|
state.newline
|
|
207
218
|
]);
|
|
208
219
|
}
|
|
209
220
|
else {
|
|
221
|
+
// it is possible that the original tag isSelfClosing, but new elements have been added to it
|
|
222
|
+
// in that case, create a new startTagClose token for transpilation.
|
|
223
|
+
const startTagClose = this.isSelfClosing ? (0, creators_1.createSGToken)('>', this.tokens.startTagClose.location) : this.tokens.startTagClose;
|
|
210
224
|
const chunks = [
|
|
211
|
-
state.transpileToken(
|
|
225
|
+
state.transpileToken(startTagClose, '>'),
|
|
212
226
|
state.newline
|
|
213
227
|
];
|
|
214
228
|
state.blockDepth++;
|
|
215
|
-
for (const child of this.
|
|
229
|
+
for (const child of this.elements) {
|
|
216
230
|
chunks.push(state.indentText, child.transpile(state));
|
|
217
231
|
}
|
|
218
232
|
state.blockDepth--;
|
|
219
233
|
chunks.push(state.indentText, state.transpileToken(this.tokens.endTagOpen, '</'), state.transpileToken((_a = this.tokens.endTagName) !== null && _a !== void 0 ? _a : this.tokens.startTagName), state.transpileToken(this.tokens.endTagClose, '>'), state.newline);
|
|
220
|
-
return
|
|
234
|
+
return util_1.default.sourceNodeFromTranspileResult(null, null, null, chunks);
|
|
221
235
|
}
|
|
222
236
|
}
|
|
223
237
|
transpileAttributes(state, attributes) {
|
|
@@ -228,17 +242,20 @@ class SGTag {
|
|
|
228
242
|
return new source_map_1.SourceNode(null, null, null, chunks);
|
|
229
243
|
}
|
|
230
244
|
}
|
|
231
|
-
exports.
|
|
232
|
-
class SGProlog extends
|
|
245
|
+
exports.SGElement = SGElement;
|
|
246
|
+
class SGProlog extends SGElement {
|
|
233
247
|
}
|
|
234
248
|
exports.SGProlog = SGProlog;
|
|
235
|
-
class SGNode extends
|
|
249
|
+
class SGNode extends SGElement {
|
|
236
250
|
}
|
|
237
251
|
exports.SGNode = SGNode;
|
|
238
|
-
class SGChildren extends
|
|
252
|
+
class SGChildren extends SGElement {
|
|
239
253
|
}
|
|
240
254
|
exports.SGChildren = SGChildren;
|
|
241
|
-
class
|
|
255
|
+
class SGCustomization extends SGElement {
|
|
256
|
+
}
|
|
257
|
+
exports.SGCustomization = SGCustomization;
|
|
258
|
+
class SGScript extends SGElement {
|
|
242
259
|
get type() {
|
|
243
260
|
return this.getAttributeValue('type');
|
|
244
261
|
}
|
|
@@ -253,7 +270,7 @@ class SGScript extends SGTag {
|
|
|
253
270
|
}
|
|
254
271
|
transpileBody(state) {
|
|
255
272
|
if (this.cdata) {
|
|
256
|
-
return
|
|
273
|
+
return util_1.default.sourceNodeFromTranspileResult(null, null, null, [
|
|
257
274
|
'>',
|
|
258
275
|
state.transpileToken(this.cdata),
|
|
259
276
|
'</',
|
|
@@ -274,12 +291,14 @@ class SGScript extends SGTag {
|
|
|
274
291
|
for (const attr of attributes) {
|
|
275
292
|
const lowerKey = (_a = attr.tokens.key) === null || _a === void 0 ? void 0 : _a.text.toLowerCase();
|
|
276
293
|
if (lowerKey === 'uri' && bsExtensionRegexp.exec((_b = attr.tokens.value) === null || _b === void 0 ? void 0 : _b.text)) {
|
|
277
|
-
|
|
294
|
+
const clone = attr.clone();
|
|
295
|
+
clone.tokens.value.text.replace(bsExtensionRegexp, '.brs');
|
|
296
|
+
modifiedAttributes.push(clone);
|
|
278
297
|
}
|
|
279
298
|
else if (lowerKey === 'type') {
|
|
280
299
|
foundType = true;
|
|
281
300
|
if ((_c = attr.tokens.value) === null || _c === void 0 ? void 0 : _c.text.toLowerCase().endsWith('brighterscript')) {
|
|
282
|
-
modifiedAttributes.push(
|
|
301
|
+
modifiedAttributes.push(attr.clone());
|
|
283
302
|
}
|
|
284
303
|
else {
|
|
285
304
|
modifiedAttributes.push(attr);
|
|
@@ -290,13 +309,13 @@ class SGScript extends SGTag {
|
|
|
290
309
|
}
|
|
291
310
|
}
|
|
292
311
|
if (!foundType) {
|
|
293
|
-
modifiedAttributes.push(creators_1.createSGAttribute('type', 'text/brightscript'));
|
|
312
|
+
modifiedAttributes.push((0, creators_1.createSGAttribute)('type', 'text/brightscript'));
|
|
294
313
|
}
|
|
295
314
|
return super.transpileAttributes(state, modifiedAttributes);
|
|
296
315
|
}
|
|
297
316
|
}
|
|
298
317
|
exports.SGScript = SGScript;
|
|
299
|
-
class SGInterfaceField extends
|
|
318
|
+
class SGInterfaceField extends SGElement {
|
|
300
319
|
get type() {
|
|
301
320
|
return this.getAttributeValue('type');
|
|
302
321
|
}
|
|
@@ -329,13 +348,37 @@ class SGInterfaceField extends SGTag {
|
|
|
329
348
|
}
|
|
330
349
|
}
|
|
331
350
|
exports.SGInterfaceField = SGInterfaceField;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
];
|
|
338
|
-
|
|
351
|
+
var SGFieldType;
|
|
352
|
+
(function (SGFieldType) {
|
|
353
|
+
SGFieldType["integer"] = "integer";
|
|
354
|
+
SGFieldType["int"] = "int";
|
|
355
|
+
SGFieldType["longinteger"] = "longinteger";
|
|
356
|
+
SGFieldType["float"] = "float";
|
|
357
|
+
SGFieldType["string"] = "string";
|
|
358
|
+
SGFieldType["str"] = "str";
|
|
359
|
+
SGFieldType["boolean"] = "boolean";
|
|
360
|
+
SGFieldType["bool"] = "bool";
|
|
361
|
+
SGFieldType["vector2d"] = "vector2d";
|
|
362
|
+
SGFieldType["color"] = "color";
|
|
363
|
+
SGFieldType["time"] = "time";
|
|
364
|
+
SGFieldType["uri"] = "uri";
|
|
365
|
+
SGFieldType["node"] = "node";
|
|
366
|
+
SGFieldType["floatarray"] = "floatarray";
|
|
367
|
+
SGFieldType["intarray"] = "intarray";
|
|
368
|
+
SGFieldType["boolarray"] = "boolarray";
|
|
369
|
+
SGFieldType["stringarray"] = "stringarray";
|
|
370
|
+
SGFieldType["vector2darray"] = "vector2darray";
|
|
371
|
+
SGFieldType["colorarray"] = "colorarray";
|
|
372
|
+
SGFieldType["timearray"] = "timearray";
|
|
373
|
+
SGFieldType["nodearray"] = "nodearray";
|
|
374
|
+
SGFieldType["assocarray"] = "assocarray";
|
|
375
|
+
SGFieldType["array"] = "array";
|
|
376
|
+
SGFieldType["roarray"] = "roarray";
|
|
377
|
+
SGFieldType["rect2d"] = "rect2d";
|
|
378
|
+
SGFieldType["rect2darray"] = "rect2darray";
|
|
379
|
+
})(SGFieldType = exports.SGFieldType || (exports.SGFieldType = {}));
|
|
380
|
+
exports.SGFieldTypes = Object.keys(SGFieldType);
|
|
381
|
+
class SGInterfaceFunction extends SGElement {
|
|
339
382
|
get name() {
|
|
340
383
|
return this.getAttributeValue('name');
|
|
341
384
|
}
|
|
@@ -344,17 +387,17 @@ class SGInterfaceFunction extends SGTag {
|
|
|
344
387
|
}
|
|
345
388
|
}
|
|
346
389
|
exports.SGInterfaceFunction = SGInterfaceFunction;
|
|
347
|
-
class SGInterface extends
|
|
390
|
+
class SGInterface extends SGElement {
|
|
348
391
|
get fields() {
|
|
349
|
-
return this.
|
|
392
|
+
return this.getElementsByTagName('field');
|
|
350
393
|
}
|
|
351
394
|
get functions() {
|
|
352
|
-
return this.
|
|
395
|
+
return this.getElementsByTagName('function');
|
|
353
396
|
}
|
|
354
397
|
get members() {
|
|
355
398
|
var _a;
|
|
356
399
|
const result = [];
|
|
357
|
-
for (const node of this.
|
|
400
|
+
for (const node of this.elements) {
|
|
358
401
|
const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
359
402
|
if (tagName === 'field' || tagName === 'function') {
|
|
360
403
|
result.push(node);
|
|
@@ -367,7 +410,7 @@ class SGInterface extends SGTag {
|
|
|
367
410
|
*/
|
|
368
411
|
hasField(id) {
|
|
369
412
|
var _a;
|
|
370
|
-
for (const node of this.
|
|
413
|
+
for (const node of this.elements) {
|
|
371
414
|
const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
372
415
|
if (tagName === 'field' && node.id === id) {
|
|
373
416
|
return true;
|
|
@@ -380,7 +423,7 @@ class SGInterface extends SGTag {
|
|
|
380
423
|
*/
|
|
381
424
|
hasFunction(name) {
|
|
382
425
|
var _a;
|
|
383
|
-
for (const node of this.
|
|
426
|
+
for (const node of this.elements) {
|
|
384
427
|
const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
385
428
|
if (tagName === 'function' && node.name === name) {
|
|
386
429
|
return true;
|
|
@@ -400,7 +443,7 @@ class SGInterface extends SGTag {
|
|
|
400
443
|
setField(id, type, onChange, alwaysNotify, alias) {
|
|
401
444
|
let field = this.getField(id);
|
|
402
445
|
if (!field) {
|
|
403
|
-
field = this.addChild(creators_1.createSGInterfaceField(id));
|
|
446
|
+
field = this.addChild((0, creators_1.createSGInterfaceField)(id));
|
|
404
447
|
}
|
|
405
448
|
field.type = type;
|
|
406
449
|
field.onChange = onChange;
|
|
@@ -419,11 +462,10 @@ class SGInterface extends SGTag {
|
|
|
419
462
|
*/
|
|
420
463
|
removeField(id) {
|
|
421
464
|
var _a;
|
|
422
|
-
for (let i = 0; i < this.
|
|
423
|
-
const node = this.
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
this.childNodes.splice(i, 1);
|
|
465
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
466
|
+
const node = this.elements[i];
|
|
467
|
+
if (((_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'field' && node.id === id) {
|
|
468
|
+
this.elements.splice(i, 1);
|
|
427
469
|
return true;
|
|
428
470
|
}
|
|
429
471
|
}
|
|
@@ -433,7 +475,7 @@ class SGInterface extends SGTag {
|
|
|
433
475
|
* Get the interface function with the specified name
|
|
434
476
|
*/
|
|
435
477
|
getFunction(name) {
|
|
436
|
-
return this.functions.find(
|
|
478
|
+
return this.functions.find(func => func.name === name);
|
|
437
479
|
}
|
|
438
480
|
/**
|
|
439
481
|
* Add or replace a function on the interface
|
|
@@ -441,7 +483,7 @@ class SGInterface extends SGTag {
|
|
|
441
483
|
setFunction(name) {
|
|
442
484
|
let func = this.getFunction(name);
|
|
443
485
|
if (!func) {
|
|
444
|
-
func = this.addChild(creators_1.createSGInterfaceFunction(name));
|
|
486
|
+
func = this.addChild((0, creators_1.createSGInterfaceFunction)(name));
|
|
445
487
|
}
|
|
446
488
|
return func;
|
|
447
489
|
}
|
|
@@ -451,11 +493,10 @@ class SGInterface extends SGTag {
|
|
|
451
493
|
*/
|
|
452
494
|
removeFunction(name) {
|
|
453
495
|
var _a;
|
|
454
|
-
for (let i = 0; i < this.
|
|
455
|
-
const node = this.
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
this.childNodes.splice(i, 1);
|
|
496
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
497
|
+
const node = this.elements[i];
|
|
498
|
+
if (((_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'function' && node.getAttributeValue('name') === name) {
|
|
499
|
+
this.elements.splice(i, 1);
|
|
459
500
|
return true;
|
|
460
501
|
}
|
|
461
502
|
}
|
|
@@ -463,45 +504,95 @@ class SGInterface extends SGTag {
|
|
|
463
504
|
}
|
|
464
505
|
}
|
|
465
506
|
exports.SGInterface = SGInterface;
|
|
466
|
-
|
|
507
|
+
/**
|
|
508
|
+
* The `<component>` element in SceneGraph. Not to be confused about usages of components like `<Rectangle>`, those are considered `SGNode` instances.
|
|
509
|
+
*/
|
|
510
|
+
class SGComponent extends SGElement {
|
|
467
511
|
/**
|
|
468
512
|
* Get all the <Field> and <Function> elements across all <Interface> nodes in this component
|
|
469
513
|
*/
|
|
470
514
|
get interfaceMembers() {
|
|
471
515
|
const members = [];
|
|
472
|
-
for (const ifaceNode of this.
|
|
516
|
+
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
473
517
|
members.push(...ifaceNode.members);
|
|
474
518
|
}
|
|
475
519
|
return members;
|
|
476
520
|
}
|
|
477
|
-
get
|
|
478
|
-
return this.
|
|
521
|
+
get scriptElements() {
|
|
522
|
+
return this.getElementsByTagName('script');
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Get the <interface> element from this component (if present), or undefined if not.
|
|
526
|
+
* NOTE: Roku supports and merges multiple <interface> elements in a component, but this
|
|
527
|
+
* property points to the FIRST one. If you need to check whether a member exists,
|
|
528
|
+
* look through `this.interfaceMemebers` instead.
|
|
529
|
+
*/
|
|
530
|
+
get interfaceElement() {
|
|
531
|
+
return this.getElementsByTagName('interface')[0];
|
|
479
532
|
}
|
|
480
533
|
/**
|
|
481
|
-
* Get the `<children>` element of this component. (not to be confused with the AST `
|
|
534
|
+
* Get the `<children>` element of this component. (not to be confused with the AST `childTags` property).
|
|
482
535
|
* If there are multiope `<children>` elements, this function will return the last `<children>` tag because that's what Roku devices do.
|
|
483
536
|
*/
|
|
484
|
-
get
|
|
485
|
-
const children = this.
|
|
537
|
+
get childrenElement() {
|
|
538
|
+
const children = this.getElementsByTagName('children');
|
|
486
539
|
return children[children.length - 1];
|
|
487
540
|
}
|
|
541
|
+
get customizationElements() {
|
|
542
|
+
return this.getElementsByTagName('customization');
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Specifies the name of the component, that allows you to create the component in your application.
|
|
546
|
+
* For example, if the name of the component is `CastMemberInfo`, you could create instances of the component declaratively
|
|
547
|
+
* in a child node element of a component `<children>` element (`<CastMemberInfo/>`), or using BrightScript in a `<script>`
|
|
548
|
+
* element (`createObject("roSGNode","CastMemberInfo")`).
|
|
549
|
+
*
|
|
550
|
+
* The name attribute is case-sensitive. You cannot successfully create or declare a component unless the component name exactly
|
|
551
|
+
* matches the name attribute, including case. Also be aware that two components with the exact same name in the same application
|
|
552
|
+
* components directory will have undefined and generally undesirable results if you attempt to create a component object with that name in the application.
|
|
553
|
+
*/
|
|
488
554
|
get name() {
|
|
489
555
|
return this.getAttributeValue('name');
|
|
490
556
|
}
|
|
491
557
|
set name(value) {
|
|
492
558
|
this.setAttributeValue('name', value);
|
|
493
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Specifies the name of the built-in or extended SceneGraph scene or node class whose functionality is extended by this component.
|
|
562
|
+
*
|
|
563
|
+
* For example, `extends="Group"` specifies that the component has all of the functionality of the Group node class (it can have child nodes, has translation/scale/rotation fields, and so forth).
|
|
564
|
+
*
|
|
565
|
+
* By default, a component extends the Group node class.
|
|
566
|
+
*/
|
|
494
567
|
get extends() {
|
|
495
568
|
return this.getAttributeValue('extends');
|
|
496
569
|
}
|
|
497
570
|
set extends(value) {
|
|
498
571
|
this.setAttributeValue('extends', value);
|
|
499
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Specifies the ID of a node declared in the XML file to have the initial remote control focus when the component is instantiated.
|
|
575
|
+
*/
|
|
576
|
+
get initialFocus() {
|
|
577
|
+
return this.getAttributeValue('initialFocus');
|
|
578
|
+
}
|
|
579
|
+
set initialFocus(value) {
|
|
580
|
+
this.setAttributeValue('initialFocus', value);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Specifies the version of the SceneGraph API. The default is 1.0 if not specified.
|
|
584
|
+
*/
|
|
585
|
+
get version() {
|
|
586
|
+
return this.getAttributeValue('version');
|
|
587
|
+
}
|
|
588
|
+
set version(value) {
|
|
589
|
+
this.setAttributeValue('version', value);
|
|
590
|
+
}
|
|
500
591
|
/**
|
|
501
592
|
* Does the specified field exist in the component interface?
|
|
502
593
|
*/
|
|
503
594
|
hasInterfaceField(id) {
|
|
504
|
-
for (const ifaceNode of this.
|
|
595
|
+
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
505
596
|
if (ifaceNode.hasField(id)) {
|
|
506
597
|
return true;
|
|
507
598
|
}
|
|
@@ -512,7 +603,7 @@ class SGComponent extends SGTag {
|
|
|
512
603
|
* Does the specified function exist in the component interface?
|
|
513
604
|
*/
|
|
514
605
|
hasInterfaceFunction(name) {
|
|
515
|
-
for (const ifaceNode of this.
|
|
606
|
+
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
516
607
|
if (ifaceNode.hasFunction(name)) {
|
|
517
608
|
return true;
|
|
518
609
|
}
|
|
@@ -523,7 +614,7 @@ class SGComponent extends SGTag {
|
|
|
523
614
|
* Get an interface field with the specified name
|
|
524
615
|
*/
|
|
525
616
|
getInterfaceField(name) {
|
|
526
|
-
for (const ifaceNode of this.
|
|
617
|
+
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
527
618
|
const field = ifaceNode.getField(name);
|
|
528
619
|
if (field) {
|
|
529
620
|
return field;
|
|
@@ -534,12 +625,12 @@ class SGComponent extends SGTag {
|
|
|
534
625
|
* Return the first SGInterface node found, or insert a new one then return it
|
|
535
626
|
*/
|
|
536
627
|
ensureInterfaceNode() {
|
|
537
|
-
for (const el of this.
|
|
628
|
+
for (const el of this.elements) {
|
|
538
629
|
if (el.tokens.startTagName.text.toLowerCase() === 'interface') {
|
|
539
630
|
return el;
|
|
540
631
|
}
|
|
541
632
|
}
|
|
542
|
-
return this.addChild(
|
|
633
|
+
return this.addChild((0, creators_1.createSGInterface)());
|
|
543
634
|
}
|
|
544
635
|
/**
|
|
545
636
|
* Create or update a <field> interface element.
|
|
@@ -562,7 +653,7 @@ class SGComponent extends SGTag {
|
|
|
562
653
|
* @returns true if a field was found and removed. Returns false if no field was found with that name
|
|
563
654
|
*/
|
|
564
655
|
removeInterfaceField(id) {
|
|
565
|
-
for (const ifaceNode of this.
|
|
656
|
+
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
566
657
|
if (ifaceNode.removeField(id)) {
|
|
567
658
|
return true;
|
|
568
659
|
}
|
|
@@ -570,10 +661,10 @@ class SGComponent extends SGTag {
|
|
|
570
661
|
return false;
|
|
571
662
|
}
|
|
572
663
|
/**
|
|
573
|
-
|
|
574
|
-
|
|
664
|
+
* Get an interface field with the specified name
|
|
665
|
+
*/
|
|
575
666
|
getInterfaceFunction(name) {
|
|
576
|
-
for (const ifaceNode of this.
|
|
667
|
+
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
577
668
|
const func = ifaceNode.getFunction(name);
|
|
578
669
|
if (func) {
|
|
579
670
|
return func;
|
|
@@ -585,7 +676,7 @@ class SGComponent extends SGTag {
|
|
|
585
676
|
* @returns true if a function was found and removed. Returns false if no function was found with that name
|
|
586
677
|
*/
|
|
587
678
|
removeInterfaceFunction(name) {
|
|
588
|
-
for (const ifaceNode of this.
|
|
679
|
+
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
589
680
|
if (ifaceNode.removeFunction(name)) {
|
|
590
681
|
return true;
|
|
591
682
|
}
|
|
@@ -595,20 +686,20 @@ class SGComponent extends SGTag {
|
|
|
595
686
|
}
|
|
596
687
|
exports.SGComponent = SGComponent;
|
|
597
688
|
class SGAst {
|
|
598
|
-
constructor(
|
|
599
|
-
this.
|
|
600
|
-
this.
|
|
601
|
-
this.
|
|
689
|
+
constructor(options = {}) {
|
|
690
|
+
this.prologElement = options.prologElement;
|
|
691
|
+
this.rootElement = options.rootElement;
|
|
692
|
+
this.componentElement = options.componentElement;
|
|
602
693
|
}
|
|
603
694
|
transpile(state) {
|
|
604
695
|
const chunks = [];
|
|
605
696
|
//write XML prolog
|
|
606
|
-
if (this.
|
|
607
|
-
chunks.push(this.
|
|
697
|
+
if (this.prologElement) {
|
|
698
|
+
chunks.push(this.prologElement.transpile(state));
|
|
608
699
|
}
|
|
609
|
-
if (this.
|
|
700
|
+
if (this.componentElement) {
|
|
610
701
|
//write content
|
|
611
|
-
chunks.push(this.
|
|
702
|
+
chunks.push(this.componentElement.transpile(state));
|
|
612
703
|
}
|
|
613
704
|
return new source_map_1.SourceNode(null, null, null, chunks);
|
|
614
705
|
}
|