From 006a2b33febc3c23277ef91144a66092d02e5347 Mon Sep 17 00:00:00 2001 From: OmarTawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Sun, 5 Jan 2025 07:09:56 -0800 Subject: [PATCH] fix ebnf writer bugs - `Scanner::Not` was serialized to a sequence, not a choice. - render negative lookaheads, as it was hidden. - change `Expression::Range` to primary expression. --- crates/codegen/ebnf/src/builder.rs | 9 ++- crates/codegen/ebnf/src/model.rs | 10 +++- crates/codegen/ebnf/src/serializer.rs | 9 ++- .../generated/cst/generated/terminal_kind.rs | 44 +++++++-------- .../src/generated/interface/generated/cst.wit | 44 +++++++-------- .../outputs/spec/generated/grammar.ebnf | 56 +++++++++---------- .../01-file-structure/03-pragma-directives.md | 2 +- .../public/01-file-structure/06-trivia.md | 8 +-- .../01-file-structure/09-punctuation.md | 2 +- .../public/05-expressions/04-numbers.md | 6 +- .../public/05-expressions/05-strings.md | 12 ++-- .../public/05-expressions/06-identifiers.md | 4 +- .../public/06-yul/02-yul-expressions.md | 4 +- .../generated/cst/generated/terminal_kind.rs | 6 +- .../src/generated/interface/generated/cst.wit | 6 +- 15 files changed, 118 insertions(+), 104 deletions(-) diff --git a/crates/codegen/ebnf/src/builder.rs b/crates/codegen/ebnf/src/builder.rs index 93e33e1b36..a37ebfb7c5 100644 --- a/crates/codegen/ebnf/src/builder.rs +++ b/crates/codegen/ebnf/src/builder.rs @@ -466,7 +466,7 @@ impl Builder { let expression = if chars.len() == 1 { Expression::new_atom(chars[0].to_string()) } else { - Expression::new_sequence( + Expression::new_choice( chars .iter() .map(|ch| Expression::new_atom(ch.to_string())) @@ -485,8 +485,11 @@ impl Builder { Scanner::Atom { atom } => Expression::new_atom(atom.clone()), Scanner::TrailingContext { scanner, - not_followed_by: _, - } => Self::build_scanner(scanner), + not_followed_by, + } => Expression::new_sequence(vec![ + Self::build_scanner(scanner), + Expression::new_negative_look_ahead(Self::build_scanner(not_followed_by).into()), + ]), Scanner::Fragment { reference } => Self::build_ref(None, reference), } } diff --git a/crates/codegen/ebnf/src/model.rs b/crates/codegen/ebnf/src/model.rs index 6046564c88..334186ab0b 100644 --- a/crates/codegen/ebnf/src/model.rs +++ b/crates/codegen/ebnf/src/model.rs @@ -89,6 +89,9 @@ pub enum Expression { Atom { atom: String, }, + NegativeLookAhead { + expression: Box, + }, Reference { leading_comment: Option, reference: Identifier, @@ -101,7 +104,7 @@ impl Expression { // This separates members of the same precedence, like both "a b (c | d)" and "a | b | (c d)". match self { // Binary - Self::Choice { .. } | Self::Range { .. } | Self::Sequence { .. } => 1, + Self::Choice { .. } | Self::Sequence { .. } => 1, // Prefix Self::Not { .. } => 2, @@ -110,7 +113,10 @@ impl Expression { Self::OneOrMore { .. } | Self::Optional { .. } | Self::ZeroOrMore { .. } => 3, // Primary - Self::Atom { .. } | Self::Reference { .. } => 4, + Self::Range { .. } + | Self::Atom { .. } + | Self::NegativeLookAhead { .. } + | Self::Reference { .. } => 4, } } } diff --git a/crates/codegen/ebnf/src/serializer.rs b/crates/codegen/ebnf/src/serializer.rs index 59faf86efe..60bdb57477 100644 --- a/crates/codegen/ebnf/src/serializer.rs +++ b/crates/codegen/ebnf/src/serializer.rs @@ -140,13 +140,18 @@ impl<'s, W: EbnfWriter> Serializer<'s, W> { inclusive_start, inclusive_end, } => { - self.serialize_child_expr(parent, inclusive_start)?; + self.serialize_expr(inclusive_start)?; self.serialize_punctuation("…")?; - self.serialize_child_expr(parent, inclusive_end)?; + self.serialize_expr(inclusive_end)?; } Expression::Atom { atom } => { self.serialize_string_literal(atom)?; } + Expression::NegativeLookAhead { expression } => { + self.serialize_punctuation("(?!")?; + self.serialize_expr(expression)?; + self.serialize_punctuation(")")?; + } Expression::Reference { leading_comment, reference, diff --git a/crates/solidity/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs b/crates/solidity/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs index 5cbaf290c5..352d7dabbc 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs @@ -207,18 +207,18 @@ pub enum TerminalKind { /// ``` DaysKeyword, /// ```ebnf - /// DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» (?!".") «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// /// (* Deprecated in 0.5.0 *) - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." (?!«DECIMAL_DIGITS») «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// /// (* Deprecated in 0.5.0 *) - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// /// (* Introduced in 0.5.0 *) - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// ``` DecimalLiteral, /// ```ebnf @@ -244,17 +244,17 @@ pub enum TerminalKind { DoubleQuotedHexStringLiteral, /// ```ebnf /// (* Deprecated in 0.4.25 *) - /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' "\\" "\r" "\n"))* '"'; + /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' | "\\" | "\r" | "\n"))* '"'; /// /// (* Introduced in 0.4.25 and deprecated in 0.7.0. *) - /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; + /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; /// - /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | (" "…"!") | ("#"…"[") | ("]"…"~"))* '"'; + /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | " "…"!" | "#"…"[" | "]"…"~")* '"'; /// ``` DoubleQuotedStringLiteral, /// ```ebnf /// (* Introduced in 0.7.0 *) - /// DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; + /// DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; /// ``` DoubleQuotedUnicodeStringLiteral, /// ```ebnf @@ -406,10 +406,10 @@ pub enum TerminalKind { /// ``` HexKeyword, /// ```ebnf - /// HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; + /// HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»); /// /// (* Deprecated in 0.5.0 *) - /// HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; + /// HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»); /// ``` HexLiteral, /// ```ebnf @@ -533,11 +533,11 @@ pub enum TerminalKind { /// ``` ModifierKeyword, /// ```ebnf - /// MULTI_LINE_COMMENT = "/*" (!"*" | "*")* "*/"; + /// MULTI_LINE_COMMENT = "/*" (?!"*" !"/") (!"*" | ("*" (?!"/")))* "*/"; /// ``` MultiLineComment, /// ```ebnf - /// MULTI_LINE_NAT_SPEC_COMMENT = "/**" (!"*" | "*")* "*/"; + /// MULTI_LINE_NAT_SPEC_COMMENT = "/**" (?!"/") (!"*" | ("*" (?!"/")))* "*/"; /// ``` MultiLineNatSpecComment, /// ```ebnf @@ -676,11 +676,11 @@ pub enum TerminalKind { /// ``` Semicolon, /// ```ebnf - /// SINGLE_LINE_COMMENT = "//" (!("\r" "\n"))*; + /// SINGLE_LINE_COMMENT = "//" (?!"/") (!("\r" | "\n"))*; /// ``` SingleLineComment, /// ```ebnf - /// SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" "\n"))*; + /// SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" | "\n"))*; /// ``` SingleLineNatSpecComment, /// ```ebnf @@ -689,17 +689,17 @@ pub enum TerminalKind { SingleQuotedHexStringLiteral, /// ```ebnf /// (* Deprecated in 0.4.25 *) - /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" "\\" "\r" "\n"))* "'"; + /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" | "\\" | "\r" | "\n"))* "'"; /// /// (* Introduced in 0.4.25 and deprecated in 0.7.0. *) - /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'"; + /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'"; /// - /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | (" "…"&") | ("("…"[") | ("]"…"~"))* "'"; + /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | " "…"&" | "("…"[" | "]"…"~")* "'"; /// ``` SingleQuotedStringLiteral, /// ```ebnf /// (* Introduced in 0.7.0 *) - /// SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'"; + /// SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'"; /// ``` SingleQuotedUnicodeStringLiteral, /// ```ebnf @@ -712,7 +712,7 @@ pub enum TerminalKind { /// ``` SizeOfKeyword, /// ```ebnf - /// SLASH = "/"; + /// SLASH = "/" (?!"*" | "/" | "="); /// ``` Slash, /// ```ebnf @@ -1062,7 +1062,7 @@ pub enum TerminalKind { /// ``` YulDaysKeyword, /// ```ebnf - /// YUL_DECIMAL_LITERAL = "0" | (("1"…"9") ("0"…"9")*); + /// YUL_DECIMAL_LITERAL = ("0" | ("1"…"9" "0"…"9"*)) (?!«IDENTIFIER_START»); /// ``` YulDecimalLiteral, /// ```ebnf @@ -1219,7 +1219,7 @@ pub enum TerminalKind { /// ``` YulHexKeyword, /// ```ebnf - /// YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+; + /// YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+ (?!«IDENTIFIER_START»); /// ``` YulHexLiteral, /// ```ebnf diff --git a/crates/solidity/outputs/cargo/wasm/src/generated/interface/generated/cst.wit b/crates/solidity/outputs/cargo/wasm/src/generated/interface/generated/cst.wit index 8fead7e3ad..83dd28adde 100644 --- a/crates/solidity/outputs/cargo/wasm/src/generated/interface/generated/cst.wit +++ b/crates/solidity/outputs/cargo/wasm/src/generated/interface/generated/cst.wit @@ -2368,18 +2368,18 @@ interface cst { /// This kind represents a `DecimalLiteral` node, with the following structure: /// /// ```ebnf - /// DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» (?!".") «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// /// (* Deprecated in 0.5.0 *) - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." (?!«DECIMAL_DIGITS») «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// /// (* Deprecated in 0.5.0 *) - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// /// (* Introduced in 0.5.0 *) - /// DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»?; + /// DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); /// ``` %decimal-literal, /// This kind represents a `DefaultKeyword` node, with the following structure: @@ -2417,19 +2417,19 @@ interface cst { /// /// ```ebnf /// (* Deprecated in 0.4.25 *) - /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' "\\" "\r" "\n"))* '"'; + /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' | "\\" | "\r" | "\n"))* '"'; /// /// (* Introduced in 0.4.25 and deprecated in 0.7.0. *) - /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; + /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; /// - /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | (" "…"!") | ("#"…"[") | ("]"…"~"))* '"'; + /// DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | " "…"!" | "#"…"[" | "]"…"~")* '"'; /// ``` %double-quoted-string-literal, /// This kind represents a `DoubleQuotedUnicodeStringLiteral` node, with the following structure: /// /// ```ebnf /// (* Introduced in 0.7.0 *) - /// DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; + /// DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; /// ``` %double-quoted-unicode-string-literal, /// This kind represents a `DoubleQuotedVersionLiteral` node, with the following structure: @@ -2645,10 +2645,10 @@ interface cst { /// This kind represents a `HexLiteral` node, with the following structure: /// /// ```ebnf - /// HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; + /// HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»); /// /// (* Deprecated in 0.5.0 *) - /// HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; + /// HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»); /// ``` %hex-literal, /// This kind represents a `HoursKeyword` node, with the following structure: @@ -2832,13 +2832,13 @@ interface cst { /// This kind represents a `MultiLineComment` node, with the following structure: /// /// ```ebnf - /// MULTI_LINE_COMMENT = "/*" (!"*" | "*")* "*/"; + /// MULTI_LINE_COMMENT = "/*" (?!"*" !"/") (!"*" | ("*" (?!"/")))* "*/"; /// ``` %multi-line-comment, /// This kind represents a `MultiLineNatSpecComment` node, with the following structure: /// /// ```ebnf - /// MULTI_LINE_NAT_SPEC_COMMENT = "/**" (!"*" | "*")* "*/"; + /// MULTI_LINE_NAT_SPEC_COMMENT = "/**" (?!"/") (!"*" | ("*" (?!"/")))* "*/"; /// ``` %multi-line-nat-spec-comment, /// This kind represents a `MutableKeyword` node, with the following structure: @@ -3041,13 +3041,13 @@ interface cst { /// This kind represents a `SingleLineComment` node, with the following structure: /// /// ```ebnf - /// SINGLE_LINE_COMMENT = "//" (!("\r" "\n"))*; + /// SINGLE_LINE_COMMENT = "//" (?!"/") (!("\r" | "\n"))*; /// ``` %single-line-comment, /// This kind represents a `SingleLineNatSpecComment` node, with the following structure: /// /// ```ebnf - /// SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" "\n"))*; + /// SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" | "\n"))*; /// ``` %single-line-nat-spec-comment, /// This kind represents a `SingleQuotedHexStringLiteral` node, with the following structure: @@ -3060,19 +3060,19 @@ interface cst { /// /// ```ebnf /// (* Deprecated in 0.4.25 *) - /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" "\\" "\r" "\n"))* "'"; + /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" | "\\" | "\r" | "\n"))* "'"; /// /// (* Introduced in 0.4.25 and deprecated in 0.7.0. *) - /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'"; + /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'"; /// - /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | (" "…"&") | ("("…"[") | ("]"…"~"))* "'"; + /// SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | " "…"&" | "("…"[" | "]"…"~")* "'"; /// ``` %single-quoted-string-literal, /// This kind represents a `SingleQuotedUnicodeStringLiteral` node, with the following structure: /// /// ```ebnf /// (* Introduced in 0.7.0 *) - /// SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'"; + /// SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'"; /// ``` %single-quoted-unicode-string-literal, /// This kind represents a `SingleQuotedVersionLiteral` node, with the following structure: @@ -3091,7 +3091,7 @@ interface cst { /// This kind represents a `Slash` node, with the following structure: /// /// ```ebnf - /// SLASH = "/"; + /// SLASH = "/" (?!"*" | "/" | "="); /// ``` %slash, /// This kind represents a `SlashEqual` node, with the following structure: @@ -3589,7 +3589,7 @@ interface cst { /// This kind represents a `YulDecimalLiteral` node, with the following structure: /// /// ```ebnf - /// YUL_DECIMAL_LITERAL = "0" | (("1"…"9") ("0"…"9")*); + /// YUL_DECIMAL_LITERAL = ("0" | ("1"…"9" "0"…"9"*)) (?!«IDENTIFIER_START»); /// ``` %yul-decimal-literal, /// This kind represents a `YulDefaultKeyword` node, with the following structure: @@ -3810,7 +3810,7 @@ interface cst { /// This kind represents a `YulHexLiteral` node, with the following structure: /// /// ```ebnf - /// YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+; + /// YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+ (?!«IDENTIFIER_START»); /// ``` %yul-hex-literal, /// This kind represents a `YulHoursKeyword` node, with the following structure: diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index e7f7fe9acf..ed1fe2f14f 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -84,7 +84,7 @@ SINGLE_QUOTED_VERSION_LITERAL = "'" «VERSION_SPECIFIER_FRAGMENT» ("." «VERSIO DOUBLE_QUOTED_VERSION_LITERAL = '"' «VERSION_SPECIFIER_FRAGMENT» ("." «VERSION_SPECIFIER_FRAGMENT»)* '"'; -«VERSION_SPECIFIER_FRAGMENT» = (("0"…"9") | "x" | "X" | "*")+; +«VERSION_SPECIFIER_FRAGMENT» = ("0"…"9" | "x" | "X" | "*")+; (* Never reserved *) ABICODER_KEYWORD = "abicoder"; @@ -181,13 +181,13 @@ WHITESPACE = (" " | "\t")+; END_OF_LINE = "\n" | ("\r" "\n"?); -SINGLE_LINE_COMMENT = "//" (!("\r" "\n"))*; +SINGLE_LINE_COMMENT = "//" (?!"/") (!("\r" | "\n"))*; -MULTI_LINE_COMMENT = "/*" (!"*" | "*")* "*/"; +MULTI_LINE_COMMENT = "/*" (?!"*" !"/") (!"*" | ("*" (?!"/")))* "*/"; -SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" "\n"))*; +SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" | "\n"))*; -MULTI_LINE_NAT_SPEC_COMMENT = "/**" (!"*" | "*")* "*/"; +MULTI_LINE_NAT_SPEC_COMMENT = "/**" (?!"/") (!"*" | ("*" (?!"/")))* "*/"; (* 1.7. Nat Spec Format: *) @@ -583,7 +583,7 @@ MINUS_MINUS = "--"; MINUS_GREATER_THAN = "->"; -SLASH = "/"; +SLASH = "/" (?!"*" | "/" | "="); SLASH_EQUAL = "/="; @@ -1485,25 +1485,25 @@ HexNumberExpression = (* literal: *) HEX_LITERAL DecimalNumberExpression = (* literal: *) DECIMAL_LITERAL (* unit: *) NumberUnit?; -HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; +HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»); (* Deprecated in 0.5.0 *) -HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; +HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»); -DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; +DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); -DECIMAL_LITERAL = «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; +DECIMAL_LITERAL = «DECIMAL_DIGITS» (?!".") «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); (* Deprecated in 0.5.0 *) -DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_EXPONENT»?; +DECIMAL_LITERAL = «DECIMAL_DIGITS» "." (?!«DECIMAL_DIGITS») «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); (* Deprecated in 0.5.0 *) -DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; +DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); (* Introduced in 0.5.0 *) -DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»?; +DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»); -«DECIMAL_DIGITS» = ("0"…"9")+ ("_" ("0"…"9")+)*; +«DECIMAL_DIGITS» = "0"…"9"+ ("_" "0"…"9"+)*; «DECIMAL_EXPONENT» = ("e" | "E") "-"? «DECIMAL_DIGITS»; @@ -1534,20 +1534,20 @@ StringLiteral = (* variant: *) SINGLE_QUOTED_STRING_LITERAL | (* variant: *) DOUBLE_QUOTED_STRING_LITERAL; (* Deprecated in 0.4.25 *) -SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" "\\" "\r" "\n"))* "'"; +SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" | "\\" | "\r" | "\n"))* "'"; (* Introduced in 0.4.25 and deprecated in 0.7.0. *) -SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'"; +SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'"; -SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | (" "…"&") | ("("…"[") | ("]"…"~"))* "'"; +SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | " "…"&" | "("…"[" | "]"…"~")* "'"; (* Deprecated in 0.4.25 *) -DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' "\\" "\r" "\n"))* '"'; +DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' | "\\" | "\r" | "\n"))* '"'; (* Introduced in 0.4.25 and deprecated in 0.7.0. *) -DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; +DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; -DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | (" "…"!") | ("#"…"[") | ("]"…"~"))* '"'; +DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | " "…"!" | "#"…"[" | "]"…"~")* '"'; (* Introduced in 0.5.14 *) HexStringLiterals = (* item: *) HexStringLiteral+; @@ -1561,7 +1561,7 @@ DOUBLE_QUOTED_HEX_STRING_LITERAL = 'hex"' «HEX_STRING_CONTENTS»? '"'; «HEX_STRING_CONTENTS» = «HEX_CHARACTER» «HEX_CHARACTER» ("_"? «HEX_CHARACTER» «HEX_CHARACTER»)*; -«HEX_CHARACTER» = ("0"…"9") | ("a"…"f") | ("A"…"F"); +«HEX_CHARACTER» = "0"…"9" | "a"…"f" | "A"…"F"; (* Introduced in 0.7.0 *) UnicodeStringLiterals = (* item: *) UnicodeStringLiteral+; @@ -1571,15 +1571,15 @@ UnicodeStringLiteral = (* variant: *) SINGLE_QUOTED_UNICODE_STRING_LITERAL | (* variant: *) DOUBLE_QUOTED_UNICODE_STRING_LITERAL; (* Introduced in 0.7.0 *) -SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'"; +SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'"; (* Introduced in 0.7.0 *) -DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; +DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; «ESCAPE_SEQUENCE» = "\\" («ASCII_ESCAPE» | «HEX_BYTE_ESCAPE» | «UNICODE_ESCAPE»); (* Deprecated in 0.4.25 *) -«ESCAPE_SEQUENCE_ARBITRARY» = "\\" (!("x" "u") | «HEX_BYTE_ESCAPE» | «UNICODE_ESCAPE»); +«ESCAPE_SEQUENCE_ARBITRARY» = "\\" (!("x" | "u") | «HEX_BYTE_ESCAPE» | «UNICODE_ESCAPE»); «ASCII_ESCAPE» = "n" | "r" | "t" | "'" | '"' | "\\" | "\r\n" | "\r" | "\n"; @@ -1593,9 +1593,9 @@ IdentifierPath = (* item: *) IDENTIFIER ((* separator: *) PERIOD (* item: *) IDE IDENTIFIER = «IDENTIFIER_START» «IDENTIFIER_PART»*; -«IDENTIFIER_START» = "_" | "$" | ("a"…"z") | ("A"…"Z"); +«IDENTIFIER_START» = "_" | "$" | "a"…"z" | "A"…"Z"; -«IDENTIFIER_PART» = «IDENTIFIER_START» | ("0"…"9"); +«IDENTIFIER_PART» = «IDENTIFIER_START» | "0"…"9"; (* * 6. Yul: @@ -1822,9 +1822,9 @@ YulLiteral = (* variant: *) YUL_TRUE_KEYWORD | (* variant: *) HexStringLiteral | (* variant: *) StringLiteral; -YUL_DECIMAL_LITERAL = "0" | (("1"…"9") ("0"…"9")*); +YUL_DECIMAL_LITERAL = ("0" | ("1"…"9" "0"…"9"*)) (?!«IDENTIFIER_START»); -YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+; +YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+ (?!«IDENTIFIER_START»); (* 6.3. Yul Keywords: *) diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md index c90ee12f58..a16ebd9062 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md @@ -110,7 +110,7 @@ ``` -
«VERSION_SPECIFIER_FRAGMENT» = (("0""9") | "x" | "X" | "*")+;
+
«VERSION_SPECIFIER_FRAGMENT» = ("0""9" | "x" | "X" | "*")+;
```{ .ebnf #AbicoderKeyword } diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/06-trivia.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/06-trivia.md index 97560ccfd8..25c7024ad0 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/06-trivia.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/06-trivia.md @@ -20,24 +20,24 @@ ``` -
SINGLE_LINE_COMMENT = "//" (!("\r" "\n"))*;
+
SINGLE_LINE_COMMENT = "//" (?!"/") (!("\r" | "\n"))*;
```{ .ebnf #MultiLineComment } ``` -
MULTI_LINE_COMMENT = "/*" (!"*" | "*")* "*/";
+
MULTI_LINE_COMMENT = "/*" (?!"*" !"/") (!"*" | ("*" (?!"/")))* "*/";
```{ .ebnf #SingleLineNatSpecComment } ``` -
SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" "\n"))*;
+
SINGLE_LINE_NAT_SPEC_COMMENT = "///" (!("\r" | "\n"))*;
```{ .ebnf #MultiLineNatSpecComment } ``` -
MULTI_LINE_NAT_SPEC_COMMENT = "/**" (!"*" | "*")* "*/";
+
MULTI_LINE_NAT_SPEC_COMMENT = "/**" (?!"/") (!"*" | ("*" (?!"/")))* "*/";
--8<-- "crates/solidity/inputs/language/docs/01-file-structure/06-trivia.md" diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md index 54011f0edd..ac3b6ece88 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/09-punctuation.md @@ -260,7 +260,7 @@ ``` -
SLASH = "/";
+
SLASH = "/" (?!"*" | "/" | "=");
```{ .ebnf #SlashEqual } diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md b/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md index 94eafff46c..de1c2c9f20 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md @@ -20,19 +20,19 @@ ``` -
HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*;

(* Deprecated in 0.5.0 *)
HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*;
+
HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»);

(* Deprecated in 0.5.0 *)
HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)* (?!«IDENTIFIER_START»);
```{ .ebnf #DecimalLiteral } ``` -
DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?;

DECIMAL_LITERAL = «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?;

(* Deprecated in 0.5.0 *)
DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_EXPONENT»?;

(* Deprecated in 0.5.0 *)
DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?;

(* Introduced in 0.5.0 *)
DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»?;
+
DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»);

DECIMAL_LITERAL = «DECIMAL_DIGITS» (?!".") «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»);

(* Deprecated in 0.5.0 *)
DECIMAL_LITERAL = «DECIMAL_DIGITS» "." (?!«DECIMAL_DIGITS») «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»);

(* Deprecated in 0.5.0 *)
DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»);

(* Introduced in 0.5.0 *)
DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONENT»? (?!«IDENTIFIER_START»);
```{ .ebnf #DecimalDigits } ``` -
«DECIMAL_DIGITS» = ("0""9")+ ("_" ("0""9")+)*;
+
«DECIMAL_DIGITS» = "0""9"+ ("_" "0""9"+)*;
```{ .ebnf #DecimalExponent } 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 1c2846059c..b3702e0285 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 @@ -26,13 +26,13 @@ ``` -
(* Deprecated in 0.4.25 *)
SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" "\\" "\r" "\n"))* "'";

(* Introduced in 0.4.25 and deprecated in 0.7.0. *)
SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'";

SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | (" ""&") | ("(""[") | ("]""~"))* "'";
+
(* Deprecated in 0.4.25 *)
SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" | "\\" | "\r" | "\n"))* "'";

(* Introduced in 0.4.25 and deprecated in 0.7.0. *)
SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'";

SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE» | " ""&" | "(""[" | "]""~")* "'";
```{ .ebnf #DoubleQuotedStringLiteral } ``` -
(* Deprecated in 0.4.25 *)
DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' "\\" "\r" "\n"))* '"';

(* Introduced in 0.4.25 and deprecated in 0.7.0. *)
DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"';

DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | (" ""!") | ("#""[") | ("]""~"))* '"';
+
(* Deprecated in 0.4.25 *)
DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE_ARBITRARY» | !('"' | "\\" | "\r" | "\n"))* '"';

