Skip to content

Commit

Permalink
Update @lezer/lr + enrich grammar to reproduce infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
backmask committed Sep 24, 2021
1 parent 75eb49b commit 913df5e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"dependencies": {
"@lezer/lr": "^0.15.2"
"@lezer/lr": "^0.15.3"
},
"scripts": {
"generate": "lezer-generator src/lezer.grammar -o src/GeneratedLang",
Expand Down
File renamed without changes.
26 changes: 23 additions & 3 deletions src/lezer.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ ComparisonExpression { expression !comparison_expression ComparisonOp expression
InExpression { expression !in_expression In Enumeration }
BinaryExpression { expression !binary_expression Times expression }

OnClause {
On LParen expression (Comma expression)+ RParen
}

AtomExpression {
IntegerLiteral
| VariableAtom
| ModifierAtom
| AttributeAtom
}

VariableAtom {
Expand All @@ -48,26 +54,40 @@ AtomParen { !atom_paren LParen expression RParen }

CumulateFunc { Cumulate LParen expression Comma Name (Comma expression)? RParen }

ModifierAtom { AtomExpression LBracket SelectExpression (Semicolon SelectExpression)* RBracket }

AttributeAtom { AtomExpression Point Name }

SelectExpression { Select Aggregation? Colon expression }

Aggregation { Name OnClause? }

@tokens {
@precedence {
Cumulate,
In,
In, On,
ComparisonOp,
Select,
Name
}

Cumulate { "cumulate" }

In { "in" }
On { "on" }

Point { "." }
Colon { ":" }
Semicolon { ";" }
Comma { "," }
Scope { "@" }
Times { "*" }
LBracket { "[" }
RBracket { "]" }
LParen { "(" }
RParen { ")" }

ComparisonOp { ">=" | ">" | "<=" | "<" | "==" | "=" | "!=" | "<>" | "indef" }
Select { "select" }

IntegerLiteral { $[0-9]+ }

Expand Down

0 comments on commit 913df5e

Please sign in to comment.