diff --git a/.changeset/two-bears-cover.md b/.changeset/two-bears-cover.md new file mode 100644 index 0000000000..79a11f5d7a --- /dev/null +++ b/.changeset/two-bears-cover.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": patch +--- + +Fix parsing `.member` member access expression diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 87cf7611b8..6941f56b12 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -3664,7 +3664,18 @@ codegen_language_macros::compile!(Language( Token( name = DecimalLiteral, definitions = [ - // An integer (without a dot or a fraction) is enabled in all versions: + // A dot and a fraction (without an integer) is enabled in all versions: + TokenDefinition( + scanner = TrailingContext( + scanner = Sequence([ + Atom("."), + Fragment(DecimalDigits), + Optional(Fragment(DecimalExponent)) + ]), + not_followed_by = Fragment(IdentifierStart) + ) + ), + // A bare integer (without a dot or a fraction) is enabled in all versions: TokenDefinition( scanner = TrailingContext( scanner = Sequence([ @@ -3677,7 +3688,7 @@ codegen_language_macros::compile!(Language( not_followed_by = Fragment(IdentifierStart) ) ), - // An integer and a dot (without a fraction) is disabled in "0.5.0" + // Till 0.5.0, the following lone dot was considered a part of the literal: TokenDefinition( enabled = Till("0.5.0"), scanner = TrailingContext( @@ -3692,10 +3703,12 @@ codegen_language_macros::compile!(Language( not_followed_by = Fragment(IdentifierStart) ) ), - // A dot and a fraction (without an integer) is enabled in all versions: + // As well as the full form of digits followed by a dot followed by digits... TokenDefinition( + enabled = Till("0.5.0"), scanner = TrailingContext( scanner = Sequence([ + Fragment(DecimalDigits), Atom("."), Fragment(DecimalDigits), Optional(Fragment(DecimalExponent)) @@ -3703,13 +3716,17 @@ codegen_language_macros::compile!(Language( not_followed_by = Fragment(IdentifierStart) ) ), - // An integer, a dot, and a fraction is enabled in all versions: + // ...both of which was subsumed by a more general form that only included + // the dot if it was followed by a fraction: TokenDefinition( + enabled = From("0.5.0"), scanner = TrailingContext( scanner = Sequence([ Fragment(DecimalDigits), - Atom("."), - Fragment(DecimalDigits), + Optional(Sequence([ + Atom("."), + Fragment(DecimalDigits) + ])), Optional(Fragment(DecimalExponent)) ]), not_followed_by = Fragment(IdentifierStart) diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs index 23ddd3ac31..e02074dcae 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs @@ -6932,6 +6932,15 @@ impl Language { fn decimal_literal(&self, input: &mut ParserContext<'_>) -> bool { scan_choice!( input, + scan_not_followed_by!( + input, + scan_sequence!( + scan_chars!(input, '.'), + self.decimal_digits(input), + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ), scan_not_followed_by!( input, scan_sequence!( @@ -6960,25 +6969,36 @@ impl Language { } else { false }, - scan_not_followed_by!( - input, - scan_sequence!( - scan_chars!(input, '.'), - self.decimal_digits(input), - scan_optional!(input, self.decimal_exponent(input)) - ), - self.identifier_start(input) - ), - scan_not_followed_by!( - input, - scan_sequence!( - self.decimal_digits(input), - scan_chars!(input, '.'), - self.decimal_digits(input), - scan_optional!(input, self.decimal_exponent(input)) - ), - self.identifier_start(input) - ) + if !self.version_is_at_least_0_5_0 { + scan_not_followed_by!( + input, + scan_sequence!( + self.decimal_digits(input), + scan_chars!(input, '.'), + self.decimal_digits(input), + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ) + } else { + false + }, + if self.version_is_at_least_0_5_0 { + scan_not_followed_by!( + input, + scan_sequence!( + self.decimal_digits(input), + scan_optional!( + input, + scan_sequence!(scan_chars!(input, '.'), self.decimal_digits(input)) + ), + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ) + } else { + false + } ) } diff --git a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/decimal_number_expression.rs b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/decimal_number_expression.rs index 2a52188209..376d3f1e0c 100644 --- a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/decimal_number_expression.rs +++ b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/decimal_number_expression.rs @@ -29,6 +29,11 @@ fn float() -> Result<()> { run("DecimalNumberExpression", "float") } +#[test] +fn float_ident_after_period() -> Result<()> { + run("DecimalNumberExpression", "float_ident_after_period") +} + #[test] fn float_no_fraction() -> Result<()> { run("DecimalNumberExpression", "float_no_fraction") @@ -44,6 +49,11 @@ fn integer() -> Result<()> { run("DecimalNumberExpression", "integer") } +#[test] +fn integer_ident_after_period() -> Result<()> { + run("DecimalNumberExpression", "integer_ident_after_period") +} + #[test] fn integer_with_exponent() -> Result<()> { run("DecimalNumberExpression", "integer_with_exponent") @@ -54,6 +64,22 @@ fn integer_with_separators() -> Result<()> { run("DecimalNumberExpression", "integer_with_separators") } +#[test] +fn leading_period_ident_after_decimal() -> Result<()> { + run( + "DecimalNumberExpression", + "leading_period_ident_after_decimal", + ) +} + +#[test] +fn leading_period_ident_after_period() -> Result<()> { + run( + "DecimalNumberExpression", + "leading_period_ident_after_period", + ) +} + #[test] fn years_unit() -> Result<()> { run("DecimalNumberExpression", "years_unit") diff --git a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/expression.rs b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/expression.rs index 8ef483ab2b..c7b71eb23a 100644 --- a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/expression.rs +++ b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/expression.rs @@ -262,11 +262,26 @@ fn member_access_index_access() -> Result<()> { run("Expression", "member_access_index_access") } +#[test] +fn member_access_integer() -> Result<()> { + run("Expression", "member_access_integer") +} + #[test] fn member_access_options() -> Result<()> { run("Expression", "member_access_options") } +#[test] +fn member_access_rational() -> Result<()> { + run("Expression", "member_access_rational") +} + +#[test] +fn member_access_rational_leading_period() -> Result<()> { + run("Expression", "member_access_rational_leading_period") +} + #[test] fn new_expression() -> Result<()> { run("Expression", "new_expression") diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index df8d0e3256..3b3e3f3c1c 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -1211,15 +1211,19 @@ HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; (* Deprecated in 0.5.0 *) HEX_LITERAL = "0X" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; +DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; + DECIMAL_LITERAL = «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?; (* Deprecated in 0.5.0 *) DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_EXPONENT»?; -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_DIGITS» = ("0"…"9")+ ("_" ("0"…"9")+)*; «DECIMAL_EXPONENT» = ("e" | "E") "-"? «DECIMAL_DIGITS»; 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 9f838489df..aafa656187 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 @@ -26,7 +26,7 @@ ``` -
DECIMAL_LITERAL = «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?;

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

