-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-alpha characters included in ALPHA token (flow graph jison) #232
Comments
That makes sense. I suspect that is a remainder from early days when text in nodes was ALPHA and NUM. Now, you would still want to be able to represent a diagram like the one below:
But alphaNumTokens are:
So that should not be a problem. On that note, what do you think of a syntax for elipses somethinng like the suggestion below:
Would you be interested in adding that as well? |
Also ... a heads up ... I have started to slowly move to es2015 syntax in mermaid. For instance multiline strings are quite convenient when setting up testtexts to parse. However ... it is suddenly crucial to run things in strict mode. There is an issue in jison that makes the parsers not run in struct mode: as a result of that, if you work with the grammar:
Good luck! |
OK, thanks for letting me know! Tests in master are failing for me right now. Not sure if this is because I'm on node 0.10.38 or something changed in jison's master (probably not as last commit is from 12 days ago). Re ellipse syntax: |
Hi,
I've started looking into the problem of keywords not being valid suffixes of node ids (eg. monograph, upperclass, suspend) and there's a few things I've noticed.
The regex for ALPHA token matches lots of non-alpha characters like
!"#$%&'*+,-.?
.See here: https://github.com/knsv/mermaid/blob/master/src/diagrams/flowchart/parser/flow.jison#L66
cc @codebeige
I guess these should be a different token, right? Some of them already have their token (COMMA, MULT, DOT), which works fine only because their definitions are above and the regex for ALPHA only matches a single character.
To fix the keyword suffixes problem, I thought I'd add a
+
to ALPHA token regex, so that it matches the whole string of alpha characters (eg. suspend) and keywords are only detected when ALPHA has ended. For that to work, meaningful characters like,
would have to be excluded.I've tried that and it seems to work (all tests pass), but I'm wondering if there were any reasons for ALPHA matching a single character and including punctuation.
Here's a small ruby script translating these regex ranges into human readable format: https://gist.github.com/spect88/da79e44bdd2c98e326d4
The text was updated successfully, but these errors were encountered: