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
When parsing strings, the entire width of the string attempted to be matched is pushed into the caret. But this can lead to odd results like this one:
(line 1, column 3):
unexpected "ud8"
expected "&", end of escape sequence, or string gap
invalid escape sequence
>"\ud800"
^^^
Here, the error really should read unexpected "u", but because escape sequences contain 3 letter strings, it is stretched. One way to change the semantics would be to only demand a character as wide as the string actually could match + 1, instead of the whole string.
Another approach, suggested by Aly on the discord, would be to cap the caret at the minimum of the viable alternative demands (sans 0). This scheme also seems reasonable and would fix the above issue (incidentally, mind). The min/max behaviour could even be controlled at the ErrorBuilder level, perhaps?
Regardless, it's arguable this above problem occurs because the labelling of the escape sequence hides information about the length of the underlying options... Is there a way to fix in this case?
This discussion was converted from issue #209 on July 23, 2023 12:56.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When parsing strings, the entire width of the string attempted to be matched is pushed into the caret. But this can lead to odd results like this one:
Here, the error really should read
unexpected "u"
, but because escape sequences contain 3 letter strings, it is stretched. One way to change the semantics would be to only demand a character as wide as the string actually could match + 1, instead of the whole string.Another approach, suggested by Aly on the discord, would be to cap the caret at the minimum of the viable alternative demands (sans 0). This scheme also seems reasonable and would fix the above issue (incidentally, mind). The min/max behaviour could even be controlled at the
ErrorBuilder
level, perhaps?Regardless, it's arguable this above problem occurs because the labelling of the escape sequence hides information about the length of the underlying options... Is there a way to fix in this case?
Beta Was this translation helpful? Give feedback.
All reactions