Skip to content

Commit

Permalink
unreserve AddressKeyword and allow it to be used as a field name (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarTawfik authored Oct 30, 2024
1 parent 52e10f9 commit cfc62f2
Show file tree
Hide file tree
Showing 144 changed files with 251 additions and 1,642 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-crabs-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/slang": patch
---

remove `YulPathComponent` and just use `YulIdentifier` instead.
5 changes: 5 additions & 0 deletions .changeset/selfish-adults-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/slang": patch
---

unreserve `AddressKeyword`, and let it be used for `MemberAccessExpression`, `StructMember`, etc...
2 changes: 1 addition & 1 deletion crates/solidity/inputs/language/bindings/rules.msgb
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ inherit .parent_scope
edge @path.lexical_scope -> @expr.lexical_scope
}

@path [YulPath . [YulPathComponent @name [YulIdentifier]]] {
@path [YulPath @name [YulIdentifier]] {
node @path.lexical_scope

node ref
Expand Down
40 changes: 11 additions & 29 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ codegen_language_macros::compile!(Language(
Keyword(
name = AddressKeyword,
identifier = Identifier,
definitions = [KeywordDefinition(value = Atom("address"))]
definitions =
[KeywordDefinition(reserved = Never, value = Atom("address"))]
),
Keyword(
name = AfterKeyword,
Expand Down Expand Up @@ -3460,22 +3461,13 @@ codegen_language_macros::compile!(Language(
),
PrecedenceExpression(
name = MemberAccessExpression,
operators = [
PrecedenceOperator(
model = Postfix,
fields = (
period = Required(Period),
member = Required(Identifier)
)
),
PrecedenceOperator(
model = Postfix,
fields = (
period = Required(Period),
member = Required(AddressKeyword)
)
operators = [PrecedenceOperator(
model = Postfix,
fields = (
period = Required(Period),
member = Required(Identifier)
)
]
)]
),
PrecedenceExpression(
name = IndexAccessExpression,
Expand Down Expand Up @@ -4381,20 +4373,9 @@ codegen_language_macros::compile!(Language(
Separated(name = YulPaths, reference = YulPath, separator = Comma),
Separated(
name = YulPath,
reference = YulPathComponent,
reference = YulIdentifier,
separator = Period
),
Enum(
name = YulPathComponent,
variants = [
EnumVariant(reference = YulIdentifier),
EnumVariant(
// Upstream grammar accepts built-ins but only `address` is valid:
reference = YulAddressKeyword,
enabled = From("0.8.10")
)
]
),
Token(
name = YulIdentifier,
definitions = [
Expand Down Expand Up @@ -4604,7 +4585,8 @@ codegen_language_macros::compile!(Language(
Keyword(
name = YulAddressKeyword,
identifier = YulIdentifier,
definitions = [KeywordDefinition(value = Atom("address"))]
definitions =
[KeywordDefinition(reserved = Never, value = Atom("address"))]
),
Keyword(
name = YulAfterKeyword,
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.

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.

3 changes: 1 addition & 2 deletions crates/solidity/outputs/cargo/tests/src/generated/mod.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.

12 changes: 3 additions & 9 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.

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.

Loading

0 comments on commit cfc62f2

Please sign in to comment.