Skip to content

Commit

Permalink
fix payable primary expressions (#756)
Browse files Browse the repository at this point in the history
Removes `payable` as an elementary type, adding it back to primary
expressions (to be parsed as the base of a call expression). More
details in #654

Closes #654
  • Loading branch information
OmarTawfik authored Feb 3, 2024
1 parent e097231 commit e839817
Show file tree
Hide file tree
Showing 142 changed files with 615 additions and 135 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-turkeys-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/slang": patch
---

fix parsing `payable` primary expressions
5 changes: 4 additions & 1 deletion crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2670,7 +2670,6 @@ codegen_language_macros::compile!(Language(
EnumVariant(reference = ByteKeyword, enabled = Till("0.8.0")),
EnumVariant(reference = StringKeyword),
EnumVariant(reference = AddressType),
EnumVariant(reference = PayableKeyword),
EnumVariant(reference = BytesKeyword),
EnumVariant(reference = IntKeyword),
EnumVariant(reference = UintKeyword),
Expand Down Expand Up @@ -3361,6 +3360,10 @@ codegen_language_macros::compile!(Language(
PrimaryExpression(reference = DecimalNumberExpression),
PrimaryExpression(reference = StringExpression),
PrimaryExpression(reference = ElementaryType),
PrimaryExpression(
reference = PayableKeyword,
enabled = From("0.6.0")
),
PrimaryExpression(reference = TrueKeyword),
PrimaryExpression(reference = FalseKeyword),
PrimaryExpression(reference = Identifier)
Expand Down
12 changes: 7 additions & 5 deletions crates/solidity/outputs/cargo/crate/src/generated/language.rs

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.

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.

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.

2 changes: 1 addition & 1 deletion crates/solidity/outputs/spec/generated/grammar.ebnf

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.

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

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Source: >
Errors: # 1 total
- >
Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or StringKeyword or TrueKeyword or UfixedKeyword or UintKeyword or WhileKeyword.
Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or ReturnKeyword or StringKeyword or TrueKeyword or UfixedKeyword or UintKeyword or WhileKeyword.
╭─[crates/solidity/testing/snapshots/cst_output/Block/unchecked/input.sol:1:3]
1 │ { unchecked { x = 1; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Source: >
Errors: # 1 total
- >
Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or StringKeyword or TrueKeyword or TypeKeyword or UfixedKeyword or UintKeyword or WhileKeyword.
Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or ReturnKeyword or StringKeyword or TrueKeyword or TypeKeyword or UfixedKeyword or UintKeyword or WhileKeyword.
╭─[crates/solidity/testing/snapshots/cst_output/Block/unchecked/input.sol:1:3]
1 │ { unchecked { x = 1; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Source: >
Errors: # 1 total
- >
Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or EnumKeyword or EventKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or PayableKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword.
Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or EnumKeyword or EventKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword.
╭─[crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_user_defined_value_type_definition/input.sol:2:3]
2 │ type Foo is bool;
Expand Down
Loading

0 comments on commit e839817

Please sign in to comment.