mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
2 lines (1 loc) • 2.12 kB
JavaScript
import{a,b as m,c as d}from"./chunk-Y5NT6LW5.mjs";import{a as s}from"./chunk-V3KJR4XU.mjs";import{b as p}from"./chunk-Y5O5OPKC.mjs";import"./chunk-3T2MNPEU.mjs";import"./chunk-MLQVGYRW.mjs";import"./chunk-QX7LGXZU.mjs";import"./chunk-22SYA5HA.mjs";import"./chunk-YZG4BXY6.mjs";import"./chunk-NRRTYJAG.mjs";import"./chunk-CVBX6EWK.mjs";import{b as n}from"./chunk-RXM7Z7NK.mjs";import"./chunk-HI3EPXIC.mjs";import"./chunk-5NYYYZGL.mjs";import"./chunk-H7BX327W.mjs";import"./chunk-LIEGGFIX.mjs";import"./chunk-LLWYPJEZ.mjs";import"./chunk-2FTYKNOQ.mjs";import"./chunk-36VM3LGA.mjs";import"./chunk-44AU3KAP.mjs";import"./chunk-S4TE5DX6.mjs";import"./chunk-FE53TMRB.mjs";import{b as t}from"./chunk-L2B47AAZ.mjs";import{a as o}from"./chunk-QVIEFLGF.mjs";var u=n().Railroad.parser.LangiumParser,i=o(r=>{switch(r.$type){case"RailroadTerminalExpr":return{type:"terminal",value:r.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:r.name};case"RailroadSpecialExpr":return{type:"special",text:r.text};case"RailroadSequenceExpr":{let e=r.elements.map(i);return e.length===1?e[0]:{type:"sequence",elements:e}}case"RailroadChoiceExpr":{let e=r.alternatives.map(i);return e.length===1?e[0]:{type:"choice",alternatives:e}}case"RailroadOptionalExpr":return{type:"optional",element:i(r.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:i(r.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:i(r.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${r.$type}`)}},"transformExpression"),c=o(r=>({name:r.name,definition:i(r.definition)}),"transformRule"),y=o(r=>{s(r,a),r.title&&a.setTitle(r.title),r.rules.map(e=>a.addRule(c(e)))},"populateDb"),R={parse:o(r=>{a.clear(),t.debug("[Railroad Parser] Starting Langium parse");let e=u.parse(r);if(e.lexerErrors.length>0||e.parserErrors.length>0)throw new p(e);let l=e.value;t.debug("[Railroad Parser] Parsed rules:",l.rules.length),y(l),t.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:a}};var E={parser:R,db:a,renderer:d,styles:m},b=E;export{b as default,E as diagram};