xmlui 0.4.0

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 (308) hide show
  1. package/dist/Pdf-DeGhSMXe.mjs +19537 -0
  2. package/dist/Pdf.css +1 -0
  3. package/dist/apiInterceptorWorker-CwuUhYyc.mjs +9229 -0
  4. package/dist/array-USo-Szhp.mjs +12 -0
  5. package/dist/index-C24dkfpd.mjs +1434 -0
  6. package/dist/index-ao27SnVp.mjs +145185 -0
  7. package/dist/index.css +1 -0
  8. package/dist/nivo-bar.es-CWh0ZlxB.mjs +1666 -0
  9. package/dist/nivo-geo.es-BTqNt5Db.mjs +1579 -0
  10. package/dist/nivo-legends.es-BuIxHGSU.mjs +6916 -0
  11. package/dist/nivo-pie.es-BvCBFA0L.mjs +700 -0
  12. package/dist/react-apexcharts.min-DqWuDOyO.mjs +8881 -0
  13. package/dist/scripts/bin/bootstrap.js +11 -0
  14. package/dist/scripts/bin/build.js +256 -0
  15. package/dist/scripts/bin/index.js +88 -0
  16. package/dist/scripts/bin/preview.js +27 -0
  17. package/dist/scripts/bin/start.js +41 -0
  18. package/dist/scripts/bin/vite-ueml-plugin.js +113 -0
  19. package/dist/scripts/bin/viteConfig.js +112 -0
  20. package/dist/scripts/src/abstractions/ActionDefs.js +2 -0
  21. package/dist/scripts/src/abstractions/AppContextDefs.js +2 -0
  22. package/dist/scripts/src/abstractions/BlockScope.js +4 -0
  23. package/dist/scripts/src/abstractions/ComponentDefs.js +2 -0
  24. package/dist/scripts/src/abstractions/ComponentDescriptorDefs.js +2 -0
  25. package/dist/scripts/src/abstractions/ContainerDefs.js +2 -0
  26. package/dist/scripts/src/abstractions/FunctionDefs.js +2 -0
  27. package/dist/scripts/src/abstractions/RendererDefs.js +2 -0
  28. package/dist/scripts/src/abstractions/scripting/ScriptParserError.js +2 -0
  29. package/dist/scripts/src/abstractions/scripting/ScriptingSourceTree.js +2 -0
  30. package/dist/scripts/src/abstractions/scripting/Token.js +110 -0
  31. package/dist/scripts/src/components/App/App.js +253 -0
  32. package/dist/scripts/src/components/App/AppLayoutContext.js +9 -0
  33. package/dist/scripts/src/components/App/AppStateContext.js +9 -0
  34. package/dist/scripts/src/components/App/Sheet.js +89 -0
  35. package/dist/scripts/src/components/AppHeader/AppHeader.js +121 -0
  36. package/dist/scripts/src/components/AppState/AppState.js +29 -0
  37. package/dist/scripts/src/components/Avatar/Avatar.js +81 -0
  38. package/dist/scripts/src/components/Badge/Badge.js +56 -0
  39. package/dist/scripts/src/components/BarChart/BarChart.js +199 -0
  40. package/dist/scripts/src/components/Bookmark/Bookmark.js +11 -0
  41. package/dist/scripts/src/components/Button/Button.js +196 -0
  42. package/dist/scripts/src/components/Card/Card.js +65 -0
  43. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +43 -0
  44. package/dist/scripts/src/components/Chart/Chart.js +158 -0
  45. package/dist/scripts/src/components/Checkbox/Checkbox.js +43 -0
  46. package/dist/scripts/src/components/Combobox/Combobox.js +145 -0
  47. package/dist/scripts/src/components/ComponentProvider.js +357 -0
  48. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +40 -0
  49. package/dist/scripts/src/components/DatePicker/DatePicker.js +196 -0
  50. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +175 -0
  51. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +56 -0
  52. package/dist/scripts/src/components/FileInput/FileInput.js +127 -0
  53. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +106 -0
  54. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +139 -0
  55. package/dist/scripts/src/components/Footer/Footer.js +42 -0
  56. package/dist/scripts/src/components/Form/Form.js +320 -0
  57. package/dist/scripts/src/components/Form/FormContext.js +9 -0
  58. package/dist/scripts/src/components/Form/formActions.js +86 -0
  59. package/dist/scripts/src/components/FormItem/FormItem.js +204 -0
  60. package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
  61. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +39 -0
  62. package/dist/scripts/src/components/FormItem/Validations.js +346 -0
  63. package/dist/scripts/src/components/FormSection/FormSection.js +45 -0
  64. package/dist/scripts/src/components/Heading/Heading.js +206 -0
  65. package/dist/scripts/src/components/HoverCard/HoverCard.js +45 -0
  66. package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
  67. package/dist/scripts/src/components/Icon/Attach.js +10 -0
  68. package/dist/scripts/src/components/Icon/Binding.js +11 -0
  69. package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
  70. package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
  71. package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
  72. package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
  73. package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
  74. package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
  75. package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
  76. package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
  77. package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
  78. package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
  79. package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
  80. package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
  81. package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
  82. package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
  83. package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
  84. package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
  85. package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
  86. package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
  87. package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
  88. package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
  89. package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
  90. package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
  91. package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
  92. package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
  93. package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
  94. package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
  95. package/dist/scripts/src/components/Icon/Icon.js +101 -0
  96. package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
  97. package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
  98. package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
  99. package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
  100. package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
  101. package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
  102. package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
  103. package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
  104. package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
  105. package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
  106. package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
  107. package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
  108. package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
  109. package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
  110. package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
  111. package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
  112. package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
  113. package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
  114. package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
  115. package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
  116. package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
  117. package/dist/scripts/src/components/IconProvider.js +249 -0
  118. package/dist/scripts/src/components/IconRegistryContext.js +307 -0
  119. package/dist/scripts/src/components/Image/Image.js +34 -0
  120. package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
  121. package/dist/scripts/src/components/Input/input-abstractions.js +44 -0
  122. package/dist/scripts/src/components/Items/Items.js +48 -0
  123. package/dist/scripts/src/components/Link/Link.js +72 -0
  124. package/dist/scripts/src/components/List/List.js +442 -0
  125. package/dist/scripts/src/components/Logo/Logo.js +25 -0
  126. package/dist/scripts/src/components/Map/Map.js +60 -0
  127. package/dist/scripts/src/components/Map/world_countries.json +45307 -0
  128. package/dist/scripts/src/components/Markdown/Markdown.js +120 -0
  129. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +106 -0
  130. package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
  131. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +145 -0
  132. package/dist/scripts/src/components/MultiCombobox/MultiCombobox.js +249 -0
  133. package/dist/scripts/src/components/MultiSelect/MultiSelect.js +192 -0
  134. package/dist/scripts/src/components/NavGroup/NavGroup.js +113 -0
  135. package/dist/scripts/src/components/NavLink/NavLink.js +115 -0
  136. package/dist/scripts/src/components/NavPanel/NavPanel.js +101 -0
  137. package/dist/scripts/src/components/NoResult/NoResult.js +39 -0
  138. package/dist/scripts/src/components/NumberBox/NumberBox.js +373 -0
  139. package/dist/scripts/src/components/Option/Option.js +41 -0
  140. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +22 -0
  141. package/dist/scripts/src/components/Pages/Pages.js +74 -0
  142. package/dist/scripts/src/components/Pdf/LazyPdf.js +44 -0
  143. package/dist/scripts/src/components/Pdf/Pdf.js +19 -0
  144. package/dist/scripts/src/components/PieChart/PieChart.js +184 -0
  145. package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +29 -0
  146. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +38 -0
  147. package/dist/scripts/src/components/Queue/Queue.js +286 -0
  148. package/dist/scripts/src/components/Queue/queueActions.js +87 -0
  149. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +144 -0
  150. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +147 -0
  151. package/dist/scripts/src/components/Redirect/Redirect.js +10 -0
  152. package/dist/scripts/src/components/Select/Select.js +139 -0
  153. package/dist/scripts/src/components/Select/SelectContext.js +45 -0
  154. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +88 -0
  155. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +22 -0
  156. package/dist/scripts/src/components/Spinner/Spinner.js +59 -0
  157. package/dist/scripts/src/components/Splitter/Splitter.js +205 -0
  158. package/dist/scripts/src/components/Splitter/utils.js +17 -0
  159. package/dist/scripts/src/components/Stack/Stack.js +117 -0
  160. package/dist/scripts/src/components/StickyBox/StickyBox.js +33 -0
  161. package/dist/scripts/src/components/Switch/Switch.js +50 -0
  162. package/dist/scripts/src/components/Table/Table.js +499 -0
  163. package/dist/scripts/src/components/Table/useRowSelection.js +169 -0
  164. package/dist/scripts/src/components/TableColumnDef/TableColumnDef.js +44 -0
  165. package/dist/scripts/src/components/TableColumnDef/TableContext.js +12 -0
  166. package/dist/scripts/src/components/Tabs/Tabs.js +85 -0
  167. package/dist/scripts/src/components/Text/Text.js +175 -0
  168. package/dist/scripts/src/components/TextArea/TextArea.js +194 -0
  169. package/dist/scripts/src/components/TextArea/TextAreaResizable.js +63 -0
  170. package/dist/scripts/src/components/TextArea/useComposedRef.js +50 -0
  171. package/dist/scripts/src/components/TextBox/TextBox.js +145 -0
  172. package/dist/scripts/src/components/Theme/NotificationToast.js +39 -0
  173. package/dist/scripts/src/components/Theme/Theme.js +153 -0
  174. package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +125 -0
  175. package/dist/scripts/src/components/Toggle/Toggle.js +88 -0
  176. package/dist/scripts/src/components/Tree/TreeComponent.js +79 -0
  177. package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
  178. package/dist/scripts/src/components/ViewComponentRegistryContext.js +34 -0
  179. package/dist/scripts/src/components/abstractions.js +2 -0
  180. package/dist/scripts/src/components/chart-color-schemes.js +43 -0
  181. package/dist/scripts/src/components/component-utils.js +32 -0
  182. package/dist/scripts/src/components/container-helpers.js +18 -0
  183. package/dist/scripts/src/components-core/ApiBoundComponent.js +189 -0
  184. package/dist/scripts/src/components-core/AppContext.js +17 -0
  185. package/dist/scripts/src/components-core/ChildrenSlot.js +10 -0
  186. package/dist/scripts/src/components-core/Component.js +280 -0
  187. package/dist/scripts/src/components-core/ComponentDecorator.js +63 -0
  188. package/dist/scripts/src/components-core/CompoundComponent.js +132 -0
  189. package/dist/scripts/src/components-core/EngineError.js +91 -0
  190. package/dist/scripts/src/components-core/ErrorBoundary.js +58 -0
  191. package/dist/scripts/src/components-core/Fragment.js +14 -0
  192. package/dist/scripts/src/components-core/InvalidComponent.js +15 -0
  193. package/dist/scripts/src/components-core/LoaderComponent.js +78 -0
  194. package/dist/scripts/src/components-core/RestApiProxy.js +341 -0
  195. package/dist/scripts/src/components-core/RootComponent.js +272 -0
  196. package/dist/scripts/src/components-core/RouteContext.js +45 -0
  197. package/dist/scripts/src/components-core/ScrollContext.js +9 -0
  198. package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
  199. package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
  200. package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
  201. package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
  202. package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
  203. package/dist/scripts/src/components-core/action/ApiAction.js +276 -0
  204. package/dist/scripts/src/components-core/action/DownloadFileAction.js +80 -0
  205. package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
  206. package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
  207. package/dist/scripts/src/components-core/action/UploadAction.js +88 -0
  208. package/dist/scripts/src/components-core/action/actions.js +15 -0
  209. package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
  210. package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
  211. package/dist/scripts/src/components-core/component-hooks.js +25 -0
  212. package/dist/scripts/src/components-core/constants.js +18 -0
  213. package/dist/scripts/src/components-core/container/Container.js +1110 -0
  214. package/dist/scripts/src/components-core/container/ContainerComponentDef.js +16 -0
  215. package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
  216. package/dist/scripts/src/components-core/container/collectFnVarDeps.js +26 -0
  217. package/dist/scripts/src/components-core/container/valueExtractor.js +195 -0
  218. package/dist/scripts/src/components-core/descriptorHelper.js +75 -0
  219. package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
  220. package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
  221. package/dist/scripts/src/components-core/loader/ApiLoader.js +46 -0
  222. package/dist/scripts/src/components-core/loader/DataLoader.js +160 -0
  223. package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +52 -0
  224. package/dist/scripts/src/components-core/loader/Loader.js +115 -0
  225. package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +32 -0
  226. package/dist/scripts/src/components-core/loader/PageableLoader.js +240 -0
  227. package/dist/scripts/src/components-core/renderers.js +45 -0
  228. package/dist/scripts/src/components-core/reportEngineError.js +59 -0
  229. package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
  230. package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
  231. package/dist/scripts/src/components-core/script-runner/LogicalThread.js +2 -0
  232. package/dist/scripts/src/components-core/script-runner/LoopScope.js +2 -0
  233. package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
  234. package/dist/scripts/src/components-core/script-runner/TryScope.js +2 -0
  235. package/dist/scripts/src/components-core/script-runner/asyncProxy.js +96 -0
  236. package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
  237. package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
  238. package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
  239. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +551 -0
  240. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +498 -0
  241. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +434 -0
  242. package/dist/scripts/src/components-core/script-runner/modules.js +250 -0
  243. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +818 -0
  244. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
  245. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +740 -0
  246. package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
  247. package/dist/scripts/src/components-core/script-runner/visitors.js +352 -0
  248. package/dist/scripts/src/components-core/theming/ThemeContext.js +43 -0
  249. package/dist/scripts/src/components-core/theming/ThemeProvider.js +334 -0
  250. package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
  251. package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
  252. package/dist/scripts/src/components-core/theming/hvar.js +105 -0
  253. package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
  254. package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
  255. package/dist/scripts/src/components-core/theming/themes/palette.js +53 -0
  256. package/dist/scripts/src/components-core/theming/themes/root.js +257 -0
  257. package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
  258. package/dist/scripts/src/components-core/theming/themes/theme-colors.js +407 -0
  259. package/dist/scripts/src/components-core/theming/themes/xmlui.js +32 -0
  260. package/dist/scripts/src/components-core/theming/transformThemeVars.js +286 -0
  261. package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +34 -0
  262. package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
  263. package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
  264. package/dist/scripts/src/components-core/utils/classnames.js +58 -0
  265. package/dist/scripts/src/components-core/utils/css-utils.js +127 -0
  266. package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
  267. package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
  268. package/dist/scripts/src/components-core/utils/hooks.js +221 -0
  269. package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
  270. package/dist/scripts/src/components-core/utils/misc.js +460 -0
  271. package/dist/scripts/src/components-core/utils/statementUtils.js +205 -0
  272. package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
  273. package/dist/scripts/src/components-core/xmlui-parser.js +52 -0
  274. package/dist/scripts/src/parsers/scripting/InputStream.js +59 -0
  275. package/dist/scripts/src/parsers/scripting/Lexer.js +1028 -0
  276. package/dist/scripts/src/parsers/scripting/Parser.js +2647 -0
  277. package/dist/scripts/src/parsers/scripting/ParserError.js +46 -0
  278. package/dist/scripts/src/parsers/scripting/TokenTrait.js +109 -0
  279. package/dist/scripts/src/parsers/scripting/code-behind-collect.js +118 -0
  280. package/dist/scripts/src/parsers/scripting/tree-visitor.js +602 -0
  281. package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
  282. package/dist/scripts/src/parsers/style-parser/StyleLexer.js +621 -0
  283. package/dist/scripts/src/parsers/style-parser/StyleParser.js +1000 -0
  284. package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
  285. package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
  286. package/dist/scripts/src/parsers/style-parser/style-compiler.js +513 -0
  287. package/dist/scripts/src/parsers/style-parser/tokens.js +42 -0
  288. package/dist/scripts/src/parsers/ueml/ParserError.js +54 -0
  289. package/dist/scripts/src/parsers/ueml/UemlHelper.js +579 -0
  290. package/dist/scripts/src/parsers/ueml/UemlInputStream.js +59 -0
  291. package/dist/scripts/src/parsers/ueml/UemlLexer.js +868 -0
  292. package/dist/scripts/src/parsers/ueml/UemlParser.js +1439 -0
  293. package/dist/scripts/src/parsers/ueml/UemlToken.js +24 -0
  294. package/dist/scripts/src/parsers/ueml/fileExtensions.js +6 -0
  295. package/dist/scripts/src/parsers/ueml/source-tree.js +2 -0
  296. package/dist/scripts/src/parsers/ueml/ueml-tree.js +2 -0
  297. package/dist/scripts/src/parsers/xmlui-parser/CharacterCodes.js +136 -0
  298. package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +100 -0
  299. package/dist/scripts/src/parsers/xmlui-parser/parser.js +476 -0
  300. package/dist/scripts/src/parsers/xmlui-parser/scanner.js +415 -0
  301. package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +106 -0
  302. package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +2 -0
  303. package/dist/scripts/src/parsers/xmlui-parser/transform.js +922 -0
  304. package/dist/scripts/src/parsers/xmlui-parser/utils.js +83 -0
  305. package/dist/xmlui.es.d.ts +1667 -0
  306. package/dist/xmlui.es.js +17 -0
  307. package/dist/xmlui.umd.js +1589 -0
  308. package/package.json +175 -0
