From 8de0c1a009ffd991fb10536621c97e64e125955f Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 5 Mar 2024 12:27:03 +0100 Subject: [PATCH] fix: Ensure the longest \r\n match is first in AsciiEscape --- crates/solidity/inputs/language/src/definition.rs | 4 ++-- crates/solidity/outputs/spec/generated/grammar.ebnf | 2 +- .../spec/generated/public/05-expressions/05-strings.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 50686769a2..7d132d10e7 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -3912,9 +3912,9 @@ codegen_language_macros::compile!(Language( Atom("'"), Atom("\""), Atom("\\"), - Atom("\n"), + Atom("\r\n"), Atom("\r"), - Atom("\r\n") + Atom("\n") ]) ), Fragment( diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index 0332323945..53395eb41a 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -1292,7 +1292,7 @@ DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' " «ESCAPE_SEQUENCE» = "\\" («ASCII_ESCAPE» | «HEX_BYTE_ESCAPE» | «UNICODE_ESCAPE»); -«ASCII_ESCAPE» = "n" | "r" | "t" | "'" | '"' | "\\" | "\n" | "\r" | "\r\n"; +«ASCII_ESCAPE» = "n" | "r" | "t" | "'" | '"' | "\\" | "\r\n" | "\r" | "\n"; «HEX_BYTE_ESCAPE» = "x" «HEX_CHARACTER» «HEX_CHARACTER»; diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md b/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md index df0ae3c24d..5dca5d285b 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md @@ -104,7 +104,7 @@ ``` -
«ASCII_ESCAPE» = "n" | "r" | "t" | "'" | '"' | "\\" | "\n" | "\r" | "\r\n";
+
«ASCII_ESCAPE» = "n" | "r" | "t" | "'" | '"' | "\\" | "\r\n" | "\r" | "\n";
```{ .ebnf #HexByteEscape }