From bed05ce0619eac4ff26478a145559a9b59f84d6f Mon Sep 17 00:00:00 2001 From: Ibrahim Wassouf Date: Sat, 29 Jul 2023 21:23:05 -0300 Subject: [PATCH] Disallow any vertex shape start or end token in any text state --- packages/mermaid/src/diagrams/flowchart/parser/flow.jison | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mermaid/src/diagrams/flowchart/parser/flow.jison b/packages/mermaid/src/diagrams/flowchart/parser/flow.jison index e8f0775b8..49a56e82b 100644 --- a/packages/mermaid/src/diagrams/flowchart/parser/flow.jison +++ b/packages/mermaid/src/diagrams/flowchart/parser/flow.jison @@ -143,7 +143,7 @@ that id. <*>\s*\~\~[\~]+\s* return 'LINK'; [-/\)][\)] { this.popState(); return '-)'; } -[^/)]|-/!\)+ return "TEXT" +[^\(\)\[\]\{\}]|-/!\)+ return "TEXT" <*>"(-" { this.pushState("ellipseText"); return '(-'; } "])" { this.popState(); return 'STADIUMEND'; } @@ -164,7 +164,7 @@ that id. [\\(?=\])][\]] { this.popState(); return 'TRAPEND'; } \/(?=\])\] { this.popState(); return 'INVTRAPEND'; } -\/(?!\])|\\(?!\])|[^\\\]\/]+ return 'TEXT'; +\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+ return 'TEXT'; <*>"[/" { this.pushState("trapText"); return 'TRAPSTART'; } <*>"[\\" { this.pushState("trapText"); return 'INVTRAPSTART'; } @@ -251,7 +251,7 @@ that id. (\}) { this.popState(); return 'DIAMOND_STOP' } <*>"{" { this.pushState("text"); return 'DIAMOND_START' } -[^\]\)\}\|\"]+ return "TEXT"; +[^\[\]\(\)\{\}\|\"]+ return "TEXT"; "\"" return 'QUOTE'; (\r?\n)+ return 'NEWLINE';