@@ -0,0 +1,1028 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Lexer = void 0;
4
+ const regexpp_1 = require("@eslint-community/regexpp");
5
+ const Token_1 = require("../../abstractions/scripting/Token");
6
+ /**
7
+ * This enum indicates the current lexer phase
8
+ */
9
+ var LexerPhase;
10
+ (function (LexerPhase) {
11
+ // Start getting a token
12
+ LexerPhase[LexerPhase["Start"] = 0] = "Start";
13
+ // Collecting whitespace
14
+ LexerPhase[LexerPhase["InWhiteSpace"] = 1] = "InWhiteSpace";
15
+ // Comment phases
16
+ LexerPhase[LexerPhase["InlineCommentTrail"] = 2] = "InlineCommentTrail";
17
+ LexerPhase[LexerPhase["BlockCommentTrail1"] = 3] = "BlockCommentTrail1";
18
+ LexerPhase[LexerPhase["BlockCommentTrail2"] = 4] = "BlockCommentTrail2";
19
+ // Multi-char tokens
20
+ LexerPhase[LexerPhase["Slash"] = 5] = "Slash";
21
+ LexerPhase[LexerPhase["Or"] = 6] = "Or";
22
+ LexerPhase[LexerPhase["Asterisk"] = 7] = "Asterisk";
23
+ LexerPhase[LexerPhase["Ampersand"] = 8] = "Ampersand";
24
+ LexerPhase[LexerPhase["Equal"] = 9] = "Equal";
25
+ LexerPhase[LexerPhase["DoubleEqual"] = 10] = "DoubleEqual";
26
+ LexerPhase[LexerPhase["NotEqual"] = 11] = "NotEqual";
27
+ LexerPhase[LexerPhase["Exclamation"] = 12] = "Exclamation";
28
+ LexerPhase[LexerPhase["AngleLeft"] = 13] = "AngleLeft";
29
+ LexerPhase[LexerPhase["AngleRight"] = 14] = "AngleRight";
30
+ LexerPhase[LexerPhase["SignedShiftRight"] = 15] = "SignedShiftRight";
31
+ LexerPhase[LexerPhase["IdTail"] = 16] = "IdTail";
32
+ LexerPhase[LexerPhase["Dot"] = 17] = "Dot";
33
+ LexerPhase[LexerPhase["DotDot"] = 18] = "DotDot";
34
+ LexerPhase[LexerPhase["Colon"] = 19] = "Colon";
35
+ LexerPhase[LexerPhase["Zero"] = 20] = "Zero";
36
+ LexerPhase[LexerPhase["QuestionMark"] = 21] = "QuestionMark";
37
+ LexerPhase[LexerPhase["HexaFirst"] = 22] = "HexaFirst";
38
+ LexerPhase[LexerPhase["HexaTail"] = 23] = "HexaTail";
39
+ LexerPhase[LexerPhase["BinaryFirst"] = 24] = "BinaryFirst";
40
+ LexerPhase[LexerPhase["BinaryTail"] = 25] = "BinaryTail";
41
+ LexerPhase[LexerPhase["DecimalOrReal"] = 26] = "DecimalOrReal";
42
+ LexerPhase[LexerPhase["RealFractionalFirst"] = 27] = "RealFractionalFirst";
43
+ LexerPhase[LexerPhase["RealFractionalTail"] = 28] = "RealFractionalTail";
44
+ LexerPhase[LexerPhase["RealExponent"] = 29] = "RealExponent";
45
+ LexerPhase[LexerPhase["RealExponentSign"] = 30] = "RealExponentSign";
46
+ LexerPhase[LexerPhase["RealExponentTail"] = 31] = "RealExponentTail";
47
+ LexerPhase[LexerPhase["String"] = 32] = "String";
48
+ LexerPhase[LexerPhase["StringBackSlash"] = 33] = "StringBackSlash";
49
+ LexerPhase[LexerPhase["StringHexa1"] = 34] = "StringHexa1";
50
+ LexerPhase[LexerPhase["StringHexa2"] = 35] = "StringHexa2";
51
+ LexerPhase[LexerPhase["StringUHexa1"] = 36] = "StringUHexa1";
52
+ LexerPhase[LexerPhase["StringUHexa2"] = 37] = "StringUHexa2";
53
+ LexerPhase[LexerPhase["StringUHexa3"] = 38] = "StringUHexa3";
54
+ LexerPhase[LexerPhase["StringUHexa4"] = 39] = "StringUHexa4";
55
+ LexerPhase[LexerPhase["StringUcp1"] = 40] = "StringUcp1";
56
+ LexerPhase[LexerPhase["StringUcp2"] = 41] = "StringUcp2";
57
+ LexerPhase[LexerPhase["StringUcp3"] = 42] = "StringUcp3";
58
+ LexerPhase[LexerPhase["StringUcp4"] = 43] = "StringUcp4";
59
+ LexerPhase[LexerPhase["StringUcp5"] = 44] = "StringUcp5";
60
+ LexerPhase[LexerPhase["StringUcp6"] = 45] = "StringUcp6";
61
+ LexerPhase[LexerPhase["StringUcpTail"] = 46] = "StringUcpTail";
62
+ // --- Assignments
63
+ LexerPhase[LexerPhase["Exponent"] = 47] = "Exponent";
64
+ LexerPhase[LexerPhase["Plus"] = 48] = "Plus";
65
+ LexerPhase[LexerPhase["Minus"] = 49] = "Minus";
66
+ LexerPhase[LexerPhase["Divide"] = 50] = "Divide";
67
+ LexerPhase[LexerPhase["Remainder"] = 51] = "Remainder";
68
+ LexerPhase[LexerPhase["ShiftLeft"] = 52] = "ShiftLeft";
69
+ LexerPhase[LexerPhase["ShiftRight"] = 53] = "ShiftRight";
70
+ LexerPhase[LexerPhase["LogicalAnd"] = 54] = "LogicalAnd";
71
+ LexerPhase[LexerPhase["BitwiseXor"] = 55] = "BitwiseXor";
72
+ LexerPhase[LexerPhase["LogicalOr"] = 56] = "LogicalOr";
73
+ LexerPhase[LexerPhase["NullCoalesce"] = 57] = "NullCoalesce";
74
+ // --- Other
75
+ LexerPhase[LexerPhase["RegEx"] = 58] = "RegEx";
76
+ })(LexerPhase || (LexerPhase = {}));
77
+ /**
78
+ * This class implements the lexer of binding expressions
79
+ */
80
+ class Lexer {
81
+ /**
82
+ * Initializes the tokenizer with the input stream
83
+ * @param input Input source code stream
84
+ */
85
+ constructor(input) {
86
+ this.input = input;
87
+ // --- Already fetched tokens
88
+ this._ahead = [];
89
+ // --- Prefetched character (from the next token)
90
+ this._prefetched = null;
91
+ // --- Prefetched character position (from the next token)
92
+ this._prefetchedPos = null;
93
+ // --- Prefetched character column (from the next token)
94
+ this._prefetchedColumn = null;
95
+ // --- input position at the beginning of last fetch
96
+ this._lastFetchPosition = 0;
97
+ }
98
+ /**
99
+ * Fetches the next token without advancing to its position
100
+ * @param ws If true, retrieve whitespaces too
101
+ */
102
+ peek(ws = false) {
103
+ return this.ahead(0, ws);
104
+ }
105
+ /**
106
+ * Reads tokens ahead
107
+ * @param n Number of token positions to read ahead
108
+ * @param ws If true, retrieve whitespaces too
109
+ */
110
+ ahead(n = 1, ws = false) {
111
+ if (n > 16) {
112
+ throw new Error("Cannot look ahead more than 16 tokens");
113
+ }
114
+ // --- Prefetch missing tokens
115
+ while (this._ahead.length <= n) {
116
+ const token = this.fetch();
117
+ if (isEof(token)) {
118
+ return token;
119
+ }
120
+ if (ws || (!ws && !isWs(token))) {
121
+ this._ahead.push(token);
122
+ }
123
+ }
124
+ return this._ahead[n];
125
+ }
126
+ /**
127
+ * Fetches the next token and advances the stream position
128
+ * @param ws If true, retrieve whitespaces too
129
+ */
130
+ get(ws = false) {
131
+ if (this._ahead.length > 0) {
132
+ const token = this._ahead.shift();
133
+ if (!token) {
134
+ throw new Error("Token expected");
135
+ }
136
+ return token;
137
+ }
138
+ while (true) {
139
+ const token = this.fetch();
140
+ if (isEof(token) || ws || (!ws && !isWs(token))) {
141
+ return token;
142
+ }
143
+ }
144
+ }
145
+ /**
146
+ * Gets a RegEx from the current position
147
+ */
148
+ getRegEx() {
149
+ return this.fetchRegEx();
150
+ }
151
+ /**
152
+ * Gets the remaining characters after the parsing phase
153
+ */
154
+ getTail() {
155
+ return this._ahead.length > 0
156
+ ? this.input.getTail(this._ahead[0].location.startPosition)
157
+ : this.input.getTail(this._lastFetchPosition);
158
+ }
159
+ /**
160
+ * Fetches the next character from the input stream
161
+ */
162
+ fetchNextChar() {
163
+ if (!this._prefetched) {
164
+ this._prefetchedPos = this.input.position;
165
+ this._prefetchedColumn = this.input.column;
166
+ this._prefetched = this.input.get();
167
+ }
168
+ return this._prefetched;
169
+ }
170
+ /**
171
+ * Fetches the next token from the input stream
172
+ */
173
+ fetch() {
174
+ // --- Captured constants used in nested functions
175
+ const lexer = this;
176
+ const input = this.input;
177
+ const startPos = this._prefetchedPos || input.position;
178
+ const line = input.line;
179
+ const startColumn = this._prefetchedColumn || input.column;
180
+ this._lastFetchPosition = this.input.position;
181
+ // --- State variables
182
+ let stringState = null;
183
+ let text = "";
184
+ let tokenType = Token_1.TokenType.Eof;
185
+ let lastEndPos = input.position;
186
+ let lastEndColumn = input.column;
187
+ let ch = null;
188
+ let useResolver = false;
189
+ // --- Start from the beginning
190
+ let phase = LexerPhase.Start;
191
+ // --- Process all token characters
192
+ while (true) {
193
+ // --- Get the next character
194
+ ch = this.fetchNextChar();
195
+ // --- In case of EOF, return the current token data
196
+ if (ch === null) {
197
+ return makeToken();
198
+ }
199
+ // --- Set the initial token type to unknown for the other characters
200
+ if (tokenType === Token_1.TokenType.Eof) {
201
+ tokenType = Token_1.TokenType.Unknown;
202
+ }
203
+ // --- Follow the lexer state machine
204
+ switch (phase) {
205
+ // ====================================================================
206
+ // Process the first character
207
+ case LexerPhase.Start:
208
+ switch (ch) {
209
+ // --- Go on with whitespaces
210
+ case " ":
211
+ case "\t":
212
+ case "\n":
213
+ case "\r":
214
+ phase = LexerPhase.InWhiteSpace;
215
+ tokenType = Token_1.TokenType.Ws;
216
+ break;
217
+ // --- Divide, BlockComment, or EolComment
218
+ case "/":
219
+ phase = LexerPhase.Slash;
220
+ tokenType = Token_1.TokenType.Divide;
221
+ break;
222
+ case "*":
223
+ phase = LexerPhase.Asterisk;
224
+ tokenType = Token_1.TokenType.Multiply;
225
+ break;
226
+ case "%":
227
+ phase = LexerPhase.Remainder;
228
+ tokenType = Token_1.TokenType.Remainder;
229
+ break;
230
+ case "+":
231
+ phase = LexerPhase.Plus;
232
+ tokenType = Token_1.TokenType.Plus;
233
+ break;
234
+ case "-":
235
+ phase = LexerPhase.Minus;
236
+ tokenType = Token_1.TokenType.Minus;
237
+ break;
238
+ case "^":
239
+ phase = LexerPhase.BitwiseXor;
240
+ tokenType = Token_1.TokenType.BitwiseXor;
241
+ break;
242
+ // --- BitwiseOr, LogicalOr
243
+ case "|":
244
+ phase = LexerPhase.Or;
245
+ tokenType = Token_1.TokenType.BitwiseOr;
246
+ break;
247
+ // --- BitwiseAnd, LogicalAnd
248
+ case "&":
249
+ phase = LexerPhase.Ampersand;
250
+ tokenType = Token_1.TokenType.BitwiseAnd;
251
+ break;
252
+ // --- "?", "?", or "?."
253
+ case "?":
254
+ phase = LexerPhase.QuestionMark;
255
+ tokenType = Token_1.TokenType.QuestionMark;
256
+ break;
257
+ case ";":
258
+ return completeToken(Token_1.TokenType.Semicolon);
259
+ case ",":
260
+ return completeToken(Token_1.TokenType.Comma);
261
+ case "(":
262
+ return completeToken(Token_1.TokenType.LParent);
263
+ case ")":
264
+ return completeToken(Token_1.TokenType.RParent);
265
+ // --- ":" or "::"
266
+ case ":":
267
+ phase = LexerPhase.Colon;
268
+ tokenType = Token_1.TokenType.Colon;
269
+ break;
270
+ case "[":
271
+ return completeToken(Token_1.TokenType.LSquare);
272
+ case "]":
273
+ return completeToken(Token_1.TokenType.RSquare);
274
+ case "~":
275
+ return completeToken(Token_1.TokenType.BinaryNot);
276
+ case "{":
277
+ return completeToken(Token_1.TokenType.LBrace);
278
+ case "}":
279
+ return completeToken(Token_1.TokenType.RBrace);
280
+ // --- "=","==", "===", or "=>"
281
+ case "=":
282
+ phase = LexerPhase.Equal;
283
+ tokenType = Token_1.TokenType.Assignment;
284
+ break;
285
+ // --- "!", "!=", or "!=="
286
+ case "!":
287
+ phase = LexerPhase.Exclamation;
288
+ tokenType = Token_1.TokenType.LogicalNot;
289
+ break;
290
+ // --- "<", "<=", or "<<"
291
+ case "<":
292
+ phase = LexerPhase.AngleLeft;
293
+ tokenType = Token_1.TokenType.LessThan;
294
+ break;
295
+ // --- ">", ">=", ">>", or ">>>"
296
+ case ">":
297
+ phase = LexerPhase.AngleRight;
298
+ tokenType = Token_1.TokenType.GreaterThan;
299
+ break;
300
+ // --- Decimal or Real literal
301
+ case "0":
302
+ phase = LexerPhase.Zero;
303
+ tokenType = Token_1.TokenType.DecimalLiteral;
304
+ break;
305
+ case ".":
306
+ phase = LexerPhase.Dot;
307
+ tokenType = Token_1.TokenType.Dot;
308
+ break;
309
+ // --- String (both " and ' are accepted as string wrappers
310
+ case '"':
311
+ case "'":
312
+ stringState = ch;
313
+ phase = LexerPhase.String;
314
+ break;
315
+ default:
316
+ if (isIdStart(ch)) {
317
+ useResolver = true;
318
+ phase = LexerPhase.IdTail;
319
+ tokenType = Token_1.TokenType.Identifier;
320
+ }
321
+ else if (isDecimalDigit(ch)) {
322
+ phase = LexerPhase.DecimalOrReal;
323
+ tokenType = Token_1.TokenType.DecimalLiteral;
324
+ }
325
+ else {
326
+ completeToken(Token_1.TokenType.Unknown);
327
+ }
328
+ break;
329
+ }
330
+ break;
331
+ // ====================================================================
332
+ // Process comments
333
+ // --- Looking for the end of whitespace
334
+ case LexerPhase.InWhiteSpace:
335
+ if (ch !== " " && ch !== "\t" && ch !== "\r" && ch !== "\n") {
336
+ return makeToken();
337
+ }
338
+ break;
339
+ // --- Wait for an "*" that may complete a block comment
340
+ case LexerPhase.BlockCommentTrail1:
341
+ if (ch === "*") {
342
+ phase = LexerPhase.BlockCommentTrail2;
343
+ }
344
+ break;
345
+ // --- Wait for a "/" that may complete a block comment
346
+ case LexerPhase.BlockCommentTrail2:
347
+ if (ch === "/") {
348
+ return completeToken(Token_1.TokenType.BlockComment);
349
+ }
350
+ break;
351
+ case LexerPhase.InlineCommentTrail:
352
+ if (ch === "\n") {
353
+ return completeToken();
354
+ }
355
+ break;
356
+ // ====================================================================
357
+ // Process identifiers
358
+ case LexerPhase.IdTail:
359
+ if (!isIdContinuation(ch)) {
360
+ return makeToken();
361
+ }
362
+ break;
363
+ // ====================================================================
364
+ // Process miscellaneous tokens
365
+ case LexerPhase.Colon:
366
+ return ch === ":" ? completeToken(Token_1.TokenType.Global) : makeToken();
367
+ case LexerPhase.Slash:
368
+ if (ch === "*") {
369
+ phase = LexerPhase.BlockCommentTrail1;
370
+ }
371
+ else if (ch === "/") {
372
+ phase = LexerPhase.InlineCommentTrail;
373
+ tokenType = Token_1.TokenType.EolComment;
374
+ }
375
+ else if (ch === "=") {
376
+ return completeToken(Token_1.TokenType.DivideAssignment);
377
+ }
378
+ else {
379
+ return makeToken();
380
+ }
381
+ break;
382
+ case LexerPhase.Plus:
383
+ if (ch === "+") {
384
+ return completeToken(Token_1.TokenType.IncOp);
385
+ }
386
+ return ch === "=" ? completeToken(Token_1.TokenType.AddAssignment) : makeToken();
387
+ case LexerPhase.Minus:
388
+ if (ch === "-") {
389
+ return completeToken(Token_1.TokenType.DecOp);
390
+ }
391
+ return ch === "=" ? completeToken(Token_1.TokenType.SubtractAssignment) : makeToken();
392
+ case LexerPhase.Remainder:
393
+ return ch === "=" ? completeToken(Token_1.TokenType.RemainderAssignment) : makeToken();
394
+ case LexerPhase.BitwiseXor:
395
+ return ch === "=" ? completeToken(Token_1.TokenType.BitwiseXorAssignment) : makeToken();
396
+ case LexerPhase.Or:
397
+ if (ch === "=") {
398
+ return completeToken(Token_1.TokenType.BitwiseOrAssignment);
399
+ }
400
+ if (ch === "|") {
401
+ phase = LexerPhase.LogicalOr;
402
+ tokenType = Token_1.TokenType.LogicalOr;
403
+ break;
404
+ }
405
+ return makeToken();
406
+ case LexerPhase.LogicalOr:
407
+ return ch === "=" ? completeToken(Token_1.TokenType.LogicalOrAssignment) : makeToken();
408
+ case LexerPhase.Ampersand:
409
+ if (ch === "=") {
410
+ return completeToken(Token_1.TokenType.BitwiseAndAssignment);
411
+ }
412
+ if (ch === "&") {
413
+ phase = LexerPhase.LogicalAnd;
414
+ tokenType = Token_1.TokenType.LogicalAnd;
415
+ break;
416
+ }
417
+ return makeToken();
418
+ case LexerPhase.LogicalAnd:
419
+ return ch === "=" ? completeToken(Token_1.TokenType.LogicalAndAssignment) : makeToken();
420
+ case LexerPhase.Asterisk:
421
+ if (ch === "*") {
422
+ phase = LexerPhase.Exponent;
423
+ tokenType = Token_1.TokenType.Exponent;
424
+ break;
425
+ }
426
+ else if (ch === "=") {
427
+ return completeToken(Token_1.TokenType.MultiplyAssignment);
428
+ }
429
+ return makeToken();
430
+ case LexerPhase.Exponent:
431
+ return ch === "=" ? completeToken(Token_1.TokenType.ExponentAssignment) : makeToken();
432
+ case LexerPhase.QuestionMark:
433
+ if (ch === "?") {
434
+ phase = LexerPhase.NullCoalesce;
435
+ tokenType = Token_1.TokenType.NullCoalesce;
436
+ break;
437
+ }
438
+ if (ch === ".") {
439
+ return completeToken(Token_1.TokenType.OptionalChaining);
440
+ }
441
+ return makeToken();
442
+ case LexerPhase.NullCoalesce:
443
+ return ch === "=" ? completeToken(Token_1.TokenType.NullCoalesceAssignment) : makeToken();
444
+ case LexerPhase.Equal:
445
+ if (ch === ">") {
446
+ return completeToken(Token_1.TokenType.Arrow);
447
+ }
448
+ if (ch === "=") {
449
+ phase = LexerPhase.DoubleEqual;
450
+ tokenType = Token_1.TokenType.Equal;
451
+ break;
452
+ }
453
+ return makeToken();
454
+ case LexerPhase.DoubleEqual:
455
+ return ch === "=" ? completeToken(Token_1.TokenType.StrictEqual) : makeToken();
456
+ case LexerPhase.Exclamation:
457
+ if (ch === "=") {
458
+ phase = LexerPhase.NotEqual;
459
+ tokenType = Token_1.TokenType.NotEqual;
460
+ break;
461
+ }
462
+ return makeToken();
463
+ case LexerPhase.NotEqual:
464
+ return ch === "=" ? completeToken(Token_1.TokenType.StrictNotEqual) : makeToken();
465
+ case LexerPhase.AngleLeft:
466
+ if (ch === "=") {
467
+ return completeToken(Token_1.TokenType.LessThanOrEqual);
468
+ }
469
+ if (ch === "<") {
470
+ phase = LexerPhase.ShiftLeft;
471
+ tokenType = Token_1.TokenType.ShiftLeft;
472
+ break;
473
+ }
474
+ return makeToken();
475
+ case LexerPhase.ShiftLeft:
476
+ return ch === "=" ? completeToken(Token_1.TokenType.ShiftLeftAssignment) : makeToken();
477
+ case LexerPhase.AngleRight:
478
+ if (ch === "=") {
479
+ return completeToken(Token_1.TokenType.GreaterThanOrEqual);
480
+ }
481
+ if (ch === ">") {
482
+ phase = LexerPhase.SignedShiftRight;
483
+ tokenType = Token_1.TokenType.SignedShiftRight;
484
+ break;
485
+ }
486
+ return makeToken();
487
+ case LexerPhase.SignedShiftRight:
488
+ if (ch === ">") {
489
+ phase = LexerPhase.ShiftRight;
490
+ tokenType = Token_1.TokenType.ShiftRight;
491
+ break;
492
+ }
493
+ if (ch === "=") {
494
+ return completeToken(Token_1.TokenType.SignedShiftRightAssignment);
495
+ }
496
+ return makeToken();
497
+ case LexerPhase.ShiftRight:
498
+ return ch === "=" ? completeToken(Token_1.TokenType.ShiftRightAssignment) : makeToken();
499
+ // ====================================================================
500
+ // --- Literals
501
+ case LexerPhase.Zero:
502
+ if (ch === "x") {
503
+ phase = LexerPhase.HexaFirst;
504
+ tokenType = Token_1.TokenType.Unknown;
505
+ }
506
+ else if (ch === "b") {
507
+ phase = LexerPhase.BinaryFirst;
508
+ tokenType = Token_1.TokenType.Unknown;
509
+ }
510
+ else if (isDecimalDigit(ch) || ch === "_") {
511
+ phase = LexerPhase.DecimalOrReal;
512
+ }
513
+ else if (ch === ".") {
514
+ phase = LexerPhase.RealFractionalFirst;
515
+ tokenType = Token_1.TokenType.Unknown;
516
+ }
517
+ else if (ch === "e" || ch === "E") {
518
+ phase = LexerPhase.RealExponent;
519
+ tokenType = Token_1.TokenType.Unknown;
520
+ }
521
+ else {
522
+ return makeToken();
523
+ }
524
+ break;
525
+ case LexerPhase.Dot:
526
+ if (ch === ".") {
527
+ phase = LexerPhase.DotDot;
528
+ tokenType = Token_1.TokenType.Unknown;
529
+ break;
530
+ }
531
+ if (!isDecimalDigit(ch)) {
532
+ return makeToken();
533
+ }
534
+ phase = LexerPhase.RealFractionalTail;
535
+ tokenType = Token_1.TokenType.RealLiteral;
536
+ break;
537
+ case LexerPhase.DotDot:
538
+ return ch === "." ? completeToken(Token_1.TokenType.Spread) : makeToken();
539
+ case LexerPhase.HexaFirst:
540
+ if (ch === "_") {
541
+ break;
542
+ }
543
+ if (!isHexadecimalDigit(ch)) {
544
+ return makeToken();
545
+ }
546
+ phase = LexerPhase.HexaTail;
547
+ tokenType = Token_1.TokenType.HexadecimalLiteral;
548
+ break;
549
+ case LexerPhase.HexaTail:
550
+ if (!isHexadecimalDigit(ch) && ch !== "_") {
551
+ return makeToken();
552
+ }
553
+ break;
554
+ case LexerPhase.BinaryFirst:
555
+ if (ch === "_") {
556
+ break;
557
+ }
558
+ if (!isBinaryDigit(ch)) {
559
+ return makeToken();
560
+ }
561
+ phase = LexerPhase.BinaryTail;
562
+ tokenType = Token_1.TokenType.BinaryLiteral;
563
+ break;
564
+ case LexerPhase.BinaryTail:
565
+ if (!isBinaryDigit(ch) && ch !== "_") {
566
+ return makeToken();
567
+ }
568
+ tokenType = Token_1.TokenType.BinaryLiteral;
569
+ break;
570
+ case LexerPhase.DecimalOrReal:
571
+ if (isDecimalDigit(ch) || ch === "_") {
572
+ break;
573
+ }
574
+ else if (ch === "." && (this.input.peek() === null || isDecimalDigit(this.input.peek()))) {
575
+ phase = LexerPhase.RealFractionalFirst;
576
+ tokenType = Token_1.TokenType.Unknown;
577
+ }
578
+ else if (ch === "e" || ch === "E") {
579
+ phase = LexerPhase.RealExponent;
580
+ tokenType = Token_1.TokenType.Unknown;
581
+ }
582
+ else {
583
+ return makeToken();
584
+ }
585
+ break;
586
+ case LexerPhase.RealFractionalFirst:
587
+ if (isDecimalDigit(ch)) {
588
+ phase = LexerPhase.RealFractionalTail;
589
+ tokenType = Token_1.TokenType.RealLiteral;
590
+ }
591
+ else if (ch === "e" || ch === "E") {
592
+ phase = LexerPhase.RealExponent;
593
+ }
594
+ else {
595
+ return makeToken();
596
+ }
597
+ break;
598
+ case LexerPhase.RealFractionalTail:
599
+ if (ch === "e" || ch === "E") {
600
+ phase = LexerPhase.RealExponent;
601
+ tokenType = Token_1.TokenType.Unknown;
602
+ }
603
+ else if (!isDecimalDigit(ch) && ch !== "_") {
604
+ return makeToken();
605
+ }
606
+ break;
607
+ case LexerPhase.RealExponent:
608
+ if (ch === "+" || ch === "-") {
609
+ phase = LexerPhase.RealExponentSign;
610
+ }
611
+ else if (isDecimalDigit(ch)) {
612
+ phase = LexerPhase.RealExponentTail;
613
+ tokenType = Token_1.TokenType.RealLiteral;
614
+ }
615
+ else {
616
+ return makeToken();
617
+ }
618
+ break;
619
+ case LexerPhase.RealExponentSign:
620
+ if (isDecimalDigit(ch)) {
621
+ phase = LexerPhase.RealExponentTail;
622
+ tokenType = Token_1.TokenType.RealLiteral;
623
+ }
624
+ else {
625
+ return makeToken();
626
+ }
627
+ break;
628
+ case LexerPhase.RealExponentTail:
629
+ if (!isDecimalDigit(ch)) {
630
+ return makeToken();
631
+ }
632
+ break;
633
+ case LexerPhase.String:
634
+ if (ch === stringState) {
635
+ return completeToken(Token_1.TokenType.StringLiteral);
636
+ }
637
+ else if (isRestrictedInString(ch)) {
638
+ return completeToken(Token_1.TokenType.Unknown);
639
+ }
640
+ else if (ch === "\\") {
641
+ phase = LexerPhase.StringBackSlash;
642
+ tokenType = Token_1.TokenType.Unknown;
643
+ }
644
+ break;
645
+ // Start of string character escape
646
+ case LexerPhase.StringBackSlash:
647
+ switch (ch) {
648
+ case "b":
649
+ case "f":
650
+ case "n":
651
+ case "r":
652
+ case "t":
653
+ case "v":
654
+ case "S":
655
+ case "0":
656
+ case "'":
657
+ case '"':
658
+ case "`":
659
+ case "\\":
660
+ phase = LexerPhase.String;
661
+ break;
662
+ case "x":
663
+ phase = LexerPhase.StringHexa1;
664
+ break;
665
+ case "u":
666
+ phase = LexerPhase.StringUHexa1;
667
+ break;
668
+ default:
669
+ phase = LexerPhase.String;
670
+ break;
671
+ }
672
+ break;
673
+ // --- First hexadecimal digit of string character escape
674
+ case LexerPhase.StringHexa1:
675
+ if (isHexadecimalDigit(ch)) {
676
+ phase = LexerPhase.StringHexa2;
677
+ }
678
+ else {
679
+ return completeToken(Token_1.TokenType.Unknown);
680
+ }
681
+ break;
682
+ // --- Second hexadecimal digit of character escape
683
+ case LexerPhase.StringHexa2:
684
+ if (isHexadecimalDigit(ch)) {
685
+ phase = LexerPhase.String;
686
+ }
687
+ else {
688
+ return completeToken(Token_1.TokenType.Unknown);
689
+ }
690
+ break;
691
+ // --- First hexadecimal digit of Unicode string character escape
692
+ case LexerPhase.StringUHexa1:
693
+ if (ch === "{") {
694
+ phase = LexerPhase.StringUcp1;
695
+ break;
696
+ }
697
+ if (isHexadecimalDigit(ch)) {
698
+ phase = LexerPhase.StringUHexa2;
699
+ }
700
+ else {
701
+ return completeToken(Token_1.TokenType.Unknown);
702
+ }
703
+ break;
704
+ // --- Second hexadecimal digit of Unicode string character escape
705
+ case LexerPhase.StringUHexa2:
706
+ if (isHexadecimalDigit(ch)) {
707
+ phase = LexerPhase.StringUHexa3;
708
+ }
709
+ else {
710
+ return completeToken(Token_1.TokenType.Unknown);
711
+ }
712
+ break;
713
+ // --- Third hexadecimal digit of Unicode string character escape
714
+ case LexerPhase.StringUHexa3:
715
+ if (isHexadecimalDigit(ch)) {
716
+ phase = LexerPhase.StringUHexa4;
717
+ }
718
+ else {
719
+ return completeToken(Token_1.TokenType.Unknown);
720
+ }
721
+ break;
722
+ // --- Fourth hexadecimal digit of Unicode string character escape
723
+ case LexerPhase.StringUHexa4:
724
+ if (isHexadecimalDigit(ch)) {
725
+ phase = LexerPhase.String;
726
+ }
727
+ else {
728
+ return completeToken(Token_1.TokenType.Unknown);
729
+ }
730
+ break;
731
+ // --- First hexadecimal digit of Unicode codepoint string character escape
732
+ case LexerPhase.StringUcp1:
733
+ if (isHexadecimalDigit(ch)) {
734
+ phase = LexerPhase.StringUcp2;
735
+ }
736
+ else {
737
+ return completeToken(Token_1.TokenType.Unknown);
738
+ }
739
+ break;
740
+ // --- Second hexadecimal digit of Unicode codepoint string character escape
741
+ case LexerPhase.StringUcp2:
742
+ if (ch === "}") {
743
+ phase = LexerPhase.String;
744
+ }
745
+ else if (isHexadecimalDigit(ch)) {
746
+ phase = LexerPhase.StringUcp3;
747
+ }
748
+ else {
749
+ return completeToken(Token_1.TokenType.Unknown);
750
+ }
751
+ break;
752
+ // --- Third hexadecimal digit of Unicode codepoint string character escape
753
+ case LexerPhase.StringUcp3:
754
+ if (ch === "}") {
755
+ phase = LexerPhase.String;
756
+ }
757
+ else if (isHexadecimalDigit(ch)) {
758
+ phase = LexerPhase.StringUcp4;
759
+ }
760
+ else {
761
+ return completeToken(Token_1.TokenType.Unknown);
762
+ }
763
+ break;
764
+ // --- Fourth hexadecimal digit of Unicode codepoint string character escape
765
+ case LexerPhase.StringUcp4:
766
+ if (ch === "}") {
767
+ phase = LexerPhase.String;
768
+ }
769
+ else if (isHexadecimalDigit(ch)) {
770
+ phase = LexerPhase.StringUcp5;
771
+ }
772
+ else {
773
+ return completeToken(Token_1.TokenType.Unknown);
774
+ }
775
+ break;
776
+ // --- Fifth hexadecimal digit of Unicode codepoint string character escape
777
+ case LexerPhase.StringUcp5:
778
+ if (ch === "}") {
779
+ phase = LexerPhase.String;
780
+ }
781
+ else if (isHexadecimalDigit(ch)) {
782
+ phase = LexerPhase.StringUcp6;
783
+ }
784
+ else {
785
+ return completeToken(Token_1.TokenType.Unknown);
786
+ }
787
+ break;
788
+ // --- Sixth hexadecimal digit of Unicode codepoint string character escape
789
+ case LexerPhase.StringUcp6:
790
+ if (ch === "}") {
791
+ phase = LexerPhase.String;
792
+ }
793
+ else if (isHexadecimalDigit(ch)) {
794
+ phase = LexerPhase.StringUcpTail;
795
+ }
796
+ else {
797
+ return completeToken(Token_1.TokenType.Unknown);
798
+ }
799
+ break;
800
+ // --- Closing bracket of Unicode codepoint string character escape
801
+ case LexerPhase.StringUcpTail:
802
+ if (ch === "}") {
803
+ phase = LexerPhase.String;
804
+ }
805
+ else {
806
+ return completeToken(Token_1.TokenType.Unknown);
807
+ }
808
+ break;
809
+ // ====================================================================
810
+ // --- We cannot continue
811
+ default:
812
+ return makeToken();
813
+ }
814
+ // --- Append the char to the current text
815
+ appendTokenChar();
816
+ // --- Go on with parsing the next character
817
+ }
818
+ /**
819
+ * Appends the last character to the token, and manages positions
820
+ */
821
+ function appendTokenChar() {
822
+ text += ch;
823
+ lexer._prefetched = null;
824
+ lexer._prefetchedPos = null;
825
+ lexer._prefetchedColumn = null;
826
+ lastEndPos = input.position;
827
+ lastEndColumn = input.position;
828
+ }
829
+ /**
830
+ * Packs the specified type of token to send back
831
+ */
832
+ function makeToken() {
833
+ var _a;
834
+ if (useResolver) {
835
+ tokenType =
836
+ (_a = resolverHash.get(text)) !== null && _a !== void 0 ? _a : (isIdStart(text[0]) && text[text.length - 1] !== "'" ? Token_1.TokenType.Identifier : Token_1.TokenType.Unknown);
837
+ }
838
+ return {
839
+ text,
840
+ type: tokenType,
841
+ location: {
842
+ startPosition: startPos,
843
+ endPosition: lastEndPos,
844
+ startLine: line,
845
+ endLine: line,
846
+ startColumn,
847
+ endColumn: lastEndColumn,
848
+ },
849
+ };
850
+ }
851
+ /**
852
+ * Add the last character to the token and return it
853
+ */
854
+ function completeToken(suggestedType) {
855
+ appendTokenChar();
856
+ // --- Send back the token
857
+ if (suggestedType !== undefined) {
858
+ tokenType = suggestedType;
859
+ }
860
+ return makeToken();
861
+ }
862
+ }
863
+ /**
864
+ * Fetches the next RegEx token from the input stream
865
+ */
866
+ fetchRegEx() {
867
+ // --- Get the tail
868
+ const tailPosition = this._ahead.length > 0 ? this._ahead[0].location.startPosition : this._lastFetchPosition;
869
+ const tail = this.input.getTail(tailPosition);
870
+ // --- Parse the tail. If no error, the entire tail is the RegExp
871
+ try {
872
+ const regexpResult = (0, regexpp_1.parseRegExpLiteral)(tail);
873
+ const text = regexpResult.raw;
874
+ // --- Consume the characters parsed successfully
875
+ for (let i = 1; i < text.length; i++) {
876
+ this.fetchNextChar();
877
+ this._prefetched = null;
878
+ this._prefetchedPos = null;
879
+ this._prefetchedColumn = null;
880
+ }
881
+ this._ahead.length = 0;
882
+ // --- Return the token
883
+ return {
884
+ success: true,
885
+ pattern: regexpResult.pattern.raw,
886
+ flags: regexpResult.flags.raw,
887
+ length: text.length,
888
+ };
889
+ }
890
+ catch (parseErr) {
891
+ let errorIndex = parseErr.index;
892
+ if (parseErr.toString().includes("Invalid flag")) {
893
+ while (errorIndex < tail.length && "dgimsuy".includes(tail[errorIndex])) {
894
+ errorIndex++;
895
+ }
896
+ }
897
+ // --- If there is no error, something is wrong
898
+ if (errorIndex === undefined) {
899
+ return {
900
+ success: false,
901
+ pattern: tail[0],
902
+ };
903
+ }
904
+ // --- Try to parse the tail before the error position
905
+ const tailBeforeError = tail.substring(0, errorIndex);
906
+ try {
907
+ const regexpResult = (0, regexpp_1.parseRegExpLiteral)(tailBeforeError);
908
+ const text = regexpResult.raw;
909
+ // --- Consume the characters parsed successfully
910
+ for (let i = 1; i < text.length; i++) {
911
+ this.fetchNextChar();
912
+ this._prefetched = null;
913
+ this._prefetchedPos = null;
914
+ this._prefetchedColumn = null;
915
+ }
916
+ this._ahead.length = 0;
917
+ // --- Return the token
918
+ return {
919
+ success: true,
920
+ pattern: regexpResult.pattern.raw,
921
+ flags: regexpResult.flags.raw,
922
+ length: text.length,
923
+ };
924
+ }
925
+ catch (parseErr2) {
926
+ // --- This is really not a regexp
927
+ return {
928
+ success: false,
929
+ pattern: tailBeforeError,
930
+ };
931
+ }
932
+ }
933
+ }
934
+ }
935
+ exports.Lexer = Lexer;
936
+ /**
937
+ * Reserved ID-like tokens
938
+ */
939
+ const resolverHash = new Map();
940
+ resolverHash.set("typeof", Token_1.TokenType.Typeof);
941
+ resolverHash.set("Infinity", Token_1.TokenType.Infinity);
942
+ resolverHash.set("NaN", Token_1.TokenType.NaN);
943
+ resolverHash.set("true", Token_1.TokenType.True);
944
+ resolverHash.set("false", Token_1.TokenType.False);
945
+ resolverHash.set("undefined", Token_1.TokenType.Undefined);
946
+ resolverHash.set("null", Token_1.TokenType.Null);
947
+ resolverHash.set("in", Token_1.TokenType.In);
948
+ resolverHash.set("let", Token_1.TokenType.Let);
949
+ resolverHash.set("const", Token_1.TokenType.Const);
950
+ resolverHash.set("var", Token_1.TokenType.Var);
951
+ resolverHash.set("if", Token_1.TokenType.If);
952
+ resolverHash.set("else", Token_1.TokenType.Else);
953
+ resolverHash.set("return", Token_1.TokenType.Return);
954
+ resolverHash.set("break", Token_1.TokenType.Break);
955
+ resolverHash.set("continue", Token_1.TokenType.Continue);
956
+ resolverHash.set("do", Token_1.TokenType.Do);
957
+ resolverHash.set("while", Token_1.TokenType.While);
958
+ resolverHash.set("for", Token_1.TokenType.For);
959
+ resolverHash.set("of", Token_1.TokenType.Of);
960
+ resolverHash.set("try", Token_1.TokenType.Try);
961
+ resolverHash.set("catch", Token_1.TokenType.Catch);
962
+ resolverHash.set("finally", Token_1.TokenType.Finally);
963
+ resolverHash.set("throw", Token_1.TokenType.Throw);
964
+ resolverHash.set("switch", Token_1.TokenType.Switch);
965
+ resolverHash.set("case", Token_1.TokenType.Case);
966
+ resolverHash.set("default", Token_1.TokenType.Default);
967
+ resolverHash.set("delete", Token_1.TokenType.Delete);
968
+ resolverHash.set("function", Token_1.TokenType.Function);
969
+ resolverHash.set("export", Token_1.TokenType.Export);
970
+ resolverHash.set("import", Token_1.TokenType.Import);
971
+ resolverHash.set("as", Token_1.TokenType.As);
972
+ resolverHash.set("from", Token_1.TokenType.From);
973
+ /**
974
+ * Tests if a token id EOF
975
+ * @param t Token instance
976
+ */
977
+ function isEof(t) {
978
+ return t.type === Token_1.TokenType.Eof;
979
+ }
980
+ /**
981
+ * Tests if a token is whitespace
982
+ * @param t Token instance
983
+ */
984
+ function isWs(t) {
985
+ return t.type <= Token_1.TokenType.Ws;
986
+ }
987
+ /**
988
+ * Tests if a character is an identifier start character
989
+ * @param ch Character to test
990
+ */
991
+ function isIdStart(ch) {
992
+ return (ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z") || ch === "_" || ch === "$";
993
+ }
994
+ /**
995
+ * Tests if a character is an identifier continuation character
996
+ * @param ch Character to test
997
+ */
998
+ function isIdContinuation(ch) {
999
+ return (ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z") || (ch >= "0" && ch <= "9") || ch === "_" || ch === "$";
1000
+ }
1001
+ /**
1002
+ * Tests if a character is a binary digit
1003
+ * @param ch Character to test
1004
+ */
1005
+ function isBinaryDigit(ch) {
1006
+ return ch === "0" || ch === "1";
1007
+ }
1008
+ /**
1009
+ * Tests if a character is a decimal digit
1010
+ * @param ch Character to test
1011
+ */
1012
+ function isDecimalDigit(ch) {
1013
+ return ch >= "0" && ch <= "9";
1014
+ }
1015
+ /**
1016
+ * Tests if a character is a hexadecimal digit
1017
+ * @param ch Character to test
1018
+ */
1019
+ function isHexadecimalDigit(ch) {
1020
+ return (ch >= "0" && ch <= "9") || (ch >= "A" && ch <= "F") || (ch >= "a" && ch <= "f");
1021
+ }
1022
+ /**
1023
+ * Tests if a character is restricted in a string
1024
+ * @param ch Character to test
1025
+ */
1026
+ function isRestrictedInString(ch) {
1027
+ return ch === "\r" || ch === "\n" || ch === "\u0085" || ch === "\u2028" || ch === "\u2029";
1028
+ }