brighterscript 1.0.0-alpha.4 → 1.0.0-alpha.40

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.
Files changed (620) hide show
  1. package/CHANGELOG.md +1387 -291
  2. package/README.md +72 -131
  3. package/bsconfig.schema.json +85 -1
  4. package/dist/ActionPipeline.d.ts +10 -0
  5. package/dist/ActionPipeline.js +40 -0
  6. package/dist/ActionPipeline.js.map +1 -0
  7. package/dist/AstValidationSegmenter.d.ts +42 -0
  8. package/dist/AstValidationSegmenter.js +237 -0
  9. package/dist/AstValidationSegmenter.js.map +1 -0
  10. package/dist/BsConfig.d.ts +56 -6
  11. package/dist/BusyStatusTracker.d.ts +31 -0
  12. package/dist/BusyStatusTracker.js +83 -0
  13. package/dist/BusyStatusTracker.js.map +1 -0
  14. package/dist/Cache.d.ts +5 -6
  15. package/dist/Cache.js +12 -11
  16. package/dist/Cache.js.map +1 -1
  17. package/dist/CacheVerifier.d.ts +7 -0
  18. package/dist/CacheVerifier.js +20 -0
  19. package/dist/CacheVerifier.js.map +1 -0
  20. package/dist/CodeActionUtil.d.ts +6 -3
  21. package/dist/CodeActionUtil.js +19 -5
  22. package/dist/CodeActionUtil.js.map +1 -1
  23. package/dist/CommentFlagProcessor.d.ts +7 -6
  24. package/dist/CommentFlagProcessor.js +11 -8
  25. package/dist/CommentFlagProcessor.js.map +1 -1
  26. package/dist/CrossScopeValidator.d.ts +67 -0
  27. package/dist/CrossScopeValidator.js +617 -0
  28. package/dist/CrossScopeValidator.js.map +1 -0
  29. package/dist/DependencyGraph.d.ts +8 -3
  30. package/dist/DependencyGraph.js +49 -16
  31. package/dist/DependencyGraph.js.map +1 -1
  32. package/dist/DiagnosticCollection.d.ts +5 -3
  33. package/dist/DiagnosticCollection.js +21 -16
  34. package/dist/DiagnosticCollection.js.map +1 -1
  35. package/dist/DiagnosticFilterer.d.ts +8 -4
  36. package/dist/DiagnosticFilterer.js +90 -54
  37. package/dist/DiagnosticFilterer.js.map +1 -1
  38. package/dist/DiagnosticManager.d.ts +61 -0
  39. package/dist/DiagnosticManager.js +238 -0
  40. package/dist/DiagnosticManager.js.map +1 -0
  41. package/dist/DiagnosticMessages.d.ts +204 -24
  42. package/dist/DiagnosticMessages.js +266 -33
  43. package/dist/DiagnosticMessages.js.map +1 -1
  44. package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
  45. package/dist/DiagnosticSeverityAdjuster.js +41 -0
  46. package/dist/DiagnosticSeverityAdjuster.js.map +1 -0
  47. package/dist/FunctionScope.d.ts +28 -0
  48. package/dist/FunctionScope.js +52 -0
  49. package/dist/FunctionScope.js.map +1 -0
  50. package/dist/KeyedThrottler.d.ts +3 -3
  51. package/dist/KeyedThrottler.js +3 -3
  52. package/dist/KeyedThrottler.js.map +1 -1
  53. package/dist/LanguageServer.d.ts +72 -47
  54. package/dist/LanguageServer.js +545 -314
  55. package/dist/LanguageServer.js.map +1 -1
  56. package/dist/Logger.d.ts +9 -10
  57. package/dist/Logger.js +36 -30
  58. package/dist/Logger.js.map +1 -1
  59. package/dist/PluginInterface.d.ts +29 -7
  60. package/dist/PluginInterface.js +90 -7
  61. package/dist/PluginInterface.js.map +1 -1
  62. package/dist/Program.d.ts +201 -100
  63. package/dist/Program.js +1079 -700
  64. package/dist/Program.js.map +1 -1
  65. package/dist/ProgramBuilder.d.ts +29 -18
  66. package/dist/ProgramBuilder.js +178 -141
  67. package/dist/ProgramBuilder.js.map +1 -1
  68. package/dist/Scope.d.ts +144 -109
  69. package/dist/Scope.js +533 -552
  70. package/dist/Scope.js.map +1 -1
  71. package/dist/SemanticTokenUtils.d.ts +14 -0
  72. package/dist/SemanticTokenUtils.js +85 -0
  73. package/dist/SemanticTokenUtils.js.map +1 -0
  74. package/dist/Stopwatch.d.ts +4 -0
  75. package/dist/Stopwatch.js +8 -1
  76. package/dist/Stopwatch.js.map +1 -1
  77. package/dist/SymbolTable.d.ts +91 -24
  78. package/dist/SymbolTable.js +291 -64
  79. package/dist/SymbolTable.js.map +1 -1
  80. package/dist/SymbolTypeFlag.d.ts +9 -0
  81. package/dist/SymbolTypeFlag.js +14 -0
  82. package/dist/SymbolTypeFlag.js.map +1 -0
  83. package/dist/Throttler.d.ts +12 -0
  84. package/dist/Throttler.js +39 -0
  85. package/dist/Throttler.js.map +1 -1
  86. package/dist/Watcher.d.ts +0 -3
  87. package/dist/Watcher.js +0 -3
  88. package/dist/Watcher.js.map +1 -1
  89. package/dist/XmlScope.d.ts +5 -15
  90. package/dist/XmlScope.js +35 -87
  91. package/dist/XmlScope.js.map +1 -1
  92. package/dist/astUtils/CachedLookups.d.ts +50 -0
  93. package/dist/astUtils/CachedLookups.js +335 -0
  94. package/dist/astUtils/CachedLookups.js.map +1 -0
  95. package/dist/astUtils/CachedLookups.spec.js +39 -0
  96. package/dist/astUtils/CachedLookups.spec.js.map +1 -0
  97. package/dist/astUtils/Editor.d.ts +69 -0
  98. package/dist/astUtils/Editor.js +245 -0
  99. package/dist/astUtils/Editor.js.map +1 -0
  100. package/dist/astUtils/Editor.spec.js +258 -0
  101. package/dist/astUtils/Editor.spec.js.map +1 -0
  102. package/dist/astUtils/creators.d.ts +36 -19
  103. package/dist/astUtils/creators.js +222 -43
  104. package/dist/astUtils/creators.js.map +1 -1
  105. package/dist/astUtils/creators.spec.js +5 -5
  106. package/dist/astUtils/creators.spec.js.map +1 -1
  107. package/dist/astUtils/reflection.d.ts +148 -82
  108. package/dist/astUtils/reflection.js +324 -137
  109. package/dist/astUtils/reflection.js.map +1 -1
  110. package/dist/astUtils/reflection.spec.js +267 -167
  111. package/dist/astUtils/reflection.spec.js.map +1 -1
  112. package/dist/astUtils/stackedVisitor.js.map +1 -1
  113. package/dist/astUtils/stackedVisitor.spec.js +14 -14
  114. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  115. package/dist/astUtils/visitors.d.ts +114 -53
  116. package/dist/astUtils/visitors.js +70 -13
  117. package/dist/astUtils/visitors.js.map +1 -1
  118. package/dist/astUtils/visitors.spec.js +463 -51
  119. package/dist/astUtils/visitors.spec.js.map +1 -1
  120. package/dist/astUtils/xml.d.ts +9 -8
  121. package/dist/astUtils/xml.js +10 -5
  122. package/dist/astUtils/xml.js.map +1 -1
  123. package/dist/bscPlugin/BscPlugin.d.ts +22 -1
  124. package/dist/bscPlugin/BscPlugin.js +88 -0
  125. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  126. package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
  127. package/dist/bscPlugin/CallExpressionInfo.js +135 -0
  128. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
  129. package/dist/bscPlugin/FileWriter.d.ts +6 -0
  130. package/dist/bscPlugin/FileWriter.js +24 -0
  131. package/dist/bscPlugin/FileWriter.js.map +1 -0
  132. package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
  133. package/dist/bscPlugin/SignatureHelpUtil.js +137 -0
  134. package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
  135. package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +1 -1
  136. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +30 -18
  137. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  138. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +94 -21
  139. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  140. package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +64 -0
  141. package/dist/bscPlugin/completions/CompletionsProcessor.js +626 -0
  142. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
  143. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +2188 -0
  144. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
  145. package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
  146. package/dist/bscPlugin/definition/DefinitionProvider.js +212 -0
  147. package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
  148. package/dist/bscPlugin/definition/DefinitionProvider.spec.d.ts +1 -0
  149. package/dist/bscPlugin/definition/DefinitionProvider.spec.js +87 -0
  150. package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
  151. package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
  152. package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
  153. package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
  154. package/dist/bscPlugin/hover/HoverProcessor.d.ts +18 -0
  155. package/dist/bscPlugin/hover/HoverProcessor.js +218 -0
  156. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
  157. package/dist/bscPlugin/hover/HoverProcessor.spec.d.ts +1 -0
  158. package/dist/bscPlugin/hover/HoverProcessor.spec.js +786 -0
  159. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -0
  160. package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
  161. package/dist/bscPlugin/references/ReferencesProvider.js +57 -0
  162. package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
  163. package/dist/bscPlugin/references/ReferencesProvider.spec.d.ts +1 -0
  164. package/dist/bscPlugin/references/ReferencesProvider.spec.js +51 -0
  165. package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +1 -0
  166. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +14 -0
  167. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +154 -0
  168. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
  169. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
  170. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +530 -0
  171. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
  172. package/dist/bscPlugin/serialize/BslibInjector.spec.d.ts +1 -0
  173. package/dist/bscPlugin/serialize/BslibInjector.spec.js +33 -0
  174. package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
  175. package/dist/bscPlugin/serialize/BslibManager.d.ts +12 -0
  176. package/dist/bscPlugin/serialize/BslibManager.js +46 -0
  177. package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
  178. package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
  179. package/dist/bscPlugin/serialize/FileSerializer.js +75 -0
  180. package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
  181. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.d.ts +7 -0
  182. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js +22 -0
  183. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js.map +1 -0
  184. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.d.ts +1 -0
  185. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js +291 -0
  186. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js.map +1 -0
  187. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.d.ts +7 -0
  188. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js +26 -0
  189. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js.map +1 -0
  190. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.d.ts +1 -0
  191. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js +245 -0
  192. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js.map +1 -0
  193. package/dist/bscPlugin/symbols/symbolUtils.d.ts +5 -0
  194. package/dist/bscPlugin/symbols/symbolUtils.js +141 -0
  195. package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
  196. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +21 -0
  197. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +201 -0
  198. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
  199. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
  200. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +75 -0
  201. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
  202. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +12 -0
  203. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +99 -0
  204. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
  205. package/dist/bscPlugin/validation/BrsFileAfterValidator.d.ts +7 -0
  206. package/dist/bscPlugin/validation/BrsFileAfterValidator.js +18 -0
  207. package/dist/bscPlugin/validation/BrsFileAfterValidator.js.map +1 -0
  208. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +36 -0
  209. package/dist/bscPlugin/validation/BrsFileValidator.js +534 -0
  210. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
  211. package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +1 -0
  212. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1118 -0
  213. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -0
  214. package/dist/bscPlugin/validation/ProgramValidator.d.ts +11 -0
  215. package/dist/bscPlugin/validation/ProgramValidator.js +33 -0
  216. package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
  217. package/dist/bscPlugin/validation/ScopeValidator.d.ts +126 -0
  218. package/dist/bscPlugin/validation/ScopeValidator.js +1039 -0
  219. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
  220. package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
  221. package/dist/bscPlugin/validation/ScopeValidator.spec.js +3346 -0
  222. package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
  223. package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
  224. package/dist/bscPlugin/validation/XmlFileValidator.js +44 -0
  225. package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
  226. package/dist/cli.js +117 -11
  227. package/dist/cli.js.map +1 -1
  228. package/dist/deferred.d.ts +3 -3
  229. package/dist/deferred.js.map +1 -1
  230. package/dist/diagnosticUtils.d.ts +10 -3
  231. package/dist/diagnosticUtils.js +62 -24
  232. package/dist/diagnosticUtils.js.map +1 -1
  233. package/dist/examples/plugins/removePrint.js +8 -12
  234. package/dist/examples/plugins/removePrint.js.map +1 -1
  235. package/dist/files/AssetFile.d.ts +24 -0
  236. package/dist/files/AssetFile.js +25 -0
  237. package/dist/files/AssetFile.js.map +1 -0
  238. package/dist/files/BrsFile.Class.spec.js +912 -153
  239. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  240. package/dist/files/BrsFile.d.ts +142 -85
  241. package/dist/files/BrsFile.js +845 -935
  242. package/dist/files/BrsFile.js.map +1 -1
  243. package/dist/files/BrsFile.spec.js +3778 -862
  244. package/dist/files/BrsFile.spec.js.map +1 -1
  245. package/dist/files/BscFile.d.ts +101 -0
  246. package/dist/files/BscFile.js +15 -0
  247. package/dist/files/BscFile.js.map +1 -0
  248. package/dist/files/Factory.d.ts +25 -0
  249. package/dist/files/Factory.js +22 -0
  250. package/dist/files/Factory.js.map +1 -0
  251. package/dist/files/LazyFileData.d.ts +20 -0
  252. package/dist/files/LazyFileData.js +54 -0
  253. package/dist/files/LazyFileData.js.map +1 -0
  254. package/dist/files/LazyFileData.spec.d.ts +1 -0
  255. package/dist/files/LazyFileData.spec.js +27 -0
  256. package/dist/files/LazyFileData.spec.js.map +1 -0
  257. package/dist/files/XmlFile.d.ts +73 -41
  258. package/dist/files/XmlFile.js +128 -138
  259. package/dist/files/XmlFile.js.map +1 -1
  260. package/dist/files/XmlFile.spec.js +451 -324
  261. package/dist/files/XmlFile.spec.js.map +1 -1
  262. package/dist/files/tests/imports.spec.js +62 -52
  263. package/dist/files/tests/imports.spec.js.map +1 -1
  264. package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
  265. package/dist/files/tests/optionalChaning.spec.js +152 -0
  266. package/dist/files/tests/optionalChaning.spec.js.map +1 -0
  267. package/dist/globalCallables.d.ts +3 -1
  268. package/dist/globalCallables.js +417 -163
  269. package/dist/globalCallables.js.map +1 -1
  270. package/dist/index.d.ts +26 -3
  271. package/dist/index.js +44 -5
  272. package/dist/index.js.map +1 -1
  273. package/dist/interfaces.d.ts +783 -122
  274. package/dist/interfaces.js +21 -0
  275. package/dist/interfaces.js.map +1 -1
  276. package/dist/lexer/Character.spec.js +5 -5
  277. package/dist/lexer/Character.spec.js.map +1 -1
  278. package/dist/lexer/Lexer.d.ts +51 -12
  279. package/dist/lexer/Lexer.js +201 -57
  280. package/dist/lexer/Lexer.js.map +1 -1
  281. package/dist/lexer/Lexer.spec.js +781 -565
  282. package/dist/lexer/Lexer.spec.js.map +1 -1
  283. package/dist/lexer/Token.d.ts +27 -11
  284. package/dist/lexer/Token.js +10 -2
  285. package/dist/lexer/Token.js.map +1 -1
  286. package/dist/lexer/TokenKind.d.ts +31 -2
  287. package/dist/lexer/TokenKind.js +134 -10
  288. package/dist/lexer/TokenKind.js.map +1 -1
  289. package/dist/logging.d.ts +9 -0
  290. package/dist/logging.js +16 -0
  291. package/dist/logging.js.map +1 -0
  292. package/dist/parser/AstNode.d.ts +191 -0
  293. package/dist/parser/AstNode.js +269 -0
  294. package/dist/parser/AstNode.js.map +1 -0
  295. package/dist/parser/AstNode.spec.d.ts +1 -0
  296. package/dist/parser/AstNode.spec.js +1455 -0
  297. package/dist/parser/AstNode.spec.js.map +1 -0
  298. package/dist/parser/BrightScriptDocParser.d.ts +56 -0
  299. package/dist/parser/BrightScriptDocParser.js +294 -0
  300. package/dist/parser/BrightScriptDocParser.js.map +1 -0
  301. package/dist/parser/BrightScriptDocParser.spec.d.ts +1 -0
  302. package/dist/parser/BrightScriptDocParser.spec.js +310 -0
  303. package/dist/parser/BrightScriptDocParser.spec.js.map +1 -0
  304. package/dist/parser/BrsTranspileState.d.ts +22 -3
  305. package/dist/parser/BrsTranspileState.js +19 -0
  306. package/dist/parser/BrsTranspileState.js.map +1 -1
  307. package/dist/parser/Expression.d.ts +489 -221
  308. package/dist/parser/Expression.js +1206 -506
  309. package/dist/parser/Expression.js.map +1 -1
  310. package/dist/parser/Expression.spec.d.ts +1 -0
  311. package/dist/parser/Expression.spec.js +40 -0
  312. package/dist/parser/Expression.spec.js.map +1 -0
  313. package/dist/parser/Parser.Class.spec.js +230 -125
  314. package/dist/parser/Parser.Class.spec.js.map +1 -1
  315. package/dist/parser/Parser.d.ts +113 -124
  316. package/dist/parser/Parser.js +1510 -983
  317. package/dist/parser/Parser.js.map +1 -1
  318. package/dist/parser/Parser.spec.d.ts +3 -1
  319. package/dist/parser/Parser.spec.js +1533 -517
  320. package/dist/parser/Parser.spec.js.map +1 -1
  321. package/dist/parser/SGParser.d.ts +60 -7
  322. package/dist/parser/SGParser.js +225 -185
  323. package/dist/parser/SGParser.js.map +1 -1
  324. package/dist/parser/SGParser.spec.js +29 -32
  325. package/dist/parser/SGParser.spec.js.map +1 -1
  326. package/dist/parser/SGTypes.d.ts +295 -52
  327. package/dist/parser/SGTypes.js +540 -187
  328. package/dist/parser/SGTypes.js.map +1 -1
  329. package/dist/parser/Statement.d.ts +808 -261
  330. package/dist/parser/Statement.js +2232 -588
  331. package/dist/parser/Statement.js.map +1 -1
  332. package/dist/parser/Statement.spec.js +133 -36
  333. package/dist/parser/Statement.spec.js.map +1 -1
  334. package/dist/parser/TranspileState.d.ts +26 -12
  335. package/dist/parser/TranspileState.js +114 -15
  336. package/dist/parser/TranspileState.js.map +1 -1
  337. package/dist/parser/tests/Parser.spec.d.ts +3 -9
  338. package/dist/parser/tests/Parser.spec.js +7 -13
  339. package/dist/parser/tests/Parser.spec.js.map +1 -1
  340. package/dist/parser/tests/controlFlow/For.spec.js +83 -75
  341. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  342. package/dist/parser/tests/controlFlow/ForEach.spec.js +58 -51
  343. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  344. package/dist/parser/tests/controlFlow/If.spec.js +382 -239
  345. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  346. package/dist/parser/tests/controlFlow/While.spec.js +52 -45
  347. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  348. package/dist/parser/tests/expression/Additive.spec.js +51 -43
  349. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  350. package/dist/parser/tests/expression/ArrayLiterals.spec.js +192 -142
  351. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  352. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +236 -160
  353. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  354. package/dist/parser/tests/expression/Boolean.spec.js +41 -34
  355. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  356. package/dist/parser/tests/expression/Call.spec.js +173 -55
  357. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  358. package/dist/parser/tests/expression/Exponential.spec.js +20 -20
  359. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  360. package/dist/parser/tests/expression/Function.spec.js +291 -282
  361. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  362. package/dist/parser/tests/expression/Indexing.spec.js +193 -110
  363. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  364. package/dist/parser/tests/expression/Multiplicative.spec.js +42 -42
  365. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  366. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +213 -115
  367. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  368. package/dist/parser/tests/expression/PrefixUnary.spec.js +58 -52
  369. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  370. package/dist/parser/tests/expression/Primary.spec.js +76 -60
  371. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  372. package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
  373. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
  374. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
  375. package/dist/parser/tests/expression/Relational.spec.js +50 -50
  376. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  377. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +31 -31
  378. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  379. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +235 -94
  380. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  381. package/dist/parser/tests/expression/TernaryExpression.spec.js +403 -174
  382. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  383. package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
  384. package/dist/parser/tests/expression/TypeExpression.spec.js +126 -0
  385. package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
  386. package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
  387. package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
  388. package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
  389. package/dist/parser/tests/statement/AssignmentOperators.spec.js +44 -44
  390. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  391. package/dist/parser/tests/statement/ConstStatement.spec.d.ts +1 -0
  392. package/dist/parser/tests/statement/ConstStatement.spec.js +262 -0
  393. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -0
  394. package/dist/parser/tests/statement/Continue.spec.d.ts +1 -0
  395. package/dist/parser/tests/statement/Continue.spec.js +119 -0
  396. package/dist/parser/tests/statement/Continue.spec.js.map +1 -0
  397. package/dist/parser/tests/statement/Declaration.spec.js +61 -55
  398. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  399. package/dist/parser/tests/statement/Dim.spec.js +22 -22
  400. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  401. package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
  402. package/dist/parser/tests/statement/Enum.spec.js +744 -0
  403. package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
  404. package/dist/parser/tests/statement/For.spec.d.ts +1 -0
  405. package/dist/parser/tests/statement/For.spec.js +45 -0
  406. package/dist/parser/tests/statement/For.spec.js.map +1 -0
  407. package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
  408. package/dist/parser/tests/statement/ForEach.spec.js +36 -0
  409. package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
  410. package/dist/parser/tests/statement/Function.spec.js +226 -215
  411. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  412. package/dist/parser/tests/statement/Goto.spec.js +16 -15
  413. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  414. package/dist/parser/tests/statement/Increment.spec.js +64 -59
  415. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  416. package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
  417. package/dist/parser/tests/statement/InterfaceStatement.spec.js +110 -0
  418. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
  419. package/dist/parser/tests/statement/LibraryStatement.spec.js +22 -22
  420. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  421. package/dist/parser/tests/statement/Misc.spec.js +127 -168
  422. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  423. package/dist/parser/tests/statement/PrintStatement.spec.js +133 -114
  424. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  425. package/dist/parser/tests/statement/ReturnStatement.spec.js +57 -54
  426. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  427. package/dist/parser/tests/statement/Set.spec.js +131 -117
  428. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  429. package/dist/parser/tests/statement/Stop.spec.js +14 -13
  430. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  431. package/dist/parser/tests/statement/Throw.spec.js +11 -8
  432. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  433. package/dist/parser/tests/statement/TryCatch.spec.js +26 -15
  434. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  435. package/dist/preprocessor/Manifest.d.ts +6 -6
  436. package/dist/preprocessor/Manifest.js +17 -38
  437. package/dist/preprocessor/Manifest.js.map +1 -1
  438. package/dist/preprocessor/Manifest.spec.d.ts +1 -0
  439. package/dist/preprocessor/Manifest.spec.js +78 -103
  440. package/dist/preprocessor/Manifest.spec.js.map +1 -1
  441. package/dist/roku-types/data.json +19452 -0
  442. package/dist/roku-types/index.d.ts +5533 -0
  443. package/dist/roku-types/index.js +11 -0
  444. package/dist/roku-types/index.js.map +1 -0
  445. package/dist/types/ArrayType.d.ts +9 -5
  446. package/dist/types/ArrayType.js +73 -24
  447. package/dist/types/ArrayType.js.map +1 -1
  448. package/dist/types/ArrayType.spec.js +39 -11
  449. package/dist/types/ArrayType.spec.js.map +1 -1
  450. package/dist/types/AssociativeArrayType.d.ts +14 -0
  451. package/dist/types/AssociativeArrayType.js +60 -0
  452. package/dist/types/AssociativeArrayType.js.map +1 -0
  453. package/dist/types/BaseFunctionType.d.ts +9 -0
  454. package/dist/types/BaseFunctionType.js +25 -0
  455. package/dist/types/BaseFunctionType.js.map +1 -0
  456. package/dist/types/BooleanType.d.ts +10 -5
  457. package/dist/types/BooleanType.js +21 -9
  458. package/dist/types/BooleanType.js.map +1 -1
  459. package/dist/types/BooleanType.spec.js +10 -4
  460. package/dist/types/BooleanType.spec.js.map +1 -1
  461. package/dist/types/BscType.d.ts +29 -3
  462. package/dist/types/BscType.js +121 -0
  463. package/dist/types/BscType.js.map +1 -1
  464. package/dist/types/BscTypeKind.d.ts +25 -0
  465. package/dist/types/BscTypeKind.js +30 -0
  466. package/dist/types/BscTypeKind.js.map +1 -0
  467. package/dist/types/BuiltInInterfaceAdder.d.ts +25 -0
  468. package/dist/types/BuiltInInterfaceAdder.js +201 -0
  469. package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
  470. package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
  471. package/dist/types/BuiltInInterfaceAdder.spec.js +115 -0
  472. package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
  473. package/dist/types/ClassType.d.ts +16 -0
  474. package/dist/types/ClassType.js +57 -0
  475. package/dist/types/ClassType.js.map +1 -0
  476. package/dist/types/ClassType.spec.d.ts +1 -0
  477. package/dist/types/ClassType.spec.js +76 -0
  478. package/dist/types/ClassType.spec.js.map +1 -0
  479. package/dist/types/ComponentType.d.ts +27 -0
  480. package/dist/types/ComponentType.js +83 -0
  481. package/dist/types/ComponentType.js.map +1 -0
  482. package/dist/types/DoubleType.d.ts +10 -5
  483. package/dist/types/DoubleType.js +25 -18
  484. package/dist/types/DoubleType.js.map +1 -1
  485. package/dist/types/DoubleType.spec.js +12 -4
  486. package/dist/types/DoubleType.spec.js.map +1 -1
  487. package/dist/types/DynamicType.d.ts +12 -5
  488. package/dist/types/DynamicType.js +22 -6
  489. package/dist/types/DynamicType.js.map +1 -1
  490. package/dist/types/DynamicType.spec.js +16 -5
  491. package/dist/types/DynamicType.spec.js.map +1 -1
  492. package/dist/types/EnumType.d.ts +40 -0
  493. package/dist/types/EnumType.js +80 -0
  494. package/dist/types/EnumType.js.map +1 -0
  495. package/dist/types/EnumType.spec.d.ts +1 -0
  496. package/dist/types/EnumType.spec.js +33 -0
  497. package/dist/types/EnumType.spec.js.map +1 -0
  498. package/dist/types/FloatType.d.ts +10 -5
  499. package/dist/types/FloatType.js +25 -18
  500. package/dist/types/FloatType.js.map +1 -1
  501. package/dist/types/FloatType.spec.js +4 -4
  502. package/dist/types/FloatType.spec.js.map +1 -1
  503. package/dist/types/FunctionType.d.ts +10 -22
  504. package/dist/types/FunctionType.js +26 -63
  505. package/dist/types/FunctionType.js.map +1 -1
  506. package/dist/types/InheritableType.d.ts +28 -0
  507. package/dist/types/InheritableType.js +157 -0
  508. package/dist/types/InheritableType.js.map +1 -0
  509. package/dist/types/IntegerType.d.ts +10 -5
  510. package/dist/types/IntegerType.js +25 -18
  511. package/dist/types/IntegerType.js.map +1 -1
  512. package/dist/types/IntegerType.spec.js +8 -4
  513. package/dist/types/IntegerType.spec.js.map +1 -1
  514. package/dist/types/InterfaceType.d.ts +14 -6
  515. package/dist/types/InterfaceType.js +26 -15
  516. package/dist/types/InterfaceType.js.map +1 -1
  517. package/dist/types/InterfaceType.spec.d.ts +1 -0
  518. package/dist/types/InterfaceType.spec.js +227 -0
  519. package/dist/types/InterfaceType.spec.js.map +1 -0
  520. package/dist/types/InvalidType.d.ts +9 -5
  521. package/dist/types/InvalidType.js +20 -9
  522. package/dist/types/InvalidType.js.map +1 -1
  523. package/dist/types/InvalidType.spec.js +8 -4
  524. package/dist/types/InvalidType.spec.js.map +1 -1
  525. package/dist/types/LongIntegerType.d.ts +10 -5
  526. package/dist/types/LongIntegerType.js +25 -18
  527. package/dist/types/LongIntegerType.js.map +1 -1
  528. package/dist/types/LongIntegerType.spec.js +10 -4
  529. package/dist/types/LongIntegerType.spec.js.map +1 -1
  530. package/dist/types/NamespaceType.d.ts +12 -0
  531. package/dist/types/NamespaceType.js +28 -0
  532. package/dist/types/NamespaceType.js.map +1 -0
  533. package/dist/types/ObjectType.d.ts +10 -5
  534. package/dist/types/ObjectType.js +23 -9
  535. package/dist/types/ObjectType.js.map +1 -1
  536. package/dist/types/ObjectType.spec.js +3 -3
  537. package/dist/types/ObjectType.spec.js.map +1 -1
  538. package/dist/types/ReferenceType.d.ts +79 -0
  539. package/dist/types/ReferenceType.js +522 -0
  540. package/dist/types/ReferenceType.js.map +1 -0
  541. package/dist/types/ReferenceType.spec.d.ts +1 -0
  542. package/dist/types/ReferenceType.spec.js +151 -0
  543. package/dist/types/ReferenceType.spec.js.map +1 -0
  544. package/dist/types/StringType.d.ts +13 -5
  545. package/dist/types/StringType.js +25 -9
  546. package/dist/types/StringType.js.map +1 -1
  547. package/dist/types/StringType.spec.js +3 -3
  548. package/dist/types/StringType.spec.js.map +1 -1
  549. package/dist/types/TypedFunctionType.d.ts +33 -0
  550. package/dist/types/TypedFunctionType.js +106 -0
  551. package/dist/types/TypedFunctionType.js.map +1 -0
  552. package/dist/types/TypedFunctionType.spec.d.ts +1 -0
  553. package/dist/types/TypedFunctionType.spec.js +122 -0
  554. package/dist/types/TypedFunctionType.spec.js.map +1 -0
  555. package/dist/types/UninitializedType.d.ts +8 -6
  556. package/dist/types/UninitializedType.js +15 -9
  557. package/dist/types/UninitializedType.js.map +1 -1
  558. package/dist/types/UnionType.d.ts +20 -0
  559. package/dist/types/UnionType.js +127 -0
  560. package/dist/types/UnionType.js.map +1 -0
  561. package/dist/types/UnionType.spec.d.ts +1 -0
  562. package/dist/types/UnionType.spec.js +129 -0
  563. package/dist/types/UnionType.spec.js.map +1 -0
  564. package/dist/types/VoidType.d.ts +10 -5
  565. package/dist/types/VoidType.js +20 -9
  566. package/dist/types/VoidType.js.map +1 -1
  567. package/dist/types/VoidType.spec.js +3 -3
  568. package/dist/types/VoidType.spec.js.map +1 -1
  569. package/dist/types/helper.spec.d.ts +1 -0
  570. package/dist/types/helper.spec.js +144 -0
  571. package/dist/types/helper.spec.js.map +1 -0
  572. package/dist/types/helpers.d.ts +26 -0
  573. package/dist/types/helpers.js +191 -0
  574. package/dist/types/helpers.js.map +1 -0
  575. package/dist/types/index.d.ts +22 -0
  576. package/dist/types/index.js +39 -0
  577. package/dist/types/index.js.map +1 -0
  578. package/dist/util.d.ts +272 -117
  579. package/dist/util.js +1583 -343
  580. package/dist/util.js.map +1 -1
  581. package/dist/validators/ClassValidator.d.ts +9 -15
  582. package/dist/validators/ClassValidator.js +85 -138
  583. package/dist/validators/ClassValidator.js.map +1 -1
  584. package/package.json +174 -138
  585. package/dist/astUtils/index.d.ts +0 -7
  586. package/dist/astUtils/index.js +0 -26
  587. package/dist/astUtils/index.js.map +0 -1
  588. package/dist/lexer/index.d.ts +0 -3
  589. package/dist/lexer/index.js +0 -17
  590. package/dist/lexer/index.js.map +0 -1
  591. package/dist/parser/index.d.ts +0 -3
  592. package/dist/parser/index.js +0 -16
  593. package/dist/parser/index.js.map +0 -1
  594. package/dist/preprocessor/Chunk.d.ts +0 -82
  595. package/dist/preprocessor/Chunk.js +0 -77
  596. package/dist/preprocessor/Chunk.js.map +0 -1
  597. package/dist/preprocessor/Preprocessor.d.ts +0 -60
  598. package/dist/preprocessor/Preprocessor.js +0 -156
  599. package/dist/preprocessor/Preprocessor.js.map +0 -1
  600. package/dist/preprocessor/Preprocessor.spec.js +0 -152
  601. package/dist/preprocessor/Preprocessor.spec.js.map +0 -1
  602. package/dist/preprocessor/PreprocessorParser.d.ts +0 -61
  603. package/dist/preprocessor/PreprocessorParser.js +0 -194
  604. package/dist/preprocessor/PreprocessorParser.js.map +0 -1
  605. package/dist/preprocessor/PreprocessorParser.spec.js +0 -116
  606. package/dist/preprocessor/PreprocessorParser.spec.js.map +0 -1
  607. package/dist/preprocessor/index.d.ts +0 -3
  608. package/dist/preprocessor/index.js +0 -16
  609. package/dist/preprocessor/index.js.map +0 -1
  610. package/dist/types/CustomType.d.ts +0 -10
  611. package/dist/types/CustomType.js +0 -35
  612. package/dist/types/CustomType.js.map +0 -1
  613. package/dist/types/FunctionType.spec.js +0 -29
  614. package/dist/types/FunctionType.spec.js.map +0 -1
  615. package/dist/types/LazyType.d.ts +0 -15
  616. package/dist/types/LazyType.js +0 -32
  617. package/dist/types/LazyType.js.map +0 -1
  618. /package/dist/{preprocessor/Preprocessor.spec.d.ts → astUtils/CachedLookups.spec.d.ts} +0 -0
  619. /package/dist/{preprocessor/PreprocessorParser.spec.d.ts → astUtils/Editor.spec.d.ts} +0 -0
  620. /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/completions/CompletionsProcessor.spec.d.ts} +0 -0
@@ -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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,EAAE,GAAG,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;SACxF;QAED,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,iBAAiB,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,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;IAE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AC;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;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
- }
@@ -1,194 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PreprocessorParser = void 0;
4
- const TokenKind_1 = require("../lexer/TokenKind");
5
- const CC = require("./Chunk");
6
- const DiagnosticMessages_1 = require("../DiagnosticMessages");
7
- /** * Parses `Tokens` into chunks of tokens, excluding conditional compilation directives. */
8
- class PreprocessorParser {
9
- constructor() {
10
- this.current = 0;
11
- }
12
- /**
13
- * Parses an array of tokens into an array of "chunks" - conditional compilation directives and their
14
- * associated BrightScript.
15
- *
16
- * @param toParse the array of tokens to parse
17
- */
18
- parse(tokens) {
19
- this.tokens = tokens;
20
- this.diagnostics = [];
21
- this.current = 0;
22
- this.chunks = this.nChunks();
23
- return this;
24
- }
25
- static parse(tokens) {
26
- return new PreprocessorParser().parse(tokens);
27
- }
28
- /**
29
- * Parses tokens to produce an array containing a variable number of heterogeneous chunks.
30
- * @returns a heterogeneous array of chunks
31
- */
32
- nChunks() {
33
- let chunks = [];
34
- while (true) {
35
- let c = this.hashConst();
36
- if (c) {
37
- chunks.push(c);
38
- }
39
- let maybeEof = this.eof();
40
- if (maybeEof) {
41
- chunks.push(maybeEof);
42
- break;
43
- }
44
- else if (!c) {
45
- break;
46
- }
47
- }
48
- return chunks;
49
- }
50
- /**
51
- * Parses tokens to produce a "declaration" chunk if possible, otherwise falls back to `hashIf`.
52
- * @returns a "declaration" chunk if one is detected, otherwise whatever `hashIf` returns
53
- */
54
- hashConst() {
55
- if (this.match(TokenKind_1.TokenKind.HashConst)) {
56
- let name = this.consume(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword('#const'), TokenKind_1.TokenKind.Identifier,
57
- //look for any alphanumeric token, we will throw out the bad ones in the next check
58
- ...TokenKind_1.AllowedLocalIdentifiers, ...TokenKind_1.AllowedProperties, ...TokenKind_1.DisallowedLocalIdentifiers);
59
- //disallow using keywords for const names
60
- if (TokenKind_1.ReservedWords.has(name.text.toLowerCase())) {
61
- this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.constNameCannotBeReservedWord()), { range: name.range }));
62
- }
63
- this.consume(DiagnosticMessages_1.DiagnosticMessages.expectedEqualAfterConstName(), TokenKind_1.TokenKind.Equal);
64
- let value = this.advance();
65
- //consume trailing newlines
66
- while (this.match(TokenKind_1.TokenKind.Newline)) { }
67
- return new CC.DeclarationChunk(name, value);
68
- }
69
- return this.hashIf();
70
- }
71
- /**
72
- * Parses tokens to produce an "if" chunk (including "else if" and "else" chunks) if possible,
73
- * otherwise falls back to `hashError`.
74
- * @returns an "if" chunk if one is detected, otherwise whatever `hashError` returns
75
- */
76
- hashIf() {
77
- if (this.match(TokenKind_1.TokenKind.HashIf)) {
78
- let startingLine = this.previous().range.start.line;
79
- let elseChunk;
80
- let ifCondition = this.advance();
81
- this.match(TokenKind_1.TokenKind.Newline);
82
- let thenChunk = this.nChunks();
83
- let elseIfs = [];
84
- while (this.match(TokenKind_1.TokenKind.HashElseIf)) {
85
- let condition = this.advance();
86
- this.match(TokenKind_1.TokenKind.Newline);
87
- elseIfs.push({
88
- condition: condition,
89
- thenChunks: this.nChunks()
90
- });
91
- }
92
- if (this.match(TokenKind_1.TokenKind.HashElse)) {
93
- this.match(TokenKind_1.TokenKind.Newline);
94
- elseChunk = this.nChunks();
95
- }
96
- this.consume(DiagnosticMessages_1.DiagnosticMessages.expectedHashElseIfToCloseHashIf(startingLine), TokenKind_1.TokenKind.HashEndIf);
97
- this.match(TokenKind_1.TokenKind.Newline);
98
- return new CC.HashIfStatement(ifCondition, thenChunk, elseIfs, elseChunk);
99
- }
100
- return this.hashError();
101
- }
102
- /**
103
- * Parses tokens to produce an "error" chunk (including the associated message) if possible,
104
- * otherwise falls back to a chunk of plain BrightScript.
105
- * @returns an "error" chunk if one is detected, otherwise whatever `brightScriptChunk` returns
106
- */
107
- hashError() {
108
- if (this.check(TokenKind_1.TokenKind.HashError)) {
109
- let hashErr = this.advance();
110
- let message = this.advance();
111
- return new CC.ErrorChunk(hashErr, message);
112
- }
113
- return this.brightScriptChunk();
114
- }
115
- /**
116
- * Parses tokens to produce a chunk of BrightScript.
117
- * @returns a chunk of plain BrightScript if any is detected, otherwise `undefined` to indicate
118
- * that no non-conditional compilation directives were found.
119
- */
120
- brightScriptChunk() {
121
- let chunkTokens = [];
122
- while (!this.check(TokenKind_1.TokenKind.HashIf, TokenKind_1.TokenKind.HashElseIf, TokenKind_1.TokenKind.HashElse, TokenKind_1.TokenKind.HashEndIf, TokenKind_1.TokenKind.HashConst, TokenKind_1.TokenKind.HashError)) {
123
- let token = this.advance();
124
- if (token) {
125
- chunkTokens.push(token);
126
- }
127
- if (this.isAtEnd()) {
128
- break;
129
- }
130
- }
131
- if (chunkTokens.length > 0) {
132
- return new CC.BrightScriptChunk(chunkTokens);
133
- }
134
- else {
135
- return undefined;
136
- }
137
- }
138
- eof() {
139
- if (this.isAtEnd()) {
140
- return new CC.BrightScriptChunk([this.peek()]);
141
- }
142
- else {
143
- return undefined;
144
- }
145
- }
146
- /**
147
- * If the next token is any of the provided tokenKinds, advance and return true.
148
- * Otherwise return false
149
- */
150
- match(...tokenKinds) {
151
- for (let tokenKind of tokenKinds) {
152
- if (this.check(tokenKind)) {
153
- this.advance();
154
- return true;
155
- }
156
- }
157
- return false;
158
- }
159
- consume(diagnosticInfo, ...tokenKinds) {
160
- let foundTokenKind = tokenKinds
161
- .map(tokenKind => this.peek().kind === tokenKind)
162
- .reduce((foundAny, foundCurrent) => foundAny || foundCurrent, false);
163
- if (foundTokenKind) {
164
- return this.advance();
165
- }
166
- else {
167
- this.diagnostics.push(Object.assign(Object.assign({}, diagnosticInfo), { range: this.peek().range }));
168
- throw new Error(this.diagnostics[this.diagnostics.length - 1].message);
169
- }
170
- }
171
- advance() {
172
- if (!this.isAtEnd()) {
173
- this.current++;
174
- }
175
- return this.previous();
176
- }
177
- check(...tokenKinds) {
178
- if (this.isAtEnd()) {
179
- return false;
180
- }
181
- return tokenKinds.some(tokenKind => this.peek().kind === tokenKind);
182
- }
183
- isAtEnd() {
184
- return this.peek().kind === TokenKind_1.TokenKind.Eof;
185
- }
186
- peek() {
187
- return this.tokens[this.current];
188
- }
189
- previous() {
190
- return this.tokens[this.current - 1];
191
- }
192
- }
193
- exports.PreprocessorParser = PreprocessorParser;
194
- //# sourceMappingURL=PreprocessorParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PreprocessorParser.js","sourceRoot":"","sources":["../../src/preprocessor/PreprocessorParser.ts"],"names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