We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
\
Take this simple grammer:
grammar = ` str ::= '"' (unsafe | SAFE)* '"' SAFE ::= #x21 | [#x24-#x5A] | [#x5E-#x7A] | #x7C | #x7E unsafe ::= ESCAPE #x22 ESCAPE ::= #x5C `
If we define a raw string as follows:
str = String.raw`"stringwith\"escapes"` console.log(str)
We get the representation:
"stringwith\"escapes"
Now if we define rules and a parser for this grammar and run it on that raw string:
rules = ebnf.Grammars.W3C.getRules(grammar) parser = new ebnf.Parser(rules) ast = parser.getAST(str) console.log(ast)
We see the ast:
<ref *1> { type: 'str', text: '"stringwith\\"escapes"', children: [ { type: 'unsafe', text: '\\"', children: [], end: 13, errors: [], fullText: '', parent: [Circular *1], start: 11, rest: '' } ], end: 21, errors: [], fullText: '', parent: null, start: 0, rest: '' }
The text property of both the parent str and child unsafe have had the \ re-escaped. I don't think this re-escapement should happen for raw strings.
text
str
unsafe
You can see a basic example here: https://github.com/dmfxyz/node-ebnf-issue-example And the repo in which we originally discovered this behavior: nmushegian/jams#23
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Take this simple grammer:
If we define a raw string as follows:
We get the representation:
Now if we define rules and a parser for this grammar and run it on that raw string:
We see the ast:
The
text
property of both the parentstr
and childunsafe
have had the\
re-escaped. I don't think this re-escapement should happen for raw strings.You can see a basic example here: https://github.com/dmfxyz/node-ebnf-issue-example
And the repo in which we originally discovered this behavior: nmushegian/jams#23
The text was updated successfully, but these errors were encountered: