Skip to content

Commit

Permalink
Always name variant nodes even if there is only single primary expr
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Feb 13, 2024
1 parent 303dda9 commit f322f15
Show file tree
Hide file tree
Showing 28 changed files with 40 additions and 35 deletions.
1 change: 0 additions & 1 deletion crates/codegen/grammar/src/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,6 @@ fn resolve_precedence(
.collect();
let primary_expression = Box::new(match primaries.len() {
0 => panic!("Precedence operator has no primary expressions"),
1 => primaries.into_iter().next().unwrap(),
_ => ParserDefinitionNode::Choice(Named::with_builtin_name(
BuiltinFieldName::Variant,
primaries,
Expand Down
10 changes: 8 additions & 2 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.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 1.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 1.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 1.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "1" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Tree:
- (LeadingTrivia) ► (Whitespace): " " # (6..7)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15)
- (expressions꞉ VersionPragmaExpressions): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.0.0" (15..21)
- (LeadingTrivia) ► (Whitespace): " " # (15..16)
- (item꞉ VersionPragmaValue): "0" # (16..17)
- (separator꞉ Period): "." # (17..18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.8.0" (47..54)
- (LeadingTrivia) ► (Whitespace): " " # (47..48)
- (operator꞉ Caret): "^" # (48..49)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (49..54)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (49..54)
- (item꞉ VersionPragmaValue): "0" # (49..50)
- (separator꞉ Period): "." # (50..51)
- (item꞉ VersionPragmaValue): "8" # (51..52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Tree:
- (expressions꞉ VersionPragmaExpressions): # " 0.5.0 || 0.6.0 || ^0.7.0" (8..33)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaOrExpression): # " 0.5.0 || 0.6.0 || ^0.7.0" (8..33)
- (left_operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaOrExpression): # " 0.5.0 || 0.6.0" (8..23)
- (left_operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.5.0" (8..14)
- (left_operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.5.0" (8..14)
- (LeadingTrivia) ► (Whitespace): " " # (8..9)
- (item꞉ VersionPragmaValue): "0" # (9..10)
- (separator꞉ Period): "." # (10..11)
Expand All @@ -20,7 +20,7 @@ Tree:
- (item꞉ VersionPragmaValue): "0" # (13..14)
- (LeadingTrivia) ► (Whitespace): " " # (14..15)
- (operator꞉ BarBar): "||" # (15..17)
- (right_operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.6.0" (17..23)
- (right_operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.6.0" (17..23)
- (LeadingTrivia) ► (Whitespace): " " # (17..18)
- (item꞉ VersionPragmaValue): "0" # (18..19)
- (separator꞉ Period): "." # (19..20)
Expand All @@ -32,7 +32,7 @@ Tree:
- (right_operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " ^0.7.0" (26..33)
- (LeadingTrivia) ► (Whitespace): " " # (26..27)
- (operator꞉ Caret): "^" # (27..28)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.7.0" (28..33)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.7.0" (28..33)
- (item꞉ VersionPragmaValue): "0" # (28..29)
- (separator꞉ Period): "." # (29..30)
- (item꞉ VersionPragmaValue): "7" # (30..31)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " =0.8.0" (8..15)
- (LeadingTrivia) ► (Whitespace): " " # (8..9)
- (operator꞉ Equal): "=" # (9..10)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "0.8.0" (10..15)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "0.8.0" (10..15)
- (item꞉ VersionPragmaValue): "0" # (10..11)
- (separator꞉ Period): "." # (11..12)
- (item꞉ VersionPragmaValue): "8" # (12..13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Tree:
- (VersionPragma): # "solidity 0.8.0" (0..14)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8)
- (expressions꞉ VersionPragmaExpressions): # " 0.8.0" (8..14)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.8.0" (8..14)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.8.0" (8..14)
- (LeadingTrivia) ► (Whitespace): " " # (8..9)
- (item꞉ VersionPragmaValue): "0" # (9..10)
- (separator꞉ Period): "." # (10..11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Tree:
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaPrefixExpression): # " <1.0.0" (8..15)
- (LeadingTrivia) ► (Whitespace): " " # (8..9)
- (operator꞉ LessThan): "<" # (9..10)
- (operand꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # "1.0.0" (10..15)
- (operand꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # "1.0.0" (10..15)
- (item꞉ VersionPragmaValue): "1" # (10..11)
- (separator꞉ Period): "." # (11..12)
- (item꞉ VersionPragmaValue): "0" # (12..13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Tree:
- (VersionPragma): # "solidity 0.7.0 0.8.0" (0..20)
- (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8)
- (expressions꞉ VersionPragmaExpressions): # " 0.7.0 0.8.0" (8..20)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.7.0" (8..14)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.7.0" (8..14)
- (LeadingTrivia) ► (Whitespace): " " # (8..9)
- (item꞉ VersionPragmaValue): "0" # (9..10)
- (separator꞉ Period): "." # (10..11)
- (item꞉ VersionPragmaValue): "7" # (11..12)
- (separator꞉ Period): "." # (12..13)
- (item꞉ VersionPragmaValue): "0" # (13..14)
- (item꞉ VersionPragmaExpression) ► (VersionPragmaSpecifier): # " 0.8.0" (14..20)
- (item꞉ VersionPragmaExpression) ► (variant꞉ VersionPragmaSpecifier): # " 0.8.0" (14..20)
- (LeadingTrivia) ► (Whitespace): " " # (14..15)
- (item꞉ VersionPragmaValue): "0" # (15..16)
- (separator꞉ Period): "." # (16..17)
Expand Down
Loading

0 comments on commit f322f15

Please sign in to comment.