@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,275 +0,0 @@
|
|
|
1
|
-
import { stream } from "../utils/stream.js";
|
|
2
|
-
import { isAbstractParserRule, isAction, isAlternatives, isAssignment, isBooleanLiteral, isConjunction, isCrossReference, isDisjunction, isEndOfFile, isGroup, isInfixRule, isKeyword, isNegation, isParameterReference, isParserRule, isRuleCall, isTerminalRule, isUnorderedGroup } from "../languages/generated/ast.js";
|
|
3
|
-
import { ErrorWithLocation, assertUnreachable } from "../utils/errors.js";
|
|
4
|
-
import { findNameAssignment, getAllReachableRules, getTypeName } from "../utils/grammar-utils.js";
|
|
5
|
-
import { EOF } from "../../../chevrotain/lib/src/scan/tokens_public.js";
|
|
6
|
-
import { EMPTY_ALT } from "../../../chevrotain/lib/src/parse/parser/parser.js";
|
|
7
|
-
import "../../../chevrotain/lib/src/api.js";
|
|
8
|
-
function createParser(d, P, F) {
|
|
9
|
-
return buildRules({
|
|
10
|
-
parser: P,
|
|
11
|
-
tokens: F,
|
|
12
|
-
ruleNames: /* @__PURE__ */ new Map()
|
|
13
|
-
}, d), P;
|
|
14
|
-
}
|
|
15
|
-
function buildRules(P, F) {
|
|
16
|
-
let I = getAllReachableRules(F, !1), L = stream(F.rules).filter(isParserRule).filter((d) => I.has(d));
|
|
17
|
-
for (let d of L) {
|
|
18
|
-
let F = {
|
|
19
|
-
...P,
|
|
20
|
-
consume: 1,
|
|
21
|
-
optional: 1,
|
|
22
|
-
subrule: 1,
|
|
23
|
-
many: 1,
|
|
24
|
-
or: 1
|
|
25
|
-
};
|
|
26
|
-
P.parser.rule(d, buildElement(F, d.definition));
|
|
27
|
-
}
|
|
28
|
-
let R = stream(F.rules).filter(isInfixRule).filter((d) => I.has(d));
|
|
29
|
-
for (let d of R) P.parser.rule(d, buildInfixRule(P, d));
|
|
30
|
-
}
|
|
31
|
-
function buildInfixRule(d, P) {
|
|
32
|
-
let F = P.call.rule.ref;
|
|
33
|
-
if (!F) throw Error("Could not resolve reference to infix operator rule: " + P.call.rule.$refText);
|
|
34
|
-
if (isTerminalRule(F)) throw Error("Cannot use terminal rule in infix expression");
|
|
35
|
-
let I = P.operators.precedences.flatMap((d) => d.operators), L = {
|
|
36
|
-
$type: "Group",
|
|
37
|
-
elements: []
|
|
38
|
-
}, R = {
|
|
39
|
-
$container: L,
|
|
40
|
-
$type: "Assignment",
|
|
41
|
-
feature: "parts",
|
|
42
|
-
operator: "+=",
|
|
43
|
-
terminal: P.call
|
|
44
|
-
}, z = {
|
|
45
|
-
$container: L,
|
|
46
|
-
$type: "Group",
|
|
47
|
-
elements: [],
|
|
48
|
-
cardinality: "*"
|
|
49
|
-
};
|
|
50
|
-
L.elements.push(R, z);
|
|
51
|
-
let B = {
|
|
52
|
-
$container: z,
|
|
53
|
-
$type: "Assignment",
|
|
54
|
-
feature: "operators",
|
|
55
|
-
operator: "+=",
|
|
56
|
-
terminal: {
|
|
57
|
-
$type: "Alternatives",
|
|
58
|
-
elements: I
|
|
59
|
-
}
|
|
60
|
-
}, V = {
|
|
61
|
-
...R,
|
|
62
|
-
$container: z
|
|
63
|
-
};
|
|
64
|
-
z.elements.push(B, V);
|
|
65
|
-
let H = I.map((P) => d.tokens[P.value]).map((P, F) => ({ ALT: () => d.parser.consume(F, P, B) })), U;
|
|
66
|
-
return (P) => {
|
|
67
|
-
U ??= getRule(d, F), d.parser.subrule(0, U, !1, R, P), d.parser.many(0, { DEF: () => {
|
|
68
|
-
d.parser.alternatives(0, H), d.parser.subrule(1, U, !1, V, P);
|
|
69
|
-
} });
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function buildElement(d, P, R = !1) {
|
|
73
|
-
let z;
|
|
74
|
-
if (isKeyword(P)) z = buildKeyword(d, P);
|
|
75
|
-
else if (isAction(P)) z = buildAction(d, P);
|
|
76
|
-
else if (isAssignment(P)) z = buildElement(d, P.terminal);
|
|
77
|
-
else if (isCrossReference(P)) z = buildCrossReference(d, P);
|
|
78
|
-
else if (isRuleCall(P)) z = buildRuleCall(d, P);
|
|
79
|
-
else if (isAlternatives(P)) z = buildAlternatives(d, P);
|
|
80
|
-
else if (isUnorderedGroup(P)) z = buildUnorderedGroup(d, P);
|
|
81
|
-
else if (isGroup(P)) z = buildGroup(d, P);
|
|
82
|
-
else if (isEndOfFile(P)) {
|
|
83
|
-
let F = d.consume++;
|
|
84
|
-
z = () => d.parser.consume(F, EOF, P);
|
|
85
|
-
} else throw new ErrorWithLocation(P.$cstNode, `Unexpected element type: ${P.$type}`);
|
|
86
|
-
return wrap(d, R ? void 0 : getGuardCondition(P), z, P.cardinality);
|
|
87
|
-
}
|
|
88
|
-
function buildAction(d, P) {
|
|
89
|
-
let F = getTypeName(P);
|
|
90
|
-
return () => d.parser.action(F, P);
|
|
91
|
-
}
|
|
92
|
-
function buildRuleCall(d, F) {
|
|
93
|
-
let I = F.rule.ref;
|
|
94
|
-
if (isAbstractParserRule(I)) {
|
|
95
|
-
let P = d.subrule++, L = isParserRule(I) && I.fragment, R = F.arguments.length > 0 ? buildRuleCallPredicate(I, F.arguments) : () => ({}), z;
|
|
96
|
-
return (B) => {
|
|
97
|
-
z ??= getRule(d, I), d.parser.subrule(P, z, L, F, R(B));
|
|
98
|
-
};
|
|
99
|
-
} else if (isTerminalRule(I)) {
|
|
100
|
-
let P = d.consume++, L = getToken(d, I.name);
|
|
101
|
-
return () => d.parser.consume(P, L, F);
|
|
102
|
-
} else if (I) assertUnreachable(I);
|
|
103
|
-
else throw new ErrorWithLocation(F.$cstNode, `Undefined rule: ${F.rule.$refText}`);
|
|
104
|
-
}
|
|
105
|
-
function buildRuleCallPredicate(d, P) {
|
|
106
|
-
if (P.some((d) => d.calledByName)) {
|
|
107
|
-
let d = P.map((d) => ({
|
|
108
|
-
parameterName: d.parameter?.ref?.name,
|
|
109
|
-
predicate: buildPredicate(d.value)
|
|
110
|
-
}));
|
|
111
|
-
return (P) => {
|
|
112
|
-
let F = {};
|
|
113
|
-
for (let { parameterName: I, predicate: L } of d) I && (F[I] = L(P));
|
|
114
|
-
return F;
|
|
115
|
-
};
|
|
116
|
-
} else {
|
|
117
|
-
let F = P.map((d) => buildPredicate(d.value));
|
|
118
|
-
return (P) => {
|
|
119
|
-
let I = {};
|
|
120
|
-
for (let L = 0; L < F.length; L++) if (L < d.parameters.length) {
|
|
121
|
-
let R = d.parameters[L].name, z = F[L];
|
|
122
|
-
I[R] = z(P);
|
|
123
|
-
}
|
|
124
|
-
return I;
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function buildPredicate(d) {
|
|
129
|
-
if (isDisjunction(d)) {
|
|
130
|
-
let P = buildPredicate(d.left), F = buildPredicate(d.right);
|
|
131
|
-
return (d) => P(d) || F(d);
|
|
132
|
-
} else if (isConjunction(d)) {
|
|
133
|
-
let P = buildPredicate(d.left), F = buildPredicate(d.right);
|
|
134
|
-
return (d) => P(d) && F(d);
|
|
135
|
-
} else if (isNegation(d)) {
|
|
136
|
-
let P = buildPredicate(d.value);
|
|
137
|
-
return (d) => !P(d);
|
|
138
|
-
} else if (isParameterReference(d)) {
|
|
139
|
-
let P = d.parameter.ref.name;
|
|
140
|
-
return (d) => d !== void 0 && d[P] === !0;
|
|
141
|
-
} else if (isBooleanLiteral(d)) {
|
|
142
|
-
let P = !!d.true;
|
|
143
|
-
return () => P;
|
|
144
|
-
}
|
|
145
|
-
assertUnreachable(d);
|
|
146
|
-
}
|
|
147
|
-
function buildAlternatives(d, P) {
|
|
148
|
-
if (P.elements.length === 1) return buildElement(d, P.elements[0]);
|
|
149
|
-
{
|
|
150
|
-
let F = [];
|
|
151
|
-
for (let I of P.elements) {
|
|
152
|
-
let P = { ALT: buildElement(d, I, !0) }, L = getGuardCondition(I);
|
|
153
|
-
L && (P.GATE = buildPredicate(L)), F.push(P);
|
|
154
|
-
}
|
|
155
|
-
let I = d.or++;
|
|
156
|
-
return (P) => d.parser.alternatives(I, F.map((d) => {
|
|
157
|
-
let F = { ALT: () => d.ALT(P) }, I = d.GATE;
|
|
158
|
-
return I && (F.GATE = () => I(P)), F;
|
|
159
|
-
}));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function buildUnorderedGroup(d, P) {
|
|
163
|
-
if (P.elements.length === 1) return buildElement(d, P.elements[0]);
|
|
164
|
-
let F = [];
|
|
165
|
-
for (let I of P.elements) {
|
|
166
|
-
let P = { ALT: buildElement(d, I, !0) }, L = getGuardCondition(I);
|
|
167
|
-
L && (P.GATE = buildPredicate(L)), F.push(P);
|
|
168
|
-
}
|
|
169
|
-
let I = d.or++, L = (d, P) => `uGroup_${d}_${P.getRuleStack().join("-")}`, R = wrap(d, getGuardCondition(P), (P) => d.parser.alternatives(I, F.map((F, R) => {
|
|
170
|
-
let z = { ALT: () => !0 }, B = d.parser;
|
|
171
|
-
z.ALT = () => {
|
|
172
|
-
if (F.ALT(P), !B.isRecording()) {
|
|
173
|
-
let d = L(I, B);
|
|
174
|
-
B.unorderedGroups.get(d) || B.unorderedGroups.set(d, []);
|
|
175
|
-
let P = B.unorderedGroups.get(d);
|
|
176
|
-
P?.[R] === void 0 && (P[R] = !0);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
let V = F.GATE;
|
|
180
|
-
return V ? z.GATE = () => V(P) : z.GATE = () => !B.unorderedGroups.get(L(I, B))?.[R], z;
|
|
181
|
-
})), "*");
|
|
182
|
-
return (P) => {
|
|
183
|
-
R(P), d.parser.isRecording() || d.parser.unorderedGroups.delete(L(I, d.parser));
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function buildGroup(d, P) {
|
|
187
|
-
let F = P.elements.map((P) => buildElement(d, P));
|
|
188
|
-
return (d) => F.forEach((P) => P(d));
|
|
189
|
-
}
|
|
190
|
-
function getGuardCondition(d) {
|
|
191
|
-
if (isGroup(d)) return d.guardCondition;
|
|
192
|
-
}
|
|
193
|
-
function buildCrossReference(d, P, F = P.terminal) {
|
|
194
|
-
if (F) if (isRuleCall(F) && isParserRule(F.rule.ref)) {
|
|
195
|
-
let I = F.rule.ref, L = d.subrule++, R;
|
|
196
|
-
return (F) => {
|
|
197
|
-
R ??= getRule(d, I), d.parser.subrule(L, R, !1, P, F);
|
|
198
|
-
};
|
|
199
|
-
} else if (isRuleCall(F) && isTerminalRule(F.rule.ref)) {
|
|
200
|
-
let I = d.consume++, L = getToken(d, F.rule.ref.name);
|
|
201
|
-
return () => d.parser.consume(I, L, P);
|
|
202
|
-
} else if (isKeyword(F)) {
|
|
203
|
-
let I = d.consume++, L = getToken(d, F.value);
|
|
204
|
-
return () => d.parser.consume(I, L, P);
|
|
205
|
-
} else throw Error("Could not build cross reference parser");
|
|
206
|
-
else {
|
|
207
|
-
if (!P.type.ref) throw Error("Could not resolve reference to type: " + P.type.$refText);
|
|
208
|
-
let F = findNameAssignment(P.type.ref)?.terminal;
|
|
209
|
-
if (!F) throw Error("Could not find name assignment for type: " + getTypeName(P.type.ref));
|
|
210
|
-
return buildCrossReference(d, P, F);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
function buildKeyword(d, P) {
|
|
214
|
-
let F = d.consume++, I = d.tokens[P.value];
|
|
215
|
-
if (!I) throw Error("Could not find token for keyword: " + P.value);
|
|
216
|
-
return () => d.parser.consume(F, I, P);
|
|
217
|
-
}
|
|
218
|
-
function wrap(d, P, F, I) {
|
|
219
|
-
let L = P && buildPredicate(P);
|
|
220
|
-
if (!I) if (L) {
|
|
221
|
-
let P = d.or++;
|
|
222
|
-
return (I) => d.parser.alternatives(P, [{
|
|
223
|
-
ALT: () => F(I),
|
|
224
|
-
GATE: () => L(I)
|
|
225
|
-
}, {
|
|
226
|
-
ALT: EMPTY_ALT(),
|
|
227
|
-
GATE: () => !L(I)
|
|
228
|
-
}]);
|
|
229
|
-
} else return F;
|
|
230
|
-
if (I === "*") {
|
|
231
|
-
let P = d.many++;
|
|
232
|
-
return (I) => d.parser.many(P, {
|
|
233
|
-
DEF: () => F(I),
|
|
234
|
-
GATE: L ? () => L(I) : void 0
|
|
235
|
-
});
|
|
236
|
-
} else if (I === "+") {
|
|
237
|
-
let P = d.many++;
|
|
238
|
-
if (L) {
|
|
239
|
-
let I = d.or++;
|
|
240
|
-
return (R) => d.parser.alternatives(I, [{
|
|
241
|
-
ALT: () => d.parser.atLeastOne(P, { DEF: () => F(R) }),
|
|
242
|
-
GATE: () => L(R)
|
|
243
|
-
}, {
|
|
244
|
-
ALT: EMPTY_ALT(),
|
|
245
|
-
GATE: () => !L(R)
|
|
246
|
-
}]);
|
|
247
|
-
} else return (I) => d.parser.atLeastOne(P, { DEF: () => F(I) });
|
|
248
|
-
} else if (I === "?") {
|
|
249
|
-
let P = d.optional++;
|
|
250
|
-
return (I) => d.parser.optional(P, {
|
|
251
|
-
DEF: () => F(I),
|
|
252
|
-
GATE: L ? () => L(I) : void 0
|
|
253
|
-
});
|
|
254
|
-
} else assertUnreachable(I);
|
|
255
|
-
}
|
|
256
|
-
function getRule(d, P) {
|
|
257
|
-
let F = getRuleName(d, P), I = d.parser.getRule(F);
|
|
258
|
-
if (!I) throw Error(`Rule "${F}" not found."`);
|
|
259
|
-
return I;
|
|
260
|
-
}
|
|
261
|
-
function getRuleName(d, F) {
|
|
262
|
-
if (isAbstractParserRule(F)) return F.name;
|
|
263
|
-
if (d.ruleNames.has(F)) return d.ruleNames.get(F);
|
|
264
|
-
{
|
|
265
|
-
let P = F, L = P.$container, R = F.$type;
|
|
266
|
-
for (; !isParserRule(L);) (isGroup(L) || isAlternatives(L) || isUnorderedGroup(L)) && (R = L.elements.indexOf(P).toString() + ":" + R), P = L, L = L.$container;
|
|
267
|
-
return R = L.name + ":" + R, d.ruleNames.set(F, R), R;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
function getToken(d, P) {
|
|
271
|
-
let F = d.tokens[P];
|
|
272
|
-
if (!F) throw Error(`Token "${P}" not found."`);
|
|
273
|
-
return F;
|
|
274
|
-
}
|
|
275
|
-
export { createParser };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { stream } from "../utils/stream.js";
|
|
2
|
-
import { streamAllContents } from "../utils/ast-utils.js";
|
|
3
|
-
import { isAbstractParserRule, isKeyword, isTerminalRule } from "../languages/generated/ast.js";
|
|
4
|
-
import { escapeRegExp, isWhitespace, partialMatches } from "../utils/regexp-utils.js";
|
|
5
|
-
import { getAllReachableRules, terminalRegex } from "../utils/grammar-utils.js";
|
|
6
|
-
import { Lexer } from "../../../chevrotain/lib/src/scan/lexer_public.js";
|
|
7
|
-
import "../../../chevrotain/lib/src/api.js";
|
|
8
|
-
var DefaultTokenBuilder = class {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.diagnostics = [];
|
|
11
|
-
}
|
|
12
|
-
buildTokens(s, c) {
|
|
13
|
-
let l = stream(getAllReachableRules(s, !1)), u = this.buildTerminalTokens(l), d = this.buildKeywordTokens(l, u, c);
|
|
14
|
-
return d.push(...u), d;
|
|
15
|
-
}
|
|
16
|
-
flushLexingReport(e) {
|
|
17
|
-
return { diagnostics: this.popDiagnostics() };
|
|
18
|
-
}
|
|
19
|
-
popDiagnostics() {
|
|
20
|
-
let e = [...this.diagnostics];
|
|
21
|
-
return this.diagnostics = [], e;
|
|
22
|
-
}
|
|
23
|
-
buildTerminalTokens(e) {
|
|
24
|
-
return e.filter(isTerminalRule).filter((e) => !e.fragment).map((e) => this.buildTerminalToken(e)).toArray();
|
|
25
|
-
}
|
|
26
|
-
buildTerminalToken(e) {
|
|
27
|
-
let s = terminalRegex(e), c = this.requiresCustomPattern(s) ? this.regexPatternFunction(s) : s, l = {
|
|
28
|
-
name: e.name,
|
|
29
|
-
PATTERN: c
|
|
30
|
-
};
|
|
31
|
-
return typeof c == "function" && (l.LINE_BREAKS = !0), e.hidden && (l.GROUP = isWhitespace(s) ? Lexer.SKIPPED : "hidden"), l;
|
|
32
|
-
}
|
|
33
|
-
requiresCustomPattern(e) {
|
|
34
|
-
return !!(e.flags.includes("u") || e.flags.includes("s"));
|
|
35
|
-
}
|
|
36
|
-
regexPatternFunction(e) {
|
|
37
|
-
let s = new RegExp(e, e.flags + "y");
|
|
38
|
-
return (e, c) => (s.lastIndex = c, s.exec(e));
|
|
39
|
-
}
|
|
40
|
-
buildKeywordTokens(e, u, d) {
|
|
41
|
-
return e.filter(isAbstractParserRule).flatMap((e) => streamAllContents(e).filter(isKeyword)).distinct((e) => e.value).toArray().sort((e, s) => s.value.length - e.value.length).map((e) => this.buildKeywordToken(e, u, !!d?.caseInsensitive));
|
|
42
|
-
}
|
|
43
|
-
buildKeywordToken(e, s, c) {
|
|
44
|
-
let l = this.buildKeywordPattern(e, c), u = {
|
|
45
|
-
name: e.value,
|
|
46
|
-
PATTERN: l,
|
|
47
|
-
LONGER_ALT: this.findLongerAlt(e, s)
|
|
48
|
-
};
|
|
49
|
-
return typeof l == "function" && (u.LINE_BREAKS = !0), u;
|
|
50
|
-
}
|
|
51
|
-
buildKeywordPattern(e, s) {
|
|
52
|
-
return s ? new RegExp(escapeRegExp(e.value), "i") : e.value;
|
|
53
|
-
}
|
|
54
|
-
findLongerAlt(e, s) {
|
|
55
|
-
return s.reduce((s, c) => {
|
|
56
|
-
let l = c?.PATTERN;
|
|
57
|
-
return l?.source && partialMatches("^" + l.source + "$", e.value) && s.push(c), s;
|
|
58
|
-
}, []);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
export { DefaultTokenBuilder };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { isCrossReference, isRuleCall } from "../languages/generated/ast.js";
|
|
2
|
-
import { getCrossReferenceTerminal, getRuleType } from "../utils/grammar-utils.js";
|
|
3
|
-
var DefaultValueConverter = class {
|
|
4
|
-
convert(r, i) {
|
|
5
|
-
let a = i.grammarSource;
|
|
6
|
-
if (isCrossReference(a) && (a = getCrossReferenceTerminal(a)), isRuleCall(a)) {
|
|
7
|
-
let e = a.rule.ref;
|
|
8
|
-
if (!e) throw Error("This cst node was not parsed by a rule.");
|
|
9
|
-
return this.runConverter(e, r, i);
|
|
10
|
-
}
|
|
11
|
-
return r;
|
|
12
|
-
}
|
|
13
|
-
runConverter(e, t, n) {
|
|
14
|
-
switch (e.name.toUpperCase()) {
|
|
15
|
-
case "INT": return ValueConverter.convertInt(t);
|
|
16
|
-
case "STRING": return ValueConverter.convertString(t);
|
|
17
|
-
case "ID": return ValueConverter.convertID(t);
|
|
18
|
-
}
|
|
19
|
-
switch (getRuleType(e)?.toLowerCase()) {
|
|
20
|
-
case "number": return ValueConverter.convertNumber(t);
|
|
21
|
-
case "boolean": return ValueConverter.convertBoolean(t);
|
|
22
|
-
case "bigint": return ValueConverter.convertBigint(t);
|
|
23
|
-
case "date": return ValueConverter.convertDate(t);
|
|
24
|
-
default: return t;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}, ValueConverter;
|
|
28
|
-
(function(e) {
|
|
29
|
-
function t(e) {
|
|
30
|
-
let t = "";
|
|
31
|
-
for (let r = 1; r < e.length - 1; r++) {
|
|
32
|
-
let i = e.charAt(r);
|
|
33
|
-
if (i === "\\") {
|
|
34
|
-
let i = e.charAt(++r);
|
|
35
|
-
t += n(i);
|
|
36
|
-
} else t += i;
|
|
37
|
-
}
|
|
38
|
-
return t;
|
|
39
|
-
}
|
|
40
|
-
e.convertString = t;
|
|
41
|
-
function n(e) {
|
|
42
|
-
switch (e) {
|
|
43
|
-
case "b": return "\b";
|
|
44
|
-
case "f": return "\f";
|
|
45
|
-
case "n": return "\n";
|
|
46
|
-
case "r": return "\r";
|
|
47
|
-
case "t": return " ";
|
|
48
|
-
case "v": return "\v";
|
|
49
|
-
case "0": return "\0";
|
|
50
|
-
default: return e;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function r(e) {
|
|
54
|
-
return e.charAt(0) === "^" ? e.substring(1) : e;
|
|
55
|
-
}
|
|
56
|
-
e.convertID = r;
|
|
57
|
-
function i(e) {
|
|
58
|
-
return parseInt(e);
|
|
59
|
-
}
|
|
60
|
-
e.convertInt = i;
|
|
61
|
-
function a(e) {
|
|
62
|
-
return BigInt(e);
|
|
63
|
-
}
|
|
64
|
-
e.convertBigint = a;
|
|
65
|
-
function o(e) {
|
|
66
|
-
return new Date(e);
|
|
67
|
-
}
|
|
68
|
-
e.convertDate = o;
|
|
69
|
-
function s(e) {
|
|
70
|
-
return Number(e);
|
|
71
|
-
}
|
|
72
|
-
e.convertNumber = s;
|
|
73
|
-
function c(e) {
|
|
74
|
-
return e.toLowerCase() === "true";
|
|
75
|
-
}
|
|
76
|
-
e.convertBoolean = c;
|
|
77
|
-
})(ValueConverter ||= {});
|
|
78
|
-
export { DefaultValueConverter, ValueConverter };
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { isAstNode, isAstNodeDescription, isLinkingError } from "../syntax-tree.js";
|
|
2
|
-
import { findRootNode, streamAst, streamReferences } from "../utils/ast-utils.js";
|
|
3
|
-
import { cancellation_exports } from "../utils/cancellation.js";
|
|
4
|
-
import { interruptAndCheck } from "../utils/promise-utils.js";
|
|
5
|
-
import { DocumentState } from "../workspace/documents.js";
|
|
6
|
-
const RefResolving = Symbol("RefResolving");
|
|
7
|
-
var DefaultLinker = class {
|
|
8
|
-
constructor(e) {
|
|
9
|
-
this.reflection = e.shared.AstReflection, this.langiumDocuments = () => e.shared.workspace.LangiumDocuments, this.scopeProvider = e.references.ScopeProvider, this.astNodeLocator = e.workspace.AstNodeLocator, this.profiler = e.shared.profilers.LangiumProfiler, this.languageId = e.LanguageMetaData.languageId;
|
|
10
|
-
}
|
|
11
|
-
async link(e, n = cancellation_exports.CancellationToken.None) {
|
|
12
|
-
if (this.profiler?.isActive("linking")) {
|
|
13
|
-
let r = this.profiler.createTask("linking", this.languageId);
|
|
14
|
-
r.start();
|
|
15
|
-
try {
|
|
16
|
-
for (let i of streamAst(e.parseResult.value)) await interruptAndCheck(n), streamReferences(i).forEach((n) => {
|
|
17
|
-
let a = `${i.$type}:${n.property}`;
|
|
18
|
-
r.startSubTask(a);
|
|
19
|
-
try {
|
|
20
|
-
this.doLink(n, e);
|
|
21
|
-
} finally {
|
|
22
|
-
r.stopSubTask(a);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
} finally {
|
|
26
|
-
r.stop();
|
|
27
|
-
}
|
|
28
|
-
} else for (let r of streamAst(e.parseResult.value)) await interruptAndCheck(n), streamReferences(r).forEach((n) => this.doLink(n, e));
|
|
29
|
-
}
|
|
30
|
-
doLink(e, n) {
|
|
31
|
-
let i = e.reference;
|
|
32
|
-
if ("_ref" in i && i._ref === void 0) {
|
|
33
|
-
i._ref = RefResolving;
|
|
34
|
-
try {
|
|
35
|
-
let n = this.getCandidate(e);
|
|
36
|
-
isLinkingError(n) ? i._ref = n : (i._nodeDescription = n, i._ref = this.loadAstNode(n) ?? this.createLinkingError(e, n));
|
|
37
|
-
} catch (n) {
|
|
38
|
-
console.error(`An error occurred while resolving reference to '${i.$refText}':`, n);
|
|
39
|
-
let r = n.message ?? String(n);
|
|
40
|
-
i._ref = {
|
|
41
|
-
info: e,
|
|
42
|
-
message: `An error occurred while resolving reference to '${i.$refText}': ${r}`
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
n.references.push(i);
|
|
46
|
-
} else if ("_items" in i && i._items === void 0) {
|
|
47
|
-
i._items = RefResolving;
|
|
48
|
-
try {
|
|
49
|
-
let n = this.getCandidates(e), a = [];
|
|
50
|
-
if (isLinkingError(n)) i._linkingError = n;
|
|
51
|
-
else for (let e of n) {
|
|
52
|
-
let n = this.loadAstNode(e);
|
|
53
|
-
n && a.push({
|
|
54
|
-
ref: n,
|
|
55
|
-
$nodeDescription: e
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
i._items = a;
|
|
59
|
-
} catch (n) {
|
|
60
|
-
i._linkingError = {
|
|
61
|
-
info: e,
|
|
62
|
-
message: `An error occurred while resolving reference to '${i.$refText}': ${n}`
|
|
63
|
-
}, i._items = [];
|
|
64
|
-
}
|
|
65
|
-
n.references.push(i);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
unlink(e) {
|
|
69
|
-
for (let n of e.references) "_ref" in n ? (n._ref = void 0, delete n._nodeDescription) : "_items" in n && (n._items = void 0, delete n._linkingError);
|
|
70
|
-
e.references = [];
|
|
71
|
-
}
|
|
72
|
-
getCandidate(e) {
|
|
73
|
-
return this.scopeProvider.getScope(e).getElement(e.reference.$refText) ?? this.createLinkingError(e);
|
|
74
|
-
}
|
|
75
|
-
getCandidates(e) {
|
|
76
|
-
let n = this.scopeProvider.getScope(e).getElements(e.reference.$refText).distinct((e) => `${e.documentUri}#${e.path}`).toArray();
|
|
77
|
-
return n.length > 0 ? n : this.createLinkingError(e);
|
|
78
|
-
}
|
|
79
|
-
buildReference(a, o, s, c) {
|
|
80
|
-
let u = this, d = {
|
|
81
|
-
$refNode: s,
|
|
82
|
-
$refText: c,
|
|
83
|
-
_ref: void 0,
|
|
84
|
-
get ref() {
|
|
85
|
-
if (isAstNode(this._ref)) return this._ref;
|
|
86
|
-
if (isAstNodeDescription(this._nodeDescription)) this._ref = u.loadAstNode(this._nodeDescription) ?? u.createLinkingError({
|
|
87
|
-
reference: d,
|
|
88
|
-
container: a,
|
|
89
|
-
property: o
|
|
90
|
-
}, this._nodeDescription);
|
|
91
|
-
else if (this._ref === void 0) {
|
|
92
|
-
this._ref = RefResolving;
|
|
93
|
-
let e = findRootNode(a).$document, n = u.getLinkedNode({
|
|
94
|
-
reference: d,
|
|
95
|
-
container: a,
|
|
96
|
-
property: o
|
|
97
|
-
});
|
|
98
|
-
if (n.error && e && e.state < DocumentState.ComputedScopes) {
|
|
99
|
-
this._ref = void 0;
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this._ref = n.node ?? n.error, this._nodeDescription = n.descr, e?.references.push(this);
|
|
103
|
-
} else this._ref === RefResolving && u.throwCyclicReferenceError(a, o, c);
|
|
104
|
-
return isAstNode(this._ref) ? this._ref : void 0;
|
|
105
|
-
},
|
|
106
|
-
get $nodeDescription() {
|
|
107
|
-
return this._nodeDescription;
|
|
108
|
-
},
|
|
109
|
-
get error() {
|
|
110
|
-
return isLinkingError(this._ref) ? this._ref : void 0;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
return d;
|
|
114
|
-
}
|
|
115
|
-
buildMultiReference(e, n, a, o) {
|
|
116
|
-
let s = this, c = {
|
|
117
|
-
$refNode: a,
|
|
118
|
-
$refText: o,
|
|
119
|
-
_items: void 0,
|
|
120
|
-
get items() {
|
|
121
|
-
if (Array.isArray(this._items)) return this._items;
|
|
122
|
-
if (this._items === void 0) {
|
|
123
|
-
this._items = RefResolving;
|
|
124
|
-
let a = findRootNode(e).$document, o = s.getCandidates({
|
|
125
|
-
reference: c,
|
|
126
|
-
container: e,
|
|
127
|
-
property: n
|
|
128
|
-
}), l = [];
|
|
129
|
-
if (isLinkingError(o)) this._linkingError = o;
|
|
130
|
-
else for (let e of o) {
|
|
131
|
-
let n = s.loadAstNode(e);
|
|
132
|
-
n && l.push({
|
|
133
|
-
ref: n,
|
|
134
|
-
$nodeDescription: e
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
this._items = l, a?.references.push(this);
|
|
138
|
-
} else this._items === RefResolving && s.throwCyclicReferenceError(e, n, o);
|
|
139
|
-
return Array.isArray(this._items) ? this._items : [];
|
|
140
|
-
},
|
|
141
|
-
get error() {
|
|
142
|
-
if (this._linkingError) return this._linkingError;
|
|
143
|
-
if (!(this.items.length > 0)) return this._linkingError = s.createLinkingError({
|
|
144
|
-
reference: c,
|
|
145
|
-
container: e,
|
|
146
|
-
property: n
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
return c;
|
|
151
|
-
}
|
|
152
|
-
throwCyclicReferenceError(e, n, r) {
|
|
153
|
-
throw Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(e)}/${n} (symbol '${r}')`);
|
|
154
|
-
}
|
|
155
|
-
getLinkedNode(e) {
|
|
156
|
-
try {
|
|
157
|
-
let n = this.getCandidate(e);
|
|
158
|
-
if (isLinkingError(n)) return { error: n };
|
|
159
|
-
let i = this.loadAstNode(n);
|
|
160
|
-
return i ? {
|
|
161
|
-
node: i,
|
|
162
|
-
descr: n
|
|
163
|
-
} : {
|
|
164
|
-
descr: n,
|
|
165
|
-
error: this.createLinkingError(e, n)
|
|
166
|
-
};
|
|
167
|
-
} catch (n) {
|
|
168
|
-
console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`, n);
|
|
169
|
-
let r = n.message ?? String(n);
|
|
170
|
-
return { error: {
|
|
171
|
-
info: e,
|
|
172
|
-
message: `An error occurred while resolving reference to '${e.reference.$refText}': ${r}`
|
|
173
|
-
} };
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
loadAstNode(e) {
|
|
177
|
-
if (e.node) return e.node;
|
|
178
|
-
let n = this.langiumDocuments().getDocument(e.documentUri);
|
|
179
|
-
if (n) return this.astNodeLocator.getAstNode(n.parseResult.value, e.path);
|
|
180
|
-
}
|
|
181
|
-
createLinkingError(e, n) {
|
|
182
|
-
let r = findRootNode(e.container).$document;
|
|
183
|
-
return r && r.state < DocumentState.ComputedScopes && console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`), {
|
|
184
|
-
info: e,
|
|
185
|
-
message: `Could not resolve reference to ${this.reflection.getReferenceType(e)} named '${e.reference.$refText}'.`,
|
|
186
|
-
targetDescription: n
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
export { DefaultLinker, RefResolving };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { findNodeForProperty } from "../utils/grammar-utils.js";
|
|
2
|
-
function isNamed(e) {
|
|
3
|
-
return typeof e.name == "string";
|
|
4
|
-
}
|
|
5
|
-
var DefaultNameProvider = class {
|
|
6
|
-
getName(e) {
|
|
7
|
-
if (isNamed(e)) return e.name;
|
|
8
|
-
}
|
|
9
|
-
getNameNode(n) {
|
|
10
|
-
return findNodeForProperty(n.$cstNode, "name");
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
export { DefaultNameProvider, isNamed };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { isMultiReference, isReference } from "../syntax-tree.js";
|
|
2
|
-
import { stream } from "../utils/stream.js";
|
|
3
|
-
import { getDocument, getReferenceNodes, streamAst, streamReferences } from "../utils/ast-utils.js";
|
|
4
|
-
import { isCrossReference } from "../languages/generated/ast.js";
|
|
5
|
-
import { isChildNode, toDocumentSegment } from "../utils/cst-utils.js";
|
|
6
|
-
import { findAssignment } from "../utils/grammar-utils.js";
|
|
7
|
-
import { UriUtils } from "../utils/uri-utils.js";
|
|
8
|
-
var DefaultReferences = class {
|
|
9
|
-
constructor(e) {
|
|
10
|
-
this.nameProvider = e.references.NameProvider, this.index = e.shared.workspace.IndexManager, this.nodeLocator = e.workspace.AstNodeLocator, this.documents = e.shared.workspace.LangiumDocuments, this.hasMultiReference = streamAst(e.Grammar).some((e) => isCrossReference(e) && e.isMulti);
|
|
11
|
-
}
|
|
12
|
-
findDeclarations(c) {
|
|
13
|
-
if (c) {
|
|
14
|
-
let l = findAssignment(c), d = c.astNode;
|
|
15
|
-
if (l && d) {
|
|
16
|
-
let f = d[l.feature];
|
|
17
|
-
if (isReference(f) || isMultiReference(f)) return getReferenceNodes(f);
|
|
18
|
-
if (Array.isArray(f)) {
|
|
19
|
-
for (let l of f) if ((isReference(l) || isMultiReference(l)) && l.$refNode && l.$refNode.offset <= c.offset && l.$refNode.end >= c.end) return getReferenceNodes(l);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (d) {
|
|
23
|
-
let e = this.nameProvider.getNameNode(d);
|
|
24
|
-
if (e && (e === c || isChildNode(c, e))) return this.getSelfNodes(d);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
getSelfNodes(s) {
|
|
30
|
-
if (this.hasMultiReference) {
|
|
31
|
-
let c = this.index.findAllReferences(s, this.nodeLocator.getAstNodePath(s)), l = this.getNodeFromReferenceDescription(c.head());
|
|
32
|
-
if (l) {
|
|
33
|
-
for (let c of streamReferences(l)) if (isMultiReference(c.reference) && c.reference.items.some((e) => e.ref === s)) return c.reference.items.map((e) => e.ref);
|
|
34
|
-
}
|
|
35
|
-
return [s];
|
|
36
|
-
} else return [s];
|
|
37
|
-
}
|
|
38
|
-
getNodeFromReferenceDescription(e) {
|
|
39
|
-
if (!e) return;
|
|
40
|
-
let s = this.documents.getDocument(e.sourceUri);
|
|
41
|
-
if (s) return this.nodeLocator.getAstNode(s.parseResult.value, e.sourcePath);
|
|
42
|
-
}
|
|
43
|
-
findDeclarationNodes(e) {
|
|
44
|
-
let s = this.findDeclarations(e), c = [];
|
|
45
|
-
for (let e of s) {
|
|
46
|
-
let s = this.nameProvider.getNameNode(e) ?? e.$cstNode;
|
|
47
|
-
s && c.push(s);
|
|
48
|
-
}
|
|
49
|
-
return c;
|
|
50
|
-
}
|
|
51
|
-
findReferences(e, s) {
|
|
52
|
-
let l = [];
|
|
53
|
-
s.includeDeclaration && l.push(...this.getSelfReferences(e));
|
|
54
|
-
let u = this.index.findAllReferences(e, this.nodeLocator.getAstNodePath(e));
|
|
55
|
-
return s.documentUri && (u = u.filter((e) => UriUtils.equals(e.sourceUri, s.documentUri))), l.push(...u), stream(l);
|
|
56
|
-
}
|
|
57
|
-
getSelfReferences(e) {
|
|
58
|
-
let s = this.getSelfNodes(e), c = [];
|
|
59
|
-
for (let e of s) {
|
|
60
|
-
let s = this.nameProvider.getNameNode(e);
|
|
61
|
-
if (s) {
|
|
62
|
-
let u = getDocument(e), d = this.nodeLocator.getAstNodePath(e);
|
|
63
|
-
c.push({
|
|
64
|
-
sourceUri: u.uri,
|
|
65
|
-
sourcePath: d,
|
|
66
|
-
targetUri: u.uri,
|
|
67
|
-
targetPath: d,
|
|
68
|
-
segment: toDocumentSegment(s),
|
|
69
|
-
local: !0
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return c;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
export { DefaultReferences };
|