@loopstack/loopstack-studio 0.28.0 → 0.29.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.
- package/dist/_virtual/rolldown_runtime.js +13 -15
- package/dist/components/dynamic-form/Form.js +49 -52
- package/dist/config.js +6 -0
- package/dist/features/debug/components/WorkflowFlowViewer.js +94 -81
- package/dist/features/debug/components/workflow-flow/StateNode.js +154 -79
- package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +43 -31
- package/dist/features/debug/components/workflow-flow/WorkflowTransitionEdge.js +52 -51
- package/dist/features/debug/lib/edge-paths.js +45 -30
- package/dist/features/debug/lib/flow-types.js +2 -0
- package/dist/features/debug/lib/flow-utils.js +66 -64
- package/dist/features/documents/components/DocumentList.js +19 -18
- package/dist/features/workbench/WorkflowItem.js +4 -3
- package/dist/features/workbench/components/EmbedLogsContent.js +5 -0
- package/dist/features/workbench/components/PreviewEmptyState.js +10 -0
- package/dist/features/workbench/components/PreviewWorkbench.js +14 -0
- package/dist/features/workbench/components/RecentRunItem.js +48 -0
- package/dist/features/workbench/components/WorkflowForms.js +4 -3
- package/dist/features/workbench/hooks/useEmbedBridge.js +3 -0
- package/dist/features/workbench/hooks/useWorkflowData.js +9 -9
- package/dist/features/workbench/index.js +4 -0
- package/dist/features/workspaces/components/ExecutionTimeline.js +9 -8
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-YZFGNWBL.js → architecture-7EHR7CIX.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-7N4EOEYR.js → chunk-4EGX6M5U.js} +9 -13
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-KGLVRYIC.js → chunk-5DO6E6H7.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-BR22UD5L.js +56 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-2KRD3SAO.js → chunk-FHYWG6QK.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FOC6F5B3.js → chunk-MPE355IW.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-MZUSXYTE.js +24 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-N66VUXT2.js +48 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-NNHCCRGN.js +20219 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-PUPMXCY4.js +19 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-67CJDMHE.js → chunk-UIBZB4QT.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-WCWK7LTN.js +25 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/eventmodeling-FCH6USID.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-7Q5UKJZL.js → gitGraph-WXDBUCRP.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-J43DQDTF.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-YPE3B663.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-LRSECV5Y.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-GUYGQ44K.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{treeView-SZITEDCU.js → treeView-BLDUP644.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-LRROVOQU.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-L42UT6IY.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +24 -19
- package/dist/node_modules/@ungap/structured-clone/esm/deserialize.js +36 -26
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +1 -1
- package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +257 -254
- package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
- package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
- package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
- package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
- package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
- package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +72 -72
- package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
- package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
- package/dist/node_modules/dompurify/dist/purify.es.js +293 -205
- package/dist/node_modules/es-toolkit/dist/_internal/globalThis.js +4 -0
- package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getTag.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/tags.js +2 -0
- package/dist/node_modules/es-toolkit/dist/compat/function/memoize.js +12 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/clone.js +97 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js +29 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/merge.js +6 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/mergeWith.js +49 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArguments.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArray.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js +6 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isEmpty.js +16 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js +12 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js +5 -0
- package/dist/node_modules/es-toolkit/dist/function/noop.js +2 -0
- package/dist/node_modules/es-toolkit/dist/object/clone.js +29 -0
- package/dist/node_modules/es-toolkit/dist/object/cloneDeepWith.js +114 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isBuffer.js +5 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isLength.js +4 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isPrimitive.js +4 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isTypedArray.js +4 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/index.js +2 -2
- package/dist/node_modules/internmap/src/index.js +1 -1
- package/dist/node_modules/katex/dist/katex.js +379 -417
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +3 -3
- package/dist/node_modules/lodash-es/_assignMergeValue.js +1 -1
- package/dist/node_modules/lodash-es/_assignValue.js +1 -1
- package/dist/node_modules/lodash-es/_baseClone.js +9 -9
- package/dist/node_modules/lodash-es/_baseForOwn.js +1 -1
- package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +1 -1
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
- package/dist/node_modules/lodash-es/_baseMerge.js +2 -2
- package/dist/node_modules/lodash-es/_baseMergeDeep.js +7 -7
- package/dist/node_modules/lodash-es/_baseOrderBy.js +12 -12
- package/dist/node_modules/lodash-es/_baseRest.js +1 -1
- package/dist/node_modules/lodash-es/_baseSet.js +1 -1
- package/dist/node_modules/lodash-es/_baseSetToString.js +3 -3
- package/dist/node_modules/lodash-es/_baseToString.js +2 -2
- package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
- package/dist/node_modules/lodash-es/_createRange.js +1 -1
- package/dist/node_modules/lodash-es/_createSet.js +3 -3
- package/dist/node_modules/lodash-es/_flatRest.js +1 -1
- package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
- package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
- package/dist/node_modules/lodash-es/_getSymbolsIn.js +1 -1
- package/dist/node_modules/lodash-es/_getTag.js +1 -1
- package/dist/node_modules/lodash-es/_hasPath.js +2 -2
- package/dist/node_modules/lodash-es/_initCloneByTag.js +1 -1
- package/dist/node_modules/lodash-es/_initCloneObject.js +1 -1
- package/dist/node_modules/lodash-es/_isFlattenable.js +1 -1
- package/dist/node_modules/lodash-es/_isIterateeCall.js +1 -1
- package/dist/node_modules/lodash-es/_isKey.js +1 -1
- package/dist/node_modules/lodash-es/_setToString.js +1 -1
- package/dist/node_modules/lodash-es/defaults.js +1 -1
- package/dist/node_modules/lodash-es/findIndex.js +2 -2
- package/dist/node_modules/lodash-es/forEach.js +1 -1
- package/dist/node_modules/lodash-es/forIn.js +1 -1
- package/dist/node_modules/lodash-es/isEmpty.js +2 -2
- package/dist/node_modules/lodash-es/isPlainObject.js +1 -1
- package/dist/node_modules/lodash-es/map.js +1 -1
- package/dist/node_modules/lodash-es/max.js +1 -1
- package/dist/node_modules/lodash-es/merge.js +3 -3
- package/dist/node_modules/lodash-es/min.js +1 -1
- package/dist/node_modules/lodash-es/minBy.js +1 -1
- package/dist/node_modules/lodash-es/reduce.js +1 -1
- package/dist/node_modules/lodash-es/toNumber.js +1 -1
- package/dist/node_modules/lodash-es/union.js +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{architectureDiagram-Q4EWVU46.js → architectureDiagram-3BPJPVTR.js} +310 -308
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-DXYQGD6D.js → blockDiagram-GPEHLZMM.js} +215 -190
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-AHTNJAMY.js → c4Diagram-AAUBKEIU.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EDXVE4YY.js → chunk-2J33WTMH.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-5FUZZQ4R.js → chunk-3OPIFGDE.js} +48 -20
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-5PVQY5BW.js → chunk-5ZQYHXKU.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-4TB4RGXK.js → chunk-727SXJPM.js} +555 -459
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-OYMX7WX6.js → chunk-AQP2D5EJ.js} +155 -145
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ICPOFSXX.js → chunk-CSCIHK7Q.js} +106 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ENJZ2VHE.js → chunk-KSCS5N6A.js} +12 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ZZ45TVLE.js → chunk-L5ZTLDWV.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-336JU56O.js → chunk-LZXEDZCA.js} +5 -5
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-YZCP3GAM.js → chunk-ND2GUHAM.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-X2U36JSP.js → chunk-NZK2D7GU.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-U2HBQHQK.js → chunk-O5CBEL6O.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-426QAEUC.js → chunk-WU5MYG2G.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-6PBFFD2Q.js → classDiagram-4FO5ZUOK.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-HSJHXN6E.js → classDiagram-v2-Q7XG4LA2.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-KV5264BT.js → dagre-BM42HDAG.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-MMDJMWI5.js → diagram-2AECGRRQ.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-5BDNPKRD.js → diagram-5GNKFQAL.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-KO2AKTUF.js +433 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-TYMM5635.js → diagram-LMA3HP47.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-G4DWMVQ6.js → diagram-OG6HWLK6.js} +5 -5
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-SMLLAGMA.js → erDiagram-TEJ5UH35.js} +9 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-DWJPFMVM.js → flowDiagram-I6XJVG4X.js} +10 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-T4ZO3ILL.js → ganttDiagram-6RSMTGT7.js} +7 -4
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{gitGraphDiagram-UUTBAWPF.js → gitGraphDiagram-PVQCEYII.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{infoDiagram-42DDH7IO.js → infoDiagram-5YYISTIA.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ishikawaDiagram-UXIWVN3A.js → ishikawaDiagram-YF4QCWOH.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-VCZTEJTY.js → journeyDiagram-JHISSGLW.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-6JOO6SKY.js → kanban-definition-UN3LZRKU.js} +7 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-QFDTVHPH.js → mindmap-definition-RKZ34NQL.js} +9 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{pieDiagram-DEJITSTG.js → pieDiagram-4H26LBE5.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-34T5L4WZ.js → quadrantDiagram-W4KKPZXB.js} +364 -337
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-MS252O5E.js → requirementDiagram-4Y6WPE33.js} +9 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-XADWPNL6.js → sankeyDiagram-5OEKKPKP.js} +187 -138
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sequenceDiagram-FGHM5R23.js → sequenceDiagram-3UESZ5HK.js} +15 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FHFEXIEX.js → stateDiagram-AJRCARHV.js} +10 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-QKLJ7IA2.js → stateDiagram-v2-BHNVJYJU.js} +10 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{timeline-definition-GMOUNBTQ.js → timeline-definition-PNZ67QCA.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{vennDiagram-DHZGUBPP.js → vennDiagram-CIIHVFJN.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-YWT4CUSO.js +640 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-5P7HB3ND.js → xychartDiagram-2RQKCTM6.js} +4 -4
- package/dist/node_modules/mermaid/dist/mermaid.core.js +96 -70
- package/dist/node_modules/stylis/src/Enum.js +2 -2
- package/dist/node_modules/stylis/src/Middleware.js +9 -0
- package/dist/node_modules/stylis/src/Parser.js +55 -44
- package/dist/node_modules/stylis/src/Utility.js +9 -12
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/packages/contracts/dist/enums/index.js +4 -24
- package/dist/packages/contracts/dist/enums/registry.enum.js +9 -20
- package/dist/packages/contracts/dist/enums/sort-order.enum.js +5 -10
- package/dist/packages/contracts/dist/enums/user-type.enum.js +5 -10
- package/dist/packages/contracts/dist/enums/workflow-state.enum.js +5 -10
- package/dist/pages/EmbedWorkbenchPage.js +4 -3
- package/dist/pages/PreviewWorkbenchPage.js +126 -124
- package/dist/pages/StudioLandingPage.js +28 -72
- package/package.json +2 -2
- package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +0 -23
- package/dist/node_modules/@chevrotain/gast/lib/src/model.js +0 -151
- package/dist/node_modules/@chevrotain/gast/lib/src/visitor.js +0 -40
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/api.js +0 -2
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js +0 -85
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/character-classes.js +0 -35
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/regexp-parser.js +0 -570
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/utils.js +0 -25
- package/dist/node_modules/@chevrotain/utils/lib/src/print.js +0 -9
- package/dist/node_modules/@chevrotain/utils/lib/src/timer.js +0 -8
- package/dist/node_modules/@chevrotain/utils/lib/src/to-fast-properties.js +0 -10
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-AA7GKIK3.js +0 -28
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +0 -23
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +0 -1197
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-LIHQZDEY.js +0 -60
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +0 -29
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +0 -3
- package/dist/node_modules/chevrotain/lib/src/api.js +0 -10
- package/dist/node_modules/chevrotain/lib/src/lang/lang_extensions.js +0 -10
- package/dist/node_modules/chevrotain/lib/src/parse/constants.js +0 -2
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst.js +0 -13
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +0 -49
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +0 -77
- package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +0 -33
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +0 -275
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +0 -23
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +0 -28
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +0 -14
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +0 -262
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/keys.js +0 -5
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +0 -41
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +0 -241
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +0 -30
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +0 -56
- package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +0 -114
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +0 -46
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +0 -166
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +0 -43
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +0 -107
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +0 -21
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +0 -312
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +0 -285
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +0 -144
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +0 -92
- package/dist/node_modules/chevrotain/lib/src/parse/parser/utils/apply_mixins.js +0 -11
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +0 -437
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_errors_public.js +0 -9
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +0 -253
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +0 -152
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp_parser.js +0 -15
- package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +0 -65
- package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +0 -39
- package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +0 -346
- package/dist/node_modules/chevrotain-allstar/lib/atn.js +0 -194
- package/dist/node_modules/chevrotain-allstar/lib/dfa.js +0 -32
- package/dist/node_modules/chevrotain-allstar/lib/index.js +0 -1
- package/dist/node_modules/langium/lib/default-module.js +0 -85
- package/dist/node_modules/langium/lib/dependency-injection.js +0 -62
- package/dist/node_modules/langium/lib/documentation/comment-provider.js +0 -11
- package/dist/node_modules/langium/lib/documentation/documentation-provider.js +0 -36
- package/dist/node_modules/langium/lib/documentation/jsdoc.js +0 -303
- package/dist/node_modules/langium/lib/index.js +0 -182
- package/dist/node_modules/langium/lib/languages/generated/ast.js +0 -1089
- package/dist/node_modules/langium/lib/languages/grammar-config.js +0 -13
- package/dist/node_modules/langium/lib/parser/async-parser.js +0 -83
- package/dist/node_modules/langium/lib/parser/completion-parser-builder.js +0 -7
- package/dist/node_modules/langium/lib/parser/cst-node-builder.js +0 -160
- package/dist/node_modules/langium/lib/parser/indentation-aware.js +0 -141
- package/dist/node_modules/langium/lib/parser/langium-parser-builder.js +0 -11
- package/dist/node_modules/langium/lib/parser/langium-parser.js +0 -388
- package/dist/node_modules/langium/lib/parser/lexer.js +0 -50
- package/dist/node_modules/langium/lib/parser/parser-builder-base.js +0 -275
- package/dist/node_modules/langium/lib/parser/token-builder.js +0 -61
- package/dist/node_modules/langium/lib/parser/value-converter.js +0 -78
- package/dist/node_modules/langium/lib/references/linker.js +0 -190
- package/dist/node_modules/langium/lib/references/name-provider.js +0 -13
- package/dist/node_modules/langium/lib/references/references.js +0 -76
- package/dist/node_modules/langium/lib/references/scope-computation.js +0 -35
- package/dist/node_modules/langium/lib/references/scope-provider.js +0 -34
- package/dist/node_modules/langium/lib/references/scope.js +0 -73
- package/dist/node_modules/langium/lib/serializer/hydrator.js +0 -125
- package/dist/node_modules/langium/lib/serializer/json-serializer.js +0 -145
- package/dist/node_modules/langium/lib/service-registry.js +0 -37
- package/dist/node_modules/langium/lib/syntax-tree.js +0 -70
- package/dist/node_modules/langium/lib/utils/ast-utils.js +0 -157
- package/dist/node_modules/langium/lib/utils/caching.js +0 -91
- package/dist/node_modules/langium/lib/utils/cancellation.js +0 -5
- package/dist/node_modules/langium/lib/utils/collections.js +0 -85
- package/dist/node_modules/langium/lib/utils/cst-utils.js +0 -190
- package/dist/node_modules/langium/lib/utils/disposable.js +0 -8
- package/dist/node_modules/langium/lib/utils/errors.js +0 -12
- package/dist/node_modules/langium/lib/utils/event.js +0 -5
- package/dist/node_modules/langium/lib/utils/grammar-loader.js +0 -22
- package/dist/node_modules/langium/lib/utils/grammar-utils.js +0 -296
- package/dist/node_modules/langium/lib/utils/index.js +0 -53
- package/dist/node_modules/langium/lib/utils/promise-utils.js +0 -30
- package/dist/node_modules/langium/lib/utils/regexp-utils.js +0 -167
- package/dist/node_modules/langium/lib/utils/stream.js +0 -327
- package/dist/node_modules/langium/lib/utils/uri-utils.js +0 -107
- package/dist/node_modules/langium/lib/validation/document-validator.js +0 -210
- package/dist/node_modules/langium/lib/validation/validation-registry.js +0 -87
- package/dist/node_modules/langium/lib/workspace/ast-descriptions.js +0 -57
- package/dist/node_modules/langium/lib/workspace/ast-node-locator.js +0 -28
- package/dist/node_modules/langium/lib/workspace/configuration.js +0 -51
- package/dist/node_modules/langium/lib/workspace/document-builder.js +0 -201
- package/dist/node_modules/langium/lib/workspace/documents.js +0 -142
- package/dist/node_modules/langium/lib/workspace/file-system-provider.js +0 -34
- package/dist/node_modules/langium/lib/workspace/index-manager.js +0 -49
- package/dist/node_modules/langium/lib/workspace/profiler.js +0 -89
- package/dist/node_modules/langium/lib/workspace/workspace-lock.js +0 -42
- package/dist/node_modules/langium/lib/workspace/workspace-manager.js +0 -66
- package/dist/node_modules/lodash-es/flatMap.js +0 -7
- package/dist/node_modules/lodash-es/uniqBy.js +0 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +0 -574
- package/dist/node_modules/vscode-jsonrpc/browser.js +0 -7
- package/dist/node_modules/vscode-jsonrpc/lib/browser/main.js +0 -52
- package/dist/node_modules/vscode-jsonrpc/lib/browser/ril.js +0 -120
- package/dist/node_modules/vscode-jsonrpc/lib/common/api.js +0 -337
- package/dist/node_modules/vscode-jsonrpc/lib/common/cancellation.js +0 -57
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +0 -647
- package/dist/node_modules/vscode-jsonrpc/lib/common/disposable.js +0 -13
- package/dist/node_modules/vscode-jsonrpc/lib/common/events.js +0 -64
- package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +0 -34
- package/dist/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +0 -235
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +0 -93
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageReader.js +0 -129
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +0 -85
- package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +0 -161
- package/dist/node_modules/vscode-jsonrpc/lib/common/ral.js +0 -18
- package/dist/node_modules/vscode-jsonrpc/lib/common/semaphore.js +0 -44
- package/dist/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +0 -58
- package/dist/node_modules/vscode-languageserver-protocol/lib/browser/main.js +0 -28
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/api.js +0 -36
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/connection.js +0 -12
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/messages.js +0 -31
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +0 -33
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +0 -35
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +0 -674
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +0 -126
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +0 -24
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +0 -31
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +0 -42
- package/dist/node_modules/vscode-languageserver-textdocument/lib/esm/main.js +0 -138
- package/dist/node_modules/vscode-languageserver-types/lib/esm/main.js +0 -1084
- package/dist/node_modules/vscode-uri/lib/esm/index.js +0 -373
- /package/dist/node_modules/{entities → hast-util-raw/node_modules/entities}/dist/esm/decode-codepoint.js +0 -0
- /package/dist/node_modules/{entities → hast-util-raw/node_modules/entities}/dist/esm/decode.js +0 -0
- /package/dist/node_modules/{entities → hast-util-raw/node_modules/entities}/dist/esm/generated/decode-data-html.js +0 -0
- /package/dist/node_modules/{unified/node_modules/is-plain-obj → is-plain-obj}/index.js +0 -0
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { IN } from "../../constants.js";
|
|
2
|
-
import { EOF, createTokenInstance, tokenMatcher } from "../../../scan/tokens_public.js";
|
|
3
|
-
import { NextAfterTokenWalker } from "../../grammar/interpreter.js";
|
|
4
|
-
import { MismatchedTokenException } from "../../exceptions_public.js";
|
|
5
|
-
import { DEFAULT_PARSER_CONFIG } from "../parser.js";
|
|
6
|
-
const EOF_FOLLOW_KEY = {}, IN_RULE_RECOVERY_EXCEPTION = "InRuleRecoveryException";
|
|
7
|
-
var InRuleRecoveryException = class extends Error {
|
|
8
|
-
constructor(e) {
|
|
9
|
-
super(e), this.name = IN_RULE_RECOVERY_EXCEPTION;
|
|
10
|
-
}
|
|
11
|
-
}, Recoverable = class {
|
|
12
|
-
initRecoverable(e) {
|
|
13
|
-
this.firstAfterRepMap = {}, this.resyncFollows = {}, this.recoveryEnabled = Object.hasOwn(e, "recoveryEnabled") ? e.recoveryEnabled : DEFAULT_PARSER_CONFIG.recoveryEnabled, this.recoveryEnabled && (this.attemptInRepetitionRecovery = attemptInRepetitionRecovery);
|
|
14
|
-
}
|
|
15
|
-
getTokenToInsert(e) {
|
|
16
|
-
let t = createTokenInstance(e, "", NaN, NaN, NaN, NaN, NaN, NaN);
|
|
17
|
-
return t.isInsertedInRecovery = !0, t;
|
|
18
|
-
}
|
|
19
|
-
canTokenTypeBeInsertedInRecovery(e) {
|
|
20
|
-
return !0;
|
|
21
|
-
}
|
|
22
|
-
canTokenTypeBeDeletedInRecovery(e) {
|
|
23
|
-
return !0;
|
|
24
|
-
}
|
|
25
|
-
tryInRepetitionRecovery(e, t, n, r) {
|
|
26
|
-
let i = this.findReSyncTokenType(), o = this.exportLexerState(), s = [], c = !1, l = this.LA_FAST(1), u = this.LA_FAST(1), d = () => {
|
|
27
|
-
let e = this.LA(0), t = new MismatchedTokenException(this.errorMessageProvider.buildMismatchTokenMessage({
|
|
28
|
-
expected: r,
|
|
29
|
-
actual: l,
|
|
30
|
-
previous: e,
|
|
31
|
-
ruleName: this.getCurrRuleFullName()
|
|
32
|
-
}), l, this.LA(0));
|
|
33
|
-
t.resyncedTokens = s.slice(0, -1), this.SAVE_ERROR(t);
|
|
34
|
-
};
|
|
35
|
-
for (; !c;) if (this.tokenMatcher(u, r)) {
|
|
36
|
-
d();
|
|
37
|
-
return;
|
|
38
|
-
} else if (n.call(this)) {
|
|
39
|
-
d(), e.apply(this, t);
|
|
40
|
-
return;
|
|
41
|
-
} else this.tokenMatcher(u, i) ? c = !0 : (u = this.SKIP_TOKEN(), this.addToResyncTokens(u, s));
|
|
42
|
-
this.importLexerState(o);
|
|
43
|
-
}
|
|
44
|
-
shouldInRepetitionRecoveryBeTried(e, t, n) {
|
|
45
|
-
return !(n === !1 || this.tokenMatcher(this.LA_FAST(1), e) || this.isBackTracking() || this.canPerformInRuleRecovery(e, this.getFollowsForInRuleRecovery(e, t)));
|
|
46
|
-
}
|
|
47
|
-
getNextPossibleTokenTypes(e) {
|
|
48
|
-
let t = e.ruleStack[0], n = this.getGAstProductions()[t];
|
|
49
|
-
return new NextAfterTokenWalker(n, e).startWalking();
|
|
50
|
-
}
|
|
51
|
-
getFollowsForInRuleRecovery(e, t) {
|
|
52
|
-
let n = this.getCurrentGrammarPath(e, t);
|
|
53
|
-
return this.getNextPossibleTokenTypes(n);
|
|
54
|
-
}
|
|
55
|
-
tryInRuleRecovery(e, t) {
|
|
56
|
-
if (this.canRecoverWithSingleTokenInsertion(e, t)) return this.getTokenToInsert(e);
|
|
57
|
-
if (this.canRecoverWithSingleTokenDeletion(e)) {
|
|
58
|
-
let e = this.SKIP_TOKEN();
|
|
59
|
-
return this.consumeToken(), e;
|
|
60
|
-
}
|
|
61
|
-
throw new InRuleRecoveryException("sad sad panda");
|
|
62
|
-
}
|
|
63
|
-
canPerformInRuleRecovery(e, t) {
|
|
64
|
-
return this.canRecoverWithSingleTokenInsertion(e, t) || this.canRecoverWithSingleTokenDeletion(e);
|
|
65
|
-
}
|
|
66
|
-
canRecoverWithSingleTokenInsertion(e, t) {
|
|
67
|
-
if (!this.canTokenTypeBeInsertedInRecovery(e) || t.length === 0) return !1;
|
|
68
|
-
let n = this.LA_FAST(1);
|
|
69
|
-
return t.find((e) => this.tokenMatcher(n, e)) !== void 0;
|
|
70
|
-
}
|
|
71
|
-
canRecoverWithSingleTokenDeletion(e) {
|
|
72
|
-
return this.canTokenTypeBeDeletedInRecovery(e) ? this.tokenMatcher(this.LA(2), e) : !1;
|
|
73
|
-
}
|
|
74
|
-
isInCurrentRuleReSyncSet(e) {
|
|
75
|
-
let t = this.getCurrFollowKey();
|
|
76
|
-
return this.getFollowSetFromFollowKey(t).includes(e);
|
|
77
|
-
}
|
|
78
|
-
findReSyncTokenType() {
|
|
79
|
-
let e = this.flattenFollowSet(), t = this.LA_FAST(1), n = 2;
|
|
80
|
-
for (;;) {
|
|
81
|
-
let i = e.find((e) => tokenMatcher(t, e));
|
|
82
|
-
if (i !== void 0) return i;
|
|
83
|
-
t = this.LA(n), n++;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
getCurrFollowKey() {
|
|
87
|
-
if (this.RULE_STACK_IDX === 0) return EOF_FOLLOW_KEY;
|
|
88
|
-
let e = this.currRuleShortName, t = this.getLastExplicitRuleOccurrenceIndex(), n = this.getPreviousExplicitRuleShortName();
|
|
89
|
-
return {
|
|
90
|
-
ruleName: this.shortRuleNameToFullName(e),
|
|
91
|
-
idxInCallingRule: t,
|
|
92
|
-
inRule: this.shortRuleNameToFullName(n)
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
buildFullFollowKeyStack() {
|
|
96
|
-
let e = this.RULE_STACK, t = this.RULE_OCCURRENCE_STACK, n = this.RULE_STACK_IDX + 1, r = Array(n);
|
|
97
|
-
for (let i = 0; i < n; i++) i === 0 ? r[i] = EOF_FOLLOW_KEY : r[i] = {
|
|
98
|
-
ruleName: this.shortRuleNameToFullName(e[i]),
|
|
99
|
-
idxInCallingRule: t[i],
|
|
100
|
-
inRule: this.shortRuleNameToFullName(e[i - 1])
|
|
101
|
-
};
|
|
102
|
-
return r;
|
|
103
|
-
}
|
|
104
|
-
flattenFollowSet() {
|
|
105
|
-
return this.buildFullFollowKeyStack().map((e) => this.getFollowSetFromFollowKey(e)).flat();
|
|
106
|
-
}
|
|
107
|
-
getFollowSetFromFollowKey(n) {
|
|
108
|
-
if (n === EOF_FOLLOW_KEY) return [EOF];
|
|
109
|
-
let r = n.ruleName + n.idxInCallingRule + IN + n.inRule;
|
|
110
|
-
return this.resyncFollows[r];
|
|
111
|
-
}
|
|
112
|
-
addToResyncTokens(e, n) {
|
|
113
|
-
return this.tokenMatcher(e, EOF) || n.push(e), n;
|
|
114
|
-
}
|
|
115
|
-
reSyncTo(e) {
|
|
116
|
-
let t = [], n = this.LA_FAST(1);
|
|
117
|
-
for (; this.tokenMatcher(n, e) === !1;) n = this.SKIP_TOKEN(), this.addToResyncTokens(n, t);
|
|
118
|
-
return t.slice(0, -1);
|
|
119
|
-
}
|
|
120
|
-
attemptInRepetitionRecovery(e, t, n, r, i, a, o) {}
|
|
121
|
-
getCurrentGrammarPath(e, t) {
|
|
122
|
-
return {
|
|
123
|
-
ruleStack: this.getHumanReadableRuleStack(),
|
|
124
|
-
occurrenceStack: this.RULE_OCCURRENCE_STACK.slice(0, this.RULE_OCCURRENCE_STACK_IDX + 1),
|
|
125
|
-
lastTok: e,
|
|
126
|
-
lastTokOccurrence: t
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
getHumanReadableRuleStack() {
|
|
130
|
-
let e = this.RULE_STACK_IDX + 1, t = Array(e);
|
|
131
|
-
for (let n = 0; n < e; n++) t[n] = this.shortRuleNameToFullName(this.RULE_STACK[n]);
|
|
132
|
-
return t;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
function attemptInRepetitionRecovery(e, n, r, i, a, o, s) {
|
|
136
|
-
let c = this.getKeyForAutomaticLookahead(i, a), l = this.firstAfterRepMap[c];
|
|
137
|
-
if (l === void 0) {
|
|
138
|
-
let e = this.getCurrRuleFullName(), t = this.getGAstProductions()[e];
|
|
139
|
-
l = new o(t, a).startWalking(), this.firstAfterRepMap[c] = l;
|
|
140
|
-
}
|
|
141
|
-
let u = l.token, d = l.occurrence, f = l.isEndOfRule;
|
|
142
|
-
this.RULE_STACK_IDX === 0 && f && u === void 0 && (u = EOF, d = 1), !(u === void 0 || d === void 0) && this.shouldInRepetitionRecoveryBeTried(u, d, s) && this.tryInRepetitionRecovery(e, n, r, u);
|
|
143
|
-
}
|
|
144
|
-
export { IN_RULE_RECOVERY_EXCEPTION, Recoverable };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { addNoneTerminalToCst, addTerminalToCst, setNodeLocationFull, setNodeLocationOnlyOffset } from "../../cst/cst.js";
|
|
2
|
-
import { createBaseSemanticVisitorConstructor, createBaseVisitorConstructorWithDefaults } from "../../cst/cst_visitor.js";
|
|
3
|
-
import { DEFAULT_PARSER_CONFIG } from "../parser.js";
|
|
4
|
-
var TreeBuilder = class {
|
|
5
|
-
initTreeBuilder(e) {
|
|
6
|
-
if (this.CST_STACK = [], this.outputCst = e.outputCst, this.nodeLocationTracking = Object.hasOwn(e, "nodeLocationTracking") ? e.nodeLocationTracking : DEFAULT_PARSER_CONFIG.nodeLocationTracking, !this.outputCst) this.cstInvocationStateUpdate = () => {}, this.cstFinallyStateUpdate = () => {}, this.cstPostTerminal = () => {}, this.cstPostNonTerminal = () => {}, this.cstPostRule = () => {};
|
|
7
|
-
else if (/full/i.test(this.nodeLocationTracking)) this.recoveryEnabled ? (this.setNodeLocationFromToken = setNodeLocationFull, this.setNodeLocationFromNode = setNodeLocationFull, this.cstPostRule = () => {}, this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery) : (this.setNodeLocationFromToken = () => {}, this.setNodeLocationFromNode = () => {}, this.cstPostRule = this.cstPostRuleFull, this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular);
|
|
8
|
-
else if (/onlyOffset/i.test(this.nodeLocationTracking)) this.recoveryEnabled ? (this.setNodeLocationFromToken = setNodeLocationOnlyOffset, this.setNodeLocationFromNode = setNodeLocationOnlyOffset, this.cstPostRule = () => {}, this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery) : (this.setNodeLocationFromToken = () => {}, this.setNodeLocationFromNode = () => {}, this.cstPostRule = this.cstPostRuleOnlyOffset, this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular);
|
|
9
|
-
else if (/none/i.test(this.nodeLocationTracking)) this.setNodeLocationFromToken = () => {}, this.setNodeLocationFromNode = () => {}, this.cstPostRule = () => {}, this.setInitialNodeLocation = () => {};
|
|
10
|
-
else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);
|
|
11
|
-
}
|
|
12
|
-
setInitialNodeLocationOnlyOffsetRecovery(e) {
|
|
13
|
-
e.location = {
|
|
14
|
-
startOffset: NaN,
|
|
15
|
-
endOffset: NaN
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
setInitialNodeLocationOnlyOffsetRegular(e) {
|
|
19
|
-
e.location = {
|
|
20
|
-
startOffset: this.LA_FAST(1).startOffset,
|
|
21
|
-
endOffset: NaN
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
setInitialNodeLocationFullRecovery(e) {
|
|
25
|
-
e.location = {
|
|
26
|
-
startOffset: NaN,
|
|
27
|
-
startLine: NaN,
|
|
28
|
-
startColumn: NaN,
|
|
29
|
-
endOffset: NaN,
|
|
30
|
-
endLine: NaN,
|
|
31
|
-
endColumn: NaN
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
setInitialNodeLocationFullRegular(e) {
|
|
35
|
-
let a = this.LA_FAST(1);
|
|
36
|
-
e.location = {
|
|
37
|
-
startOffset: a.startOffset,
|
|
38
|
-
startLine: a.startLine,
|
|
39
|
-
startColumn: a.startColumn,
|
|
40
|
-
endOffset: NaN,
|
|
41
|
-
endLine: NaN,
|
|
42
|
-
endColumn: NaN
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
cstInvocationStateUpdate(e) {
|
|
46
|
-
let a = {
|
|
47
|
-
name: e,
|
|
48
|
-
children: Object.create(null)
|
|
49
|
-
};
|
|
50
|
-
this.setInitialNodeLocation(a), this.CST_STACK.push(a);
|
|
51
|
-
}
|
|
52
|
-
cstFinallyStateUpdate() {
|
|
53
|
-
this.CST_STACK.pop();
|
|
54
|
-
}
|
|
55
|
-
cstPostRuleFull(e) {
|
|
56
|
-
let a = this.LA(0), o = e.location;
|
|
57
|
-
o.startOffset <= a.startOffset ? (o.endOffset = a.endOffset, o.endLine = a.endLine, o.endColumn = a.endColumn) : (o.startOffset = NaN, o.startLine = NaN, o.startColumn = NaN);
|
|
58
|
-
}
|
|
59
|
-
cstPostRuleOnlyOffset(e) {
|
|
60
|
-
let a = this.LA(0), o = e.location;
|
|
61
|
-
o.startOffset <= a.startOffset ? o.endOffset = a.endOffset : o.startOffset = NaN;
|
|
62
|
-
}
|
|
63
|
-
cstPostTerminal(e, o) {
|
|
64
|
-
let s = this.CST_STACK[this.CST_STACK.length - 1];
|
|
65
|
-
addTerminalToCst(s, o, e), this.setNodeLocationFromToken(s.location, o);
|
|
66
|
-
}
|
|
67
|
-
cstPostNonTerminal(a, o) {
|
|
68
|
-
let s = this.CST_STACK[this.CST_STACK.length - 1];
|
|
69
|
-
addNoneTerminalToCst(s, o, a), this.setNodeLocationFromNode(s.location, a.location);
|
|
70
|
-
}
|
|
71
|
-
getBaseCstVisitorConstructor() {
|
|
72
|
-
if (this.baseCstVisitorConstructor === void 0) {
|
|
73
|
-
let e = createBaseSemanticVisitorConstructor(this.className, Object.keys(this.gastProductionsCache));
|
|
74
|
-
return this.baseCstVisitorConstructor = e, e;
|
|
75
|
-
}
|
|
76
|
-
return this.baseCstVisitorConstructor;
|
|
77
|
-
}
|
|
78
|
-
getBaseCstVisitorConstructorWithDefaults() {
|
|
79
|
-
if (this.baseCstVisitorWithDefaultsConstructor === void 0) {
|
|
80
|
-
let e = createBaseVisitorConstructorWithDefaults(this.className, Object.keys(this.gastProductionsCache), this.getBaseCstVisitorConstructor());
|
|
81
|
-
return this.baseCstVisitorWithDefaultsConstructor = e, e;
|
|
82
|
-
}
|
|
83
|
-
return this.baseCstVisitorWithDefaultsConstructor;
|
|
84
|
-
}
|
|
85
|
-
getPreviousExplicitRuleShortName() {
|
|
86
|
-
return this.RULE_STACK[this.RULE_STACK_IDX - 1];
|
|
87
|
-
}
|
|
88
|
-
getLastExplicitRuleOccurrenceIndex() {
|
|
89
|
-
return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX];
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
export { TreeBuilder };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function applyMixins(e, t) {
|
|
2
|
-
t.forEach((t) => {
|
|
3
|
-
let n = t.prototype;
|
|
4
|
-
Object.getOwnPropertyNames(n).forEach((r) => {
|
|
5
|
-
if (r === "constructor") return;
|
|
6
|
-
let i = Object.getOwnPropertyDescriptor(n, r);
|
|
7
|
-
i && (i.get || i.set) ? Object.defineProperty(e.prototype, r, i) : e.prototype[r] = t.prototype[r];
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export { applyMixins };
|
|
@@ -1,437 +0,0 @@
|
|
|
1
|
-
import { BaseRegExpVisitor } from "../../../../@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js";
|
|
2
|
-
import "../../../../@chevrotain/regexp-to-ast/lib/src/api.js";
|
|
3
|
-
import { PRINT_ERROR } from "../../../../@chevrotain/utils/lib/src/print.js";
|
|
4
|
-
import { getRegExpAst } from "./reg_exp_parser.js";
|
|
5
|
-
import { canMatchCharCode, failedOptimizationPrefixMsg, getOptimizedStartCodesIndices } from "./reg_exp.js";
|
|
6
|
-
import { Lexer, LexerDefinitionErrorType } from "./lexer_public.js";
|
|
7
|
-
var PATTERN = "PATTERN";
|
|
8
|
-
const DEFAULT_MODE = "defaultMode";
|
|
9
|
-
function analyzeTokenTypes(e, S) {
|
|
10
|
-
S = Object.assign({
|
|
11
|
-
safeMode: !1,
|
|
12
|
-
positionTracking: "full",
|
|
13
|
-
lineTerminatorCharacters: ["\r", "\n"],
|
|
14
|
-
tracer: (e, x) => x()
|
|
15
|
-
}, S);
|
|
16
|
-
let D = S.tracer;
|
|
17
|
-
D("initCharCodeToOptimizedIndexMap", () => {
|
|
18
|
-
initCharCodeToOptimizedIndexMap();
|
|
19
|
-
});
|
|
20
|
-
let O;
|
|
21
|
-
D("Reject Lexer.NA", () => {
|
|
22
|
-
O = e.filter((e) => e[PATTERN] !== Lexer.NA);
|
|
23
|
-
});
|
|
24
|
-
let k = !1, A;
|
|
25
|
-
D("Transform Patterns", () => {
|
|
26
|
-
k = !1, A = O.map((e) => {
|
|
27
|
-
let x = e[PATTERN];
|
|
28
|
-
/* istanbul ignore else */
|
|
29
|
-
if (x instanceof RegExp) {
|
|
30
|
-
let e = x.source;
|
|
31
|
-
return e.length === 1 && e !== "^" && e !== "$" && e !== "." && !x.ignoreCase ? e : e.length === 2 && e[0] === "\\" && ![
|
|
32
|
-
"d",
|
|
33
|
-
"D",
|
|
34
|
-
"s",
|
|
35
|
-
"S",
|
|
36
|
-
"t",
|
|
37
|
-
"r",
|
|
38
|
-
"n",
|
|
39
|
-
"t",
|
|
40
|
-
"0",
|
|
41
|
-
"c",
|
|
42
|
-
"b",
|
|
43
|
-
"B",
|
|
44
|
-
"f",
|
|
45
|
-
"v",
|
|
46
|
-
"w",
|
|
47
|
-
"W"
|
|
48
|
-
].includes(e[1]) ? e[1] : addStickyFlag(x);
|
|
49
|
-
} else if (typeof x == "function") return k = !0, { exec: x };
|
|
50
|
-
else if (typeof x == "object") return k = !0, x;
|
|
51
|
-
else if (typeof x == "string") {
|
|
52
|
-
if (x.length === 1) return x;
|
|
53
|
-
{
|
|
54
|
-
let e = x.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
55
|
-
return addStickyFlag(new RegExp(e));
|
|
56
|
-
}
|
|
57
|
-
} else throw Error("non exhaustive match");
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
let j, M, N, P, F;
|
|
61
|
-
D("misc mapping", () => {
|
|
62
|
-
j = O.map((e) => e.tokenTypeIdx), M = O.map((e) => {
|
|
63
|
-
let x = e.GROUP;
|
|
64
|
-
if (x !== Lexer.SKIPPED) {
|
|
65
|
-
if (typeof x == "string") return x;
|
|
66
|
-
if (x === void 0) return !1;
|
|
67
|
-
throw Error("non exhaustive match");
|
|
68
|
-
}
|
|
69
|
-
}), N = O.map((e) => {
|
|
70
|
-
let x = e.LONGER_ALT;
|
|
71
|
-
if (x) return Array.isArray(x) ? x.map((e) => O.indexOf(e)) : [O.indexOf(x)];
|
|
72
|
-
}), P = O.map((e) => e.PUSH_MODE), F = O.map((e) => Object.hasOwn(e, "POP_MODE"));
|
|
73
|
-
});
|
|
74
|
-
let I;
|
|
75
|
-
D("Line Terminator Handling", () => {
|
|
76
|
-
let e = getCharCodes(S.lineTerminatorCharacters);
|
|
77
|
-
I = O.map((e) => !1), S.positionTracking !== "onlyOffset" && (I = O.map((x) => Object.hasOwn(x, "LINE_BREAKS") ? !!x.LINE_BREAKS : checkLineBreaksIssues(x, e) === !1 && canMatchCharCode(e, x.PATTERN)));
|
|
78
|
-
});
|
|
79
|
-
let L, R, z, B;
|
|
80
|
-
D("Misc Mapping #2", () => {
|
|
81
|
-
L = O.map(isCustomPattern), R = A.map(isShortPattern), z = O.reduce((e, x) => {
|
|
82
|
-
let S = x.GROUP;
|
|
83
|
-
return typeof S == "string" && S !== Lexer.SKIPPED && (e[S] = []), e;
|
|
84
|
-
}, {}), B = A.map((e, x) => ({
|
|
85
|
-
pattern: A[x],
|
|
86
|
-
longerAlt: N[x],
|
|
87
|
-
canLineTerminator: I[x],
|
|
88
|
-
isCustom: L[x],
|
|
89
|
-
short: R[x],
|
|
90
|
-
group: M[x],
|
|
91
|
-
push: P[x],
|
|
92
|
-
pop: F[x],
|
|
93
|
-
tokenTypeIdx: j[x],
|
|
94
|
-
tokenType: O[x]
|
|
95
|
-
}));
|
|
96
|
-
});
|
|
97
|
-
let V = !0, H = [];
|
|
98
|
-
return S.safeMode || D("First Char Optimization", () => {
|
|
99
|
-
H = O.reduce((e, C, E) => {
|
|
100
|
-
if (typeof C.PATTERN == "string") addToMapOfArrays(e, charCodeToOptimizedIndex(C.PATTERN.charCodeAt(0)), B[E]);
|
|
101
|
-
else if (Array.isArray(C.START_CHARS_HINT)) {
|
|
102
|
-
let x;
|
|
103
|
-
C.START_CHARS_HINT.forEach((S) => {
|
|
104
|
-
let C = charCodeToOptimizedIndex(typeof S == "string" ? S.charCodeAt(0) : S);
|
|
105
|
-
/* istanbul ignore else */
|
|
106
|
-
x !== C && (x = C, addToMapOfArrays(e, C, B[E]));
|
|
107
|
-
});
|
|
108
|
-
} else if (C.PATTERN instanceof RegExp) if (C.PATTERN.unicode) V = !1, S.ensureOptimizations && PRINT_ERROR(`${failedOptimizationPrefixMsg}\tUnable to analyze < ${C.PATTERN.toString()} > pattern.\n The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
109
|
-
This will disable the lexer's first char optimizations.
|
|
110
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);
|
|
111
|
-
else {
|
|
112
|
-
let x = getOptimizedStartCodesIndices(C.PATTERN, S.ensureOptimizations);
|
|
113
|
-
x.length === 0 && (V = !1), x.forEach((x) => {
|
|
114
|
-
addToMapOfArrays(e, x, B[E]);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
else S.ensureOptimizations && PRINT_ERROR(`${failedOptimizationPrefixMsg}\tTokenType: <${C.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n This will disable the lexer's first char optimizations.
|
|
118
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`), V = !1;
|
|
119
|
-
return e;
|
|
120
|
-
}, []);
|
|
121
|
-
}), {
|
|
122
|
-
emptyGroups: z,
|
|
123
|
-
patternIdxToConfig: B,
|
|
124
|
-
charCodeToPatternIdxToConfig: H,
|
|
125
|
-
hasCustom: k,
|
|
126
|
-
canBeOptimized: V
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function validatePatterns(e, x) {
|
|
130
|
-
let S = [], C = findMissingPatterns(e);
|
|
131
|
-
S = S.concat(C.errors);
|
|
132
|
-
let w = findInvalidPatterns(C.valid), T = w.valid;
|
|
133
|
-
return S = S.concat(w.errors), S = S.concat(validateRegExpPattern(T)), S = S.concat(findInvalidGroupType(T)), S = S.concat(findModesThatDoNotExist(T, x)), S = S.concat(findUnreachablePatterns(T)), S;
|
|
134
|
-
}
|
|
135
|
-
function validateRegExpPattern(e) {
|
|
136
|
-
let x = [], S = e.filter((e) => e[PATTERN] instanceof RegExp);
|
|
137
|
-
return x = x.concat(findEndOfInputAnchor(S)), x = x.concat(findStartOfInputAnchor(S)), x = x.concat(findUnsupportedFlags(S)), x = x.concat(findDuplicatePatterns(S)), x = x.concat(findEmptyMatchRegExps(S)), x;
|
|
138
|
-
}
|
|
139
|
-
function findMissingPatterns(e) {
|
|
140
|
-
let x = e.filter((e) => !Object.hasOwn(e, PATTERN));
|
|
141
|
-
return {
|
|
142
|
-
errors: x.map((e) => ({
|
|
143
|
-
message: "Token Type: ->" + e.name + "<- missing static 'PATTERN' property",
|
|
144
|
-
type: LexerDefinitionErrorType.MISSING_PATTERN,
|
|
145
|
-
tokenTypes: [e]
|
|
146
|
-
})),
|
|
147
|
-
valid: e.filter((e) => !x.includes(e))
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function findInvalidPatterns(e) {
|
|
151
|
-
let x = e.filter((e) => {
|
|
152
|
-
let x = e[PATTERN];
|
|
153
|
-
return !(x instanceof RegExp) && typeof x != "function" && !Object.hasOwn(x, "exec") && typeof x != "string";
|
|
154
|
-
});
|
|
155
|
-
return {
|
|
156
|
-
errors: x.map((e) => ({
|
|
157
|
-
message: "Token Type: ->" + e.name + "<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",
|
|
158
|
-
type: LexerDefinitionErrorType.INVALID_PATTERN,
|
|
159
|
-
tokenTypes: [e]
|
|
160
|
-
})),
|
|
161
|
-
valid: e.filter((e) => !x.includes(e))
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
var end_of_input = /[^\\][$]/;
|
|
165
|
-
function findEndOfInputAnchor(x) {
|
|
166
|
-
class C extends BaseRegExpVisitor {
|
|
167
|
-
constructor() {
|
|
168
|
-
super(...arguments), this.found = !1;
|
|
169
|
-
}
|
|
170
|
-
visitEndAnchor(e) {
|
|
171
|
-
this.found = !0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return x.filter((e) => {
|
|
175
|
-
let x = e.PATTERN;
|
|
176
|
-
try {
|
|
177
|
-
let e = getRegExpAst(x), w = new C();
|
|
178
|
-
return w.visit(e), w.found;
|
|
179
|
-
} catch {
|
|
180
|
-
/* istanbul ignore next - cannot ensure an error in regexp-to-ast*/
|
|
181
|
-
return end_of_input.test(x.source);
|
|
182
|
-
}
|
|
183
|
-
}).map((e) => ({
|
|
184
|
-
message: "Unexpected RegExp Anchor Error:\n Token Type: ->" + e.name + "<- static 'PATTERN' cannot contain end of input anchor '$'\n See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",
|
|
185
|
-
type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND,
|
|
186
|
-
tokenTypes: [e]
|
|
187
|
-
}));
|
|
188
|
-
}
|
|
189
|
-
function findEmptyMatchRegExps(e) {
|
|
190
|
-
return e.filter((e) => e.PATTERN.test("")).map((e) => ({
|
|
191
|
-
message: "Token Type: ->" + e.name + "<- static 'PATTERN' must not match an empty string",
|
|
192
|
-
type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,
|
|
193
|
-
tokenTypes: [e]
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
var start_of_input = /[^\\[][\^]|^\^/;
|
|
197
|
-
function findStartOfInputAnchor(x) {
|
|
198
|
-
class C extends BaseRegExpVisitor {
|
|
199
|
-
constructor() {
|
|
200
|
-
super(...arguments), this.found = !1;
|
|
201
|
-
}
|
|
202
|
-
visitStartAnchor(e) {
|
|
203
|
-
this.found = !0;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return x.filter((e) => {
|
|
207
|
-
let x = e.PATTERN;
|
|
208
|
-
try {
|
|
209
|
-
let e = getRegExpAst(x), w = new C();
|
|
210
|
-
return w.visit(e), w.found;
|
|
211
|
-
} catch {
|
|
212
|
-
/* istanbul ignore next - cannot ensure an error in regexp-to-ast*/
|
|
213
|
-
return start_of_input.test(x.source);
|
|
214
|
-
}
|
|
215
|
-
}).map((e) => ({
|
|
216
|
-
message: "Unexpected RegExp Anchor Error:\n Token Type: ->" + e.name + "<- static 'PATTERN' cannot contain start of input anchor '^'\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",
|
|
217
|
-
type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND,
|
|
218
|
-
tokenTypes: [e]
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
|
-
function findUnsupportedFlags(e) {
|
|
222
|
-
return e.filter((e) => {
|
|
223
|
-
let x = e[PATTERN];
|
|
224
|
-
return x instanceof RegExp && (x.multiline || x.global);
|
|
225
|
-
}).map((e) => ({
|
|
226
|
-
message: "Token Type: ->" + e.name + "<- static 'PATTERN' may NOT contain global('g') or multiline('m')",
|
|
227
|
-
type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,
|
|
228
|
-
tokenTypes: [e]
|
|
229
|
-
}));
|
|
230
|
-
}
|
|
231
|
-
function findDuplicatePatterns(e) {
|
|
232
|
-
let x = [], S = e.map((S) => e.reduce((e, C) => S.PATTERN.source === C.PATTERN.source && !x.includes(C) && C.PATTERN !== Lexer.NA ? (x.push(C), e.push(C), e) : e, []));
|
|
233
|
-
return S = S.filter(Boolean), S.filter((e) => e.length > 1).map((e) => {
|
|
234
|
-
let x = e.map((e) => e.name);
|
|
235
|
-
return {
|
|
236
|
-
message: `The same RegExp pattern ->${e[0].PATTERN}<-has been used in all of the following Token Types: ${x.join(", ")} <-`,
|
|
237
|
-
type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,
|
|
238
|
-
tokenTypes: e
|
|
239
|
-
};
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
function findInvalidGroupType(e) {
|
|
243
|
-
return e.filter((e) => {
|
|
244
|
-
if (!Object.hasOwn(e, "GROUP")) return !1;
|
|
245
|
-
let x = e.GROUP;
|
|
246
|
-
return x !== Lexer.SKIPPED && x !== Lexer.NA && typeof x != "string";
|
|
247
|
-
}).map((e) => ({
|
|
248
|
-
message: "Token Type: ->" + e.name + "<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",
|
|
249
|
-
type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,
|
|
250
|
-
tokenTypes: [e]
|
|
251
|
-
}));
|
|
252
|
-
}
|
|
253
|
-
function findModesThatDoNotExist(e, x) {
|
|
254
|
-
return e.filter((e) => e.PUSH_MODE !== void 0 && !x.includes(e.PUSH_MODE)).map((e) => ({
|
|
255
|
-
message: `Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,
|
|
256
|
-
type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,
|
|
257
|
-
tokenTypes: [e]
|
|
258
|
-
}));
|
|
259
|
-
}
|
|
260
|
-
function findUnreachablePatterns(e) {
|
|
261
|
-
let x = [], S = e.reduce((e, x, S) => {
|
|
262
|
-
let C = x.PATTERN;
|
|
263
|
-
return C === Lexer.NA || (typeof C == "string" ? e.push({
|
|
264
|
-
str: C,
|
|
265
|
-
idx: S,
|
|
266
|
-
tokenType: x
|
|
267
|
-
}) : C instanceof RegExp && noMetaChar(C) && e.push({
|
|
268
|
-
str: C.source,
|
|
269
|
-
idx: S,
|
|
270
|
-
tokenType: x
|
|
271
|
-
})), e;
|
|
272
|
-
}, []);
|
|
273
|
-
return e.forEach((e, C) => {
|
|
274
|
-
S.forEach(({ str: S, idx: w, tokenType: T }) => {
|
|
275
|
-
if (C < w && tryToMatchStrToPattern(S, e.PATTERN)) {
|
|
276
|
-
let S = `Token: ->${T.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;
|
|
277
|
-
x.push({
|
|
278
|
-
message: S,
|
|
279
|
-
type: LexerDefinitionErrorType.UNREACHABLE_PATTERN,
|
|
280
|
-
tokenTypes: [e, T]
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}), x;
|
|
285
|
-
}
|
|
286
|
-
function tryToMatchStrToPattern(e, x) {
|
|
287
|
-
if (x instanceof RegExp) {
|
|
288
|
-
if (usesLookAheadOrBehind(x)) return !1;
|
|
289
|
-
let S = x.exec(e);
|
|
290
|
-
return S !== null && S.index === 0;
|
|
291
|
-
} else if (typeof x == "function") return x(e, 0, [], {});
|
|
292
|
-
else if (Object.hasOwn(x, "exec")) return x.exec(e, 0, [], {});
|
|
293
|
-
else if (typeof x == "string") return x === e;
|
|
294
|
-
else throw Error("non exhaustive match");
|
|
295
|
-
}
|
|
296
|
-
function noMetaChar(e) {
|
|
297
|
-
return [
|
|
298
|
-
".",
|
|
299
|
-
"\\",
|
|
300
|
-
"[",
|
|
301
|
-
"]",
|
|
302
|
-
"|",
|
|
303
|
-
"^",
|
|
304
|
-
"$",
|
|
305
|
-
"(",
|
|
306
|
-
")",
|
|
307
|
-
"?",
|
|
308
|
-
"*",
|
|
309
|
-
"+",
|
|
310
|
-
"{"
|
|
311
|
-
].find((x) => e.source.indexOf(x) !== -1) === void 0;
|
|
312
|
-
}
|
|
313
|
-
function usesLookAheadOrBehind(e) {
|
|
314
|
-
return /(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source);
|
|
315
|
-
}
|
|
316
|
-
function addStickyFlag(e) {
|
|
317
|
-
let x = e.ignoreCase ? "iy" : "y";
|
|
318
|
-
return RegExp(`${e.source}`, x);
|
|
319
|
-
}
|
|
320
|
-
function performRuntimeChecks(e, x, S) {
|
|
321
|
-
let C = [];
|
|
322
|
-
return Object.hasOwn(e, "defaultMode") || C.push({
|
|
323
|
-
message: "A MultiMode Lexer cannot be initialized without a <" + DEFAULT_MODE + "> property in its definition\n",
|
|
324
|
-
type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE
|
|
325
|
-
}), Object.hasOwn(e, "modes") || C.push({
|
|
326
|
-
message: "A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",
|
|
327
|
-
type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY
|
|
328
|
-
}), Object.hasOwn(e, "modes") && Object.hasOwn(e, "defaultMode") && !Object.hasOwn(e.modes, e.defaultMode) && C.push({
|
|
329
|
-
message: `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${e.defaultMode}>which does not exist\n`,
|
|
330
|
-
type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST
|
|
331
|
-
}), Object.hasOwn(e, "modes") && Object.keys(e.modes).forEach((x) => {
|
|
332
|
-
let S = e.modes[x];
|
|
333
|
-
S.forEach((e, w) => {
|
|
334
|
-
e === void 0 ? C.push({
|
|
335
|
-
message: `A Lexer cannot be initialized using an undefined Token Type. Mode:<${x}> at index: <${w}>\n`,
|
|
336
|
-
type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED
|
|
337
|
-
}) : Object.hasOwn(e, "LONGER_ALT") && (Array.isArray(e.LONGER_ALT) ? e.LONGER_ALT : [e.LONGER_ALT]).forEach((w) => {
|
|
338
|
-
w !== void 0 && !S.includes(w) && C.push({
|
|
339
|
-
message: `A MultiMode Lexer cannot be initialized with a longer_alt <${w.name}> on token <${e.name}> outside of mode <${x}>\n`,
|
|
340
|
-
type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
}), C;
|
|
345
|
-
}
|
|
346
|
-
function performWarningRuntimeChecks(e, x, S) {
|
|
347
|
-
let w = [], T = !1, O = Object.values(e.modes || {}).flat().filter(Boolean).filter((e) => e[PATTERN] !== Lexer.NA), k = getCharCodes(S);
|
|
348
|
-
return x && O.forEach((e) => {
|
|
349
|
-
let x = checkLineBreaksIssues(e, k);
|
|
350
|
-
if (x !== !1) {
|
|
351
|
-
let S = {
|
|
352
|
-
message: buildLineBreakIssueMessage(e, x),
|
|
353
|
-
type: x.issue,
|
|
354
|
-
tokenType: e
|
|
355
|
-
};
|
|
356
|
-
w.push(S);
|
|
357
|
-
} else Object.hasOwn(e, "LINE_BREAKS") ? e.LINE_BREAKS === !0 && (T = !0) : canMatchCharCode(k, e.PATTERN) && (T = !0);
|
|
358
|
-
}), x && !T && w.push({
|
|
359
|
-
message: "Warning: No LINE_BREAKS Found.\n This Lexer has been defined to track line and column information,\n But none of the Token Types can be identified as matching a line terminator.\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n for details.",
|
|
360
|
-
type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS
|
|
361
|
-
}), w;
|
|
362
|
-
}
|
|
363
|
-
function cloneEmptyGroups(e) {
|
|
364
|
-
let x = {};
|
|
365
|
-
return Object.keys(e).forEach((S) => {
|
|
366
|
-
let C = e[S];
|
|
367
|
-
/* istanbul ignore else */
|
|
368
|
-
if (Array.isArray(C)) x[S] = [];
|
|
369
|
-
else throw Error("non exhaustive match");
|
|
370
|
-
}), x;
|
|
371
|
-
}
|
|
372
|
-
function isCustomPattern(e) {
|
|
373
|
-
let x = e.PATTERN;
|
|
374
|
-
/* istanbul ignore else */
|
|
375
|
-
if (x instanceof RegExp) return !1;
|
|
376
|
-
if (typeof x == "function" || Object.hasOwn(x, "exec")) return !0;
|
|
377
|
-
if (typeof x == "string") return !1;
|
|
378
|
-
throw Error("non exhaustive match");
|
|
379
|
-
}
|
|
380
|
-
function isShortPattern(e) {
|
|
381
|
-
return typeof e == "string" && e.length === 1 ? e.charCodeAt(0) : !1;
|
|
382
|
-
}
|
|
383
|
-
const LineTerminatorOptimizedTester = {
|
|
384
|
-
test: function(e) {
|
|
385
|
-
let x = e.length;
|
|
386
|
-
for (let S = this.lastIndex; S < x; S++) {
|
|
387
|
-
let x = e.charCodeAt(S);
|
|
388
|
-
if (x === 10) return this.lastIndex = S + 1, !0;
|
|
389
|
-
if (x === 13) return e.charCodeAt(S + 1) === 10 ? this.lastIndex = S + 2 : this.lastIndex = S + 1, !0;
|
|
390
|
-
}
|
|
391
|
-
return !1;
|
|
392
|
-
},
|
|
393
|
-
lastIndex: 0
|
|
394
|
-
};
|
|
395
|
-
function checkLineBreaksIssues(e, x) {
|
|
396
|
-
if (Object.hasOwn(e, "LINE_BREAKS")) return !1;
|
|
397
|
-
if (e.PATTERN instanceof RegExp) {
|
|
398
|
-
try {
|
|
399
|
-
canMatchCharCode(x, e.PATTERN);
|
|
400
|
-
} catch (e) {
|
|
401
|
-
/* istanbul ignore next - to test this we would have to mock <canMatchCharCode> to throw an error */
|
|
402
|
-
return {
|
|
403
|
-
issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR,
|
|
404
|
-
errMsg: e.message
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
return !1;
|
|
408
|
-
} else if (typeof e.PATTERN == "string") return !1;
|
|
409
|
-
else if (isCustomPattern(e)) return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK };
|
|
410
|
-
else throw Error("non exhaustive match");
|
|
411
|
-
}
|
|
412
|
-
function buildLineBreakIssueMessage(e, x) {
|
|
413
|
-
/* istanbul ignore else */
|
|
414
|
-
if (x.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) return `Warning: unable to identify line terminator usage in pattern.
|
|
415
|
-
\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${x.errMsg}.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;
|
|
416
|
-
if (x.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) return `Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
417
|
-
\tThe problem is in the <${e.name}> Token Type\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;
|
|
418
|
-
throw Error("non exhaustive match");
|
|
419
|
-
}
|
|
420
|
-
function getCharCodes(e) {
|
|
421
|
-
return e.map((e) => typeof e == "string" ? e.charCodeAt(0) : e);
|
|
422
|
-
}
|
|
423
|
-
function addToMapOfArrays(e, x, S) {
|
|
424
|
-
e[x] === void 0 ? e[x] = [S] : e[x].push(S);
|
|
425
|
-
}
|
|
426
|
-
const minOptimizationVal = 256;
|
|
427
|
-
var charCodeToOptimizedIdxMap = [];
|
|
428
|
-
function charCodeToOptimizedIndex(e) {
|
|
429
|
-
return e < 256 ? e : charCodeToOptimizedIdxMap[e];
|
|
430
|
-
}
|
|
431
|
-
function initCharCodeToOptimizedIndexMap() {
|
|
432
|
-
if (charCodeToOptimizedIdxMap.length === 0) {
|
|
433
|
-
charCodeToOptimizedIdxMap = Array(65536);
|
|
434
|
-
for (let e = 0; e < 65536; e++) charCodeToOptimizedIdxMap[e] = e > 255 ? 255 + ~~(e / 255) : e;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
export { DEFAULT_MODE, LineTerminatorOptimizedTester, analyzeTokenTypes, charCodeToOptimizedIndex, cloneEmptyGroups, minOptimizationVal, performRuntimeChecks, performWarningRuntimeChecks, validatePatterns };
|