Skip to content

Commit

Permalink
fix: Mention that not only ASCII can be "escaped" verbatim
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Apr 10, 2024
1 parent 957d215 commit 64c728d
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 45 deletions.
19 changes: 8 additions & 11 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3820,13 +3820,13 @@ codegen_language_macros::compile!(Language(
Token(
name = SingleQuotedStringLiteral,
definitions = [
// Allows unicode characters and arbitrary ASCII escape sequences:
// Allows unicode characters and arbitrary escape sequences:
TokenDefinition(
enabled = Till("0.4.25"),
scanner = Sequence([
Atom("'"),
ZeroOrMore(Choice([
Fragment(EscapeSequenceArbitraryAscii),
Fragment(EscapeSequenceArbitrary),
Not(['\'', '\\', '\r', '\n'])
])),
Atom("'")
Expand Down Expand Up @@ -3862,13 +3862,13 @@ codegen_language_macros::compile!(Language(
Token(
name = DoubleQuotedStringLiteral,
definitions = [
// Allows unicode characters and arbitrary ASCII escape sequences:
// Allows unicode characters and arbitrary escape sequences:
TokenDefinition(
enabled = Till("0.4.25"),
scanner = Sequence([
Atom("\""),
ZeroOrMore(Choice([
Fragment(EscapeSequenceArbitraryAscii),
Fragment(EscapeSequenceArbitrary),
Not(['"', '\\', '\r', '\n'])
])),
Atom("\"")
Expand Down Expand Up @@ -4006,12 +4006,14 @@ codegen_language_macros::compile!(Language(
])
),
Fragment(
name = EscapeSequenceArbitraryAscii,
name = EscapeSequenceArbitrary,
enabled = Till("0.4.25"),
scanner = Sequence([
Atom("\\"),
Choice([
Fragment(AsciiEscapeArbitrary),
// Prior to 0.4.25, it was legal to "escape" any character (incl. unicode),
// however only the ones from `AsciiEscape` were escaped in practice.
Not(['x', 'u']),
Fragment(HexByteEscape),
Fragment(UnicodeEscape)
])
Expand All @@ -4031,11 +4033,6 @@ codegen_language_macros::compile!(Language(
Atom("\n")
])
),
Fragment(
name = AsciiEscapeArbitrary,
enabled = Till("0.4.25"),
scanner = Not(['x', 'u'])
),
Fragment(
name = HexByteEscape,
scanner = Sequence([
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions crates/solidity/outputs/spec/generated/grammar.ebnf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 64c728d

Please sign in to comment.