DECIMAL_LITERAL = "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?;

DECIMAL_LITERAL = «DECIMAL_DIGITS» "." «DECIMAL_DIGITS» «DECIMAL_EXPONENT»?;
+
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»?;
```{ .ebnf #DecimalDigits } diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.4.11-failure.yml new file mode 100644 index 0000000000..298b7244e3 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.4.11-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.2.a │ 0..5 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword or YearsKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/input.sol:1:4] + │ + 1 │ 1.2.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1.2.a\n" (0..6) + - (literal꞉ DecimalLiteral): "1.2" # (0..3) + - (SKIPPED): ".a\n" # (3..6) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.5.0-failure.yml new file mode 100644 index 0000000000..820aa8764d --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.5.0-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.2.a │ 0..5 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/input.sol:1:4] + │ + 1 │ 1.2.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1.2.a\n" (0..6) + - (literal꞉ DecimalLiteral): "1.2" # (0..3) + - (SKIPPED): ".a\n" # (3..6) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.6.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.6.11-failure.yml new file mode 100644 index 0000000000..dd7dea66cf --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.6.11-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.2.a │ 0..5 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/input.sol:1:4] + │ + 1 │ 1.2.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1.2.a\n" (0..6) + - (literal꞉ DecimalLiteral): "1.2" # (0..3) + - (SKIPPED): ".a\n" # (3..6) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.7.0-failure.yml new file mode 100644 index 0000000000..2031ff358d --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/generated/0.7.0-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.2.a │ 0..5 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/input.sol:1:4] + │ + 1 │ 1.2.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1.2.a\n" (0..6) + - (literal꞉ DecimalLiteral): "1.2" # (0..3) + - (SKIPPED): ".a\n" # (3..6) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/input.sol b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/input.sol new file mode 100644 index 0000000000..8a6304787b --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_ident_after_period/input.sol @@ -0,0 +1 @@ +1.2.a diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.5.0-failure.yml index b9d28bd74c..031553fa5b 100644 --- a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.5.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.5.0-failure.yml @@ -5,13 +5,15 @@ Source: > Errors: # 1 total - > - Error: Expected DecimalLiteral. - ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/input.sol:1:1] + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/input.sol:1:2] │ 1 │ 1. - │ ─┬ + │ ┬ │ ╰── Error occurred here. ───╯ Tree: - - (SKIPPED): "1." # (0..2) + - (DecimalNumberExpression): # "1." (0..2) + - (literal꞉ DecimalLiteral): "1" # (0..1) + - (SKIPPED): "." # (1..2) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.6.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.6.11-failure.yml new file mode 100644 index 0000000000..5d8ae956bc --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.6.11-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1. │ 0..2 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/input.sol:1:2] + │ + 1 │ 1. + │ ┬ + │ ╰── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1." (0..2) + - (literal꞉ DecimalLiteral): "1" # (0..1) + - (SKIPPED): "." # (1..2) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.7.0-failure.yml new file mode 100644 index 0000000000..1e01195c2e --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/generated/0.7.0-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1. │ 0..2 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/float_no_fraction/input.sol:1:2] + │ + 1 │ 1. + │ ┬ + │ ╰── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1." (0..2) + - (literal꞉ DecimalLiteral): "1" # (0..1) + - (SKIPPED): "." # (1..2) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.4.11-failure.yml new file mode 100644 index 0000000000..8c8a3af0b0 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.4.11-failure.yml @@ -0,0 +1,17 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.a │ 0..3 + +Errors: # 1 total + - > + Error: Expected DecimalLiteral. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/input.sol:1:1] + │ + 1 │ 1.a + │ ──┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (SKIPPED): "1.a\n" # (0..4) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.5.0-failure.yml new file mode 100644 index 0000000000..7da1389311 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.5.0-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.a │ 0..3 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/input.sol:1:2] + │ + 1 │ 1.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1.a\n" (0..4) + - (literal꞉ DecimalLiteral): "1" # (0..1) + - (SKIPPED): ".a\n" # (1..4) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.6.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.6.11-failure.yml new file mode 100644 index 0000000000..bf48eef5e4 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.6.11-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.a │ 0..3 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/input.sol:1:2] + │ + 1 │ 1.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1.a\n" (0..4) + - (literal꞉ DecimalLiteral): "1" # (0..1) + - (SKIPPED): ".a\n" # (1..4) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.7.0-failure.yml new file mode 100644 index 0000000000..7f66f11aac --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/generated/0.7.0-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 1.a │ 0..3 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/input.sol:1:2] + │ + 1 │ 1.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # "1.a\n" (0..4) + - (literal꞉ DecimalLiteral): "1" # (0..1) + - (SKIPPED): ".a\n" # (1..4) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/input.sol b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/input.sol new file mode 100644 index 0000000000..078da202d8 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/integer_ident_after_period/input.sol @@ -0,0 +1 @@ +1.a diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_decimal/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_decimal/generated/0.4.11-failure.yml new file mode 100644 index 0000000000..39aba57f95 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_decimal/generated/0.4.11-failure.yml @@ -0,0 +1,17 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ .1a │ 0..3 + +Errors: # 1 total + - > + Error: Expected DecimalLiteral. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_decimal/input.sol:1:1] + │ + 1 │ .1a + │ ──┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (SKIPPED): ".1a\n" # (0..4) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_decimal/input.sol b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_decimal/input.sol new file mode 100644 index 0000000000..6af9ead360 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_decimal/input.sol @@ -0,0 +1 @@ +.1a diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.4.11-failure.yml new file mode 100644 index 0000000000..fecf295200 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.4.11-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ .1.a │ 0..4 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword or YearsKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/input.sol:1:3] + │ + 1 │ .1.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # ".1.a\n" (0..5) + - (literal꞉ DecimalLiteral): ".1" # (0..2) + - (SKIPPED): ".a\n" # (2..5) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.5.0-failure.yml new file mode 100644 index 0000000000..b68af7ae44 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.5.0-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ .1.a │ 0..4 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/input.sol:1:3] + │ + 1 │ .1.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # ".1.a\n" (0..5) + - (literal꞉ DecimalLiteral): ".1" # (0..2) + - (SKIPPED): ".a\n" # (2..5) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.6.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.6.11-failure.yml new file mode 100644 index 0000000000..55bffb3fa7 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.6.11-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ .1.a │ 0..4 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or FinneyKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or SzaboKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/input.sol:1:3] + │ + 1 │ .1.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # ".1.a\n" (0..5) + - (literal꞉ DecimalLiteral): ".1" # (0..2) + - (SKIPPED): ".a\n" # (2..5) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.7.0-failure.yml new file mode 100644 index 0000000000..31f5410ab0 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/generated/0.7.0-failure.yml @@ -0,0 +1,19 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ .1.a │ 0..4 + +Errors: # 1 total + - > + Error: Expected DaysKeyword or EtherKeyword or GweiKeyword or HoursKeyword or MinutesKeyword or SecondsKeyword or WeeksKeyword or WeiKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/input.sol:1:3] + │ + 1 │ .1.a + │ ─┬─ + │ ╰─── Error occurred here. + ───╯ + +Tree: + - (DecimalNumberExpression): # ".1.a\n" (0..5) + - (literal꞉ DecimalLiteral): ".1" # (0..2) + - (SKIPPED): ".a\n" # (2..5) diff --git a/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/input.sol b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/input.sol new file mode 100644 index 0000000000..697685f597 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/DecimalNumberExpression/leading_period_ident_after_period/input.sol @@ -0,0 +1 @@ +.1.a diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/generated/0.4.11-failure.yml new file mode 100644 index 0000000000..6f2fb3b533 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/generated/0.4.11-failure.yml @@ -0,0 +1,17 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 5.fromUint() │ 0..12 + +Errors: # 1 total + - > + Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or DecimalLiteral or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or FalseKeyword or FixedKeyword or HexLiteral or Identifier or IntKeyword or NewKeyword or OpenBracket or OpenParen or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or StringKeyword or TrueKeyword or UfixedKeyword or UintKeyword. + ╭─[crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/input.sol:1:1] + │ + 1 │ 5.fromUint() + │ ──────┬────── + │ ╰──────── Error occurred here. + ───╯ + +Tree: + - (SKIPPED): "5.fromUint()\n" # (0..13) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/generated/0.5.0-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/generated/0.5.0-success.yml new file mode 100644 index 0000000000..f8cd1715f3 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/generated/0.5.0-success.yml @@ -0,0 +1,18 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 5.fromUint() │ 0..12 + +Errors: [] + +Tree: + - (Expression) ► (variant꞉ FunctionCallExpression): # "5.fromUint()\n" (0..13) + - (operand꞉ Expression) ► (variant꞉ MemberAccessExpression): # "5.fromUint" (0..10) + - (operand꞉ Expression) ► (variant꞉ DecimalNumberExpression) ► (literal꞉ DecimalLiteral): "5" # (0..1) + - (period꞉ Period): "." # (1..2) + - (member꞉ MemberAccess) ► (variant꞉ Identifier): "fromUint" # (2..10) + - (arguments꞉ ArgumentsDeclaration) ► (variant꞉ PositionalArgumentsDeclaration): # "()\n" (10..13) + - (open_paren꞉ OpenParen): "(" # (10..11) + - (arguments꞉ PositionalArguments): [] # (11..11) + - (close_paren꞉ CloseParen): ")" # (11..12) + - (trailing_trivia꞉ EndOfLine): "\n" # (12..13) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/input.sol b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/input.sol new file mode 100644 index 0000000000..c963fb382a --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_integer/input.sol @@ -0,0 +1 @@ +5.fromUint() diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational/generated/0.4.11-success.yml new file mode 100644 index 0000000000..6cb9396410 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational/generated/0.4.11-success.yml @@ -0,0 +1,18 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ 5.1.fromUint() │ 0..14 + +Errors: [] + +Tree: + - (Expression) ► (variant꞉ FunctionCallExpression): # "5.1.fromUint()\n" (0..15) + - (operand꞉ Expression) ► (variant꞉ MemberAccessExpression): # "5.1.fromUint" (0..12) + - (operand꞉ Expression) ► (variant꞉ DecimalNumberExpression) ► (literal꞉ DecimalLiteral): "5.1" # (0..3) + - (period꞉ Period): "." # (3..4) + - (member꞉ MemberAccess) ► (variant꞉ Identifier): "fromUint" # (4..12) + - (arguments꞉ ArgumentsDeclaration) ► (variant꞉ PositionalArgumentsDeclaration): # "()\n" (12..15) + - (open_paren꞉ OpenParen): "(" # (12..13) + - (arguments꞉ PositionalArguments): [] # (13..13) + - (close_paren꞉ CloseParen): ")" # (13..14) + - (trailing_trivia꞉ EndOfLine): "\n" # (14..15) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational/input.sol b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational/input.sol new file mode 100644 index 0000000000..e832d5e1c3 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational/input.sol @@ -0,0 +1 @@ +5.1.fromUint() diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational_leading_period/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational_leading_period/generated/0.4.11-success.yml new file mode 100644 index 0000000000..ef443f3f77 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational_leading_period/generated/0.4.11-success.yml @@ -0,0 +1,18 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ .1.fromUint() │ 0..13 + +Errors: [] + +Tree: + - (Expression) ► (variant꞉ FunctionCallExpression): # ".1.fromUint()\n" (0..14) + - (operand꞉ Expression) ► (variant꞉ MemberAccessExpression): # ".1.fromUint" (0..11) + - (operand꞉ Expression) ► (variant꞉ DecimalNumberExpression) ► (literal꞉ DecimalLiteral): ".1" # (0..2) + - (period꞉ Period): "." # (2..3) + - (member꞉ MemberAccess) ► (variant꞉ Identifier): "fromUint" # (3..11) + - (arguments꞉ ArgumentsDeclaration) ► (variant꞉ PositionalArgumentsDeclaration): # "()\n" (11..14) + - (open_paren꞉ OpenParen): "(" # (11..12) + - (arguments꞉ PositionalArguments): [] # (12..12) + - (close_paren꞉ CloseParen): ")" # (12..13) + - (trailing_trivia꞉ EndOfLine): "\n" # (13..14) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational_leading_period/input.sol b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational_leading_period/input.sol new file mode 100644 index 0000000000..16502f58c7 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_rational_leading_period/input.sol @@ -0,0 +1 @@ +.1.fromUint()