-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
(ebnf) add backtick (grave symbol) as string character #2290
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, although the wikipedia article on EBNF and some EBNF standards I've searched have no mention on backticks, Golang specification (https://golang.org/ref/spec) uses them.
PR looks good to me. @vancluever, please add a changelog entry.
Ping. |
Hey @egor-rogov and @yyyc514, sorry for the delays on this one. Will add an entry shortly. |
This adds backticks as an allowed character for terminal strings. This is necessary for describing backslashes properly as using single or double quotes seems to cause parsing issues with highlight.js. It also has precedent in some EBNF-described specifications such as the Go specification.
Changelog has been updated now! |
I’m not sure I follow what you mean here? |
This can be seen in the developer preview. Try doing a grammar that uses |
@vancluever Still not sure I follow. Can you make a reproducible example? You can fork my jsfiddle template: https://jsfiddle.net/ajoshguy/a1kntyg4/ Example worth 1000 words. :) |
@yyyc514 https://jsfiddle.net/ksv9Lqcz/ should give a good idea of what's going on! |
Yes, indeed. EBNF is just reusing Does EBNF not have such escape sequences in strings? Or are they only valid in some types of strings but not others? |
Can't comment for sure, but I don't know if there's any accepted standard, to be honest. But I have never really been able to find any sort of escaping standard, and I don't really know if a language for a context-free grammar should even have them. Our Sentinel specification follows the example of the Go spec in the use of backticks, however, so we will need them regardless of whether or not we fix the escaping. |
Escaping is mentioned here: https://www.w3.org/Notation.html and specifically:
That's regarding BNF, but still... |
From Google's docs:
I think the backtick is specifically for avoiding the need to double escape Another example where it looks like it's used for escaping: So I'm thinking our existing behavior with normal strings is correct and NOT an issue. @egor-rogov Any insight to add here? |
Holding this a bit longer since I'll adjust the commit text based on our conclusions here. |
I think so too. |
Nor do I, but the original commit message make it sound like Highlight.js is BROKEN with regard to our standard string handling here. So I'm just trying to clear up if we still have an actual problem or if that original message was in error so that I can write a proper one when I merge this. :) |
Thanks @yyyc514 and @egor-rogov! |
This adds backticks as an allowed character for terminal strings.
This is necessary for describing backslashes properly as using single or
double quotes seems to cause parsing issues with highlight.js. It also
has precedent in some EBNF-described specifications such as the Go
specification.