Skip to content
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

Only highlight control escapes in RegExp #1195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kevinoid
Copy link

The \\c + ASCII letter escape sequence is not specified as part of the EscapeSequence production in the grammar for strings. It behaves like any other unspecified character by ignoring the backslash. The escape sequence is only specified as part of the CharacterEscape production in the grammar for RegExp patterns, where it matches a character with the letter's codepoint mod 32 (which is the same for uppercase and lowercase ASCII letters).

This PR updates the syntax to highlight both uppercase and lowercase letters in RegExp and neither in strings.

Thanks for considering,
Kevin

The `\\c + ASCII letter` escape sequence is not specified as part of the
[EscapeSequence] production in the grammar for strings.  It behaves like
any other unspecified character by ignoring the backslash.  The escape
sequence is only specified as part of the [CharacterEscape] production
in the grammar for RegExp patterns, where it matches a character with
the letter's codepoint mod 32 (which is the same for uppercase and
lowercase ASCII letters).

Update the syntax to highlight both uppercase and lowercase letters in
RegExp and neither in strings.

[CharacterEscape]: https://www.ecma-international.org/ecma-262/#prod-CharacterEscape
[EscapeSequence]: https://www.ecma-international.org/ecma-262/#prod-EscapeSequence

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant