You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, notice the redundancy: both '\n' and '\\n' are parsed as "\n". But, more importantly, notice that '\n' is treated as valid.
A user who forgets which characters need to be escaped might think that '\n' represents a string consisting of a newline character. Allowing this to parse is potentially unhelpful.
If we remove the redundancy, we can fail unsupported escape sequences (and allow for other escape sequences to be added in future).
Currently, Proposal A uses the following (PEG.js) syntax for child names that can appear in brackets with single quotes:
Using an online evaluator for PEG.js and feeding in
selector.peg
, observe that the selector:parses to:
Firstly, notice the redundancy: both
'\n'
and'\\n'
are parsed as"\n"
. But, more importantly, notice that'\n'
is treated as valid.A user who forgets which characters need to be escaped might think that
'\n'
represents a string consisting of a newline character. Allowing this to parse is potentially unhelpful.If we remove the redundancy, we can fail unsupported escape sequences (and allow for other escape sequences to be added in future).
For example, the alternative syntax:
fails to parse
'\n'
with the messageExpected "'", "\\'", "\\\\", or [^'\\] but "\\" found
, but loses no expressive power.The text was updated successfully, but these errors were encountered: