Skip to content

Commit

Permalink
Use disambiguated DecimalLiteral sub-rules in DSL v1
Browse files Browse the repository at this point in the history
So that we minimize the parsing diff once migrate to DSL v2.
  • Loading branch information
Xanewok committed Nov 8, 2023
1 parent e0a5786 commit cabc598
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 89 deletions.
7 changes: 4 additions & 3 deletions crates/solidity/inputs/language/src/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,10 @@ slang_grammar! {
scanner DecimalLiteral = (
(
(
{ removed in "0.5.0" (DecimalDigits (("." (DecimalDigits ?) ) ?)) } |
{ introduced in "0.5.0" (DecimalDigits (("." DecimalDigits ) ?)) } |
('.' DecimalDigits)
(DecimalDigits not followed by '.') |
{ removed in "0.5.0" ((DecimalDigits '.') not followed by DecimalDigits) } |
('.' DecimalDigits) |
(DecimalDigits '.' DecimalDigits)
)
(DecimalExponent ?)
) not followed by IdentifierStart
Expand Down
36 changes: 15 additions & 21 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.

36 changes: 15 additions & 21 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.

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ Source: >
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/NumericExpression/float_no_fraction/input.sol:1:2]
Error: Expected DecimalLiteral or HexLiteral.
╭─[crates/solidity/testing/snapshots/cst_output/NumericExpression/float_no_fraction/input.sol:1:1]
1 │ 1.
│ ╰── Error occurred here.
───╯
Tree:
- NumericExpression (Rule): # 0..2 "1."
- DecimalLiteral (Token): "1" # 0..1
- SKIPPED (Token): "." # 1..2
- SKIPPED (Token): "1." # 0..2

This file was deleted.

This file was deleted.

0 comments on commit cabc598

Please sign in to comment.