(* Introduced in 0.4.25 and deprecated in 0.7.0. *)
DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"';

DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | " ""!" | "#""[" | "]""~")* '"';
```{ .ebnf #HexStringLiterals } @@ -68,7 +68,7 @@ ``` -
«HEX_CHARACTER» = ("0""9") | ("a""f") | ("A""F");
+
«HEX_CHARACTER» = "0""9" | "a""f" | "A""F";
```{ .ebnf #UnicodeStringLiterals } @@ -86,13 +86,13 @@ ``` -
(* Introduced in 0.7.0 *)
SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'";
+
(* Introduced in 0.7.0 *)
SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" | "\\" | "\r" | "\n"))* "'";
```{ .ebnf #DoubleQuotedUnicodeStringLiteral } ``` -
(* Introduced in 0.7.0 *)
DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"';
+
(* Introduced in 0.7.0 *)
DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"';
```{ .ebnf #EscapeSequence } @@ -104,7 +104,7 @@ ``` -
(* Deprecated in 0.4.25 *)
«ESCAPE_SEQUENCE_ARBITRARY» = "\\" (!("x" "u") | «HEX_BYTE_ESCAPE» | «UNICODE_ESCAPE»);
+
(* Deprecated in 0.4.25 *)
«ESCAPE_SEQUENCE_ARBITRARY» = "\\" (!("x" | "u") | «HEX_BYTE_ESCAPE» | «UNICODE_ESCAPE»);
```{ .ebnf #AsciiEscape } diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md b/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md index 4fa5c5132e..da7630d4e9 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md @@ -20,12 +20,12 @@ ``` -
«IDENTIFIER_START» = "_" | "$" | ("a""z") | ("A""Z");
+
«IDENTIFIER_START» = "_" | "$" | "a""z" | "A""Z";
```{ .ebnf #IdentifierPart } ``` -
«IDENTIFIER_PART» = «IDENTIFIER_START» | ("0""9");
+
«IDENTIFIER_PART» = «IDENTIFIER_START» | "0""9";
--8<-- "crates/solidity/inputs/language/docs/05-expressions/06-identifiers.md" diff --git a/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md b/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md index 6055236eb0..39606b5c0e 100644 --- a/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md +++ b/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md @@ -56,12 +56,12 @@ ``` -
YUL_DECIMAL_LITERAL = "0" | (("1""9") ("0""9")*);
+
YUL_DECIMAL_LITERAL = ("0" | ("1""9" "0""9"*)) (?!«IDENTIFIER_START»);
```{ .ebnf #YulHexLiteral } ``` -
YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+;
+
YUL_HEX_LITERAL = "0x" «HEX_CHARACTER»+ (?!«IDENTIFIER_START»);
--8<-- "crates/solidity/inputs/language/docs/06-yul/02-yul-expressions.md" diff --git a/crates/testlang/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs b/crates/testlang/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs index 1a34e99e13..bd51b3b362 100644 --- a/crates/testlang/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs +++ b/crates/testlang/outputs/cargo/crate/src/generated/cst/generated/terminal_kind.rs @@ -46,7 +46,7 @@ pub enum TerminalKind { /// ``` Identifier, /// ```ebnf - /// MULTI_LINE_COMMENT = "/*" (!"*" | "*")* "*/"; + /// MULTI_LINE_COMMENT = "/*" (?!"*") (!"*" | ("*" (?!"/")))* "*/"; /// ``` MultiLineComment, /// ```ebnf @@ -66,11 +66,11 @@ pub enum TerminalKind { /// ``` Semicolon, /// ```ebnf - /// SINGLE_LINE_COMMENT = "//" (!("\r" "\n"))*; + /// SINGLE_LINE_COMMENT = "//" (?!"/") (!("\r" | "\n"))*; /// ``` SingleLineComment, /// ```ebnf - /// STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; + /// STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; /// ``` StringLiteral, /// ```ebnf diff --git a/crates/testlang/outputs/cargo/wasm/src/generated/interface/generated/cst.wit b/crates/testlang/outputs/cargo/wasm/src/generated/interface/generated/cst.wit index bb8bf2693c..b95423dec2 100644 --- a/crates/testlang/outputs/cargo/wasm/src/generated/interface/generated/cst.wit +++ b/crates/testlang/outputs/cargo/wasm/src/generated/interface/generated/cst.wit @@ -148,7 +148,7 @@ interface cst { /// This kind represents a `MultiLineComment` node, with the following structure: /// /// ```ebnf - /// MULTI_LINE_COMMENT = "/*" (!"*" | "*")* "*/"; + /// MULTI_LINE_COMMENT = "/*" (?!"*") (!"*" | ("*" (?!"/")))* "*/"; /// ``` %multi-line-comment, /// This kind represents a `OpenBracket` node, with the following structure: @@ -178,13 +178,13 @@ interface cst { /// This kind represents a `SingleLineComment` node, with the following structure: /// /// ```ebnf - /// SINGLE_LINE_COMMENT = "//" (!("\r" "\n"))*; + /// SINGLE_LINE_COMMENT = "//" (?!"/") (!("\r" | "\n"))*; /// ``` %single-line-comment, /// This kind represents a `StringLiteral` node, with the following structure: /// /// ```ebnf - /// STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n"))* '"'; + /// STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' | "\\" | "\r" | "\n"))* '"'; /// ``` %string-literal, /// This kind represents a `TreeKeyword` node, with the following structure: