Skip to content

Commit

Permalink
Changes to gnatt.jison
Browse files Browse the repository at this point in the history
1. Removed the hash and semicolon symbols from the title regex to allow for their use.
2. Removed the hash and semicolon symbols from the section regex to allow for their use.
3. Removed the hash and semicolon symbols for the taskTxt regex to allow for their use. I did not remove the colon because the parser fails to recognize when the actual taskData begins if that distinctions isn't kept.
4. Removed the regex \#[^\n]* which skipped comments to fix some bugs with hash symbols in the taskTxt. I tested this changed by putting it back and using the comment  to see if it was recognized as a comment, but I would receive a syntax error and the diagram would not be rendered. So, I think we can safely remove that line, BUT it would be best practice if someone else tested this change to ensure that this will not break anyone's Gantt diagrams.
  • Loading branch information
FutzMonitor committed Dec 2, 2023
1 parent f81e4d4 commit f02dfe6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/mermaid/src/diagrams/gantt/parser/gantt.jison
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
%lex

%options case-insensitive
%options case-insensitivegit

%x click
%x href
Expand All @@ -31,7 +31,6 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili

[\n]+ return 'NL';
\s+ /* skip whitespace */
\#[^\n]* /* skip comments */
\%%[^\n]* /* skip comments */

/*
Expand Down Expand Up @@ -86,10 +85,10 @@ weekday\s+friday return 'weekday_friday'
weekday\s+saturday return 'weekday_saturday'
weekday\s+sunday return 'weekday_sunday'
\d\d\d\d"-"\d\d"-"\d\d return 'date';
"title"\s[^#\n;]+ return 'title';
"title"\s[^\n]+ return 'title';
"accDescription"\s[^#\n;]+ return 'accDescription'
"section"\s[^#:\n;]+ return 'section';
[^#:\n;]+ return 'taskTxt';
"section"\s[^\n]+ return 'section';
[^:\n]+ return 'taskTxt';
":"[^#\n;]+ return 'taskData';
":" return ':';
<<EOF>> return 'EOF';
Expand Down

0 comments on commit f02dfe6

Please sign in to comment.