Skip to content

Commit

Permalink
Backport a couple of added/removed grammar nodes from v2 to v0/v1 (#664)
Browse files Browse the repository at this point in the history
Part of #652
  • Loading branch information
Xanewok authored Nov 20, 2023
1 parent 3e4d2b6 commit bea802f
Show file tree
Hide file tree
Showing 41 changed files with 63 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
parser:
sequence:
- reference: "UsingKeyword"
- reference: "UsingDirectivePath"
- reference: "IdentifierPath"
- reference: "ForKeyword"
- choice:
- reference: "Asterisk"
Expand All @@ -89,7 +89,7 @@
sequence:
- reference: "UsingKeyword"
- choice:
- reference: "UsingDirectivePath"
- reference: "IdentifierPath"
- reference: "UsingDirectiveDeconstruction"
- reference: "ForKeyword"
- choice:
Expand All @@ -100,11 +100,6 @@
terminator:
reference: "Semicolon"

- name: "UsingDirectivePath"
kind: "Parser"
unversioned:
reference: "IdentifierPath"

- name: "UsingDirectiveDeconstruction"
kind: "Parser"
versioned:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,28 @@
terminatedBy:
parser:
sequence:
- reference: "VariableDeclaration"
- reference: "VariableDeclarationType"
- optional:
reference: "DataLocation"
- reference: "Identifier"
- optional:
sequence:
- reference: "Equal"
- reference: "Expression"
terminator:
reference: "Semicolon"

- name: "VariableDeclaration"
- name: "VariableDeclarationType"
kind: "Parser"
inlined: true
versioned:
0.4.11:
sequence:
- choice:
- reference: "VarKeyword"
- reference: "TypeName"
- optional:
reference: "DataLocation"
- reference: "Identifier"
choice:
- reference: "VarKeyword"
- reference: "TypeName"
0.5.0:
# removed "VarKeyword"
sequence:
- reference: "TypeName"
- optional:
reference: "DataLocation"
- reference: "Identifier"
reference: "TypeName"

- name: "DataLocation"
kind: "Parser"
Expand Down
10 changes: 4 additions & 6 deletions crates/solidity/inputs/language/src/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,25 +550,23 @@ slang_grammar! {

parser UserDefinedValueTypeDefinition = { introduced in "0.8.8" ((TypeKeyword Identifier IsKeyword ElementaryType) terminated by Semicolon) } ;

parser UsingDirective = ((UsingKeyword (UsingDirectivePath | UsingDirectiveDeconstruction) ForKeyword (Asterisk | TypeName) ({ introduced in "0.8.13" GlobalKeyword } ?)) terminated by Semicolon) ;
parser UsingDirective = ((UsingKeyword (IdentifierPath | UsingDirectiveDeconstruction) ForKeyword (Asterisk | TypeName) ({ introduced in "0.8.13" GlobalKeyword } ?)) terminated by Semicolon) ;

parser UsingDirectiveDeconstruction = { introduced in "0.8.13" (UsingDirectiveSymbolsList delimited by OpenBrace and CloseBrace) };

inline parser UsingDirectiveOperator = {
introduced in "0.8.19" (Ampersand | Asterisk | BangEqual | Bar | Caret | EqualEqual | GreaterThan | GreaterThanEqual | LessThan | LessThanEqual | Minus | Percent | Plus | Slash | Tilde)
} ;

parser UsingDirectivePath = IdentifierPath ;

parser UsingDirectiveSymbol = {
introduced in "0.8.13" (IdentifierPath { introduced in "0.8.19" ((AsKeyword UsingDirectiveOperator) ?) } )
} ;

parser UsingDirectiveSymbolsList = (UsingDirectiveSymbol separated by Comma) ;

parser VariableDeclaration = (
({ removed in "0.5.0" VarKeyword } | TypeName) (DataLocation ?) Identifier
) ;
parser VariableDeclaration = (VariableDeclarationType (DataLocation ?) Identifier) ;

inline parser VariableDeclarationType = ({ removed in "0.5.0" VarKeyword } | TypeName) ;

parser VariableDeclarationStatement = ((VariableDeclaration ((Equal Expression) ?)) terminated by Semicolon) ;

Expand Down
2 changes: 0 additions & 2 deletions crates/solidity/outputs/cargo/crate/src/generated/kinds.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.

2 changes: 0 additions & 2 deletions crates/solidity/outputs/npm/crate/src/generated/kinds.rs

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

9 changes: 1 addition & 8 deletions crates/solidity/outputs/npm/crate/src/generated/language.rs

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

2 changes: 0 additions & 2 deletions crates/solidity/outputs/npm/package/src/generated/index.d.ts

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.

This file was deleted.

This file was deleted.

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.

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

Loading

0 comments on commit bea802f

Please sign in to comment.