grammar: Minor cleanup, fix compat with Grammatical parser
This commit is contained in:
parent
8dfddb739e
commit
a213c7f70a
12
grammar.ebnf
12
grammar.ebnf
@ -51,7 +51,8 @@ Ty = Never | Empty | Path | TyTuple | TyRef | TyFn ;
|
|||||||
Never = '!' ;
|
Never = '!' ;
|
||||||
Empty = '(' ')' ;
|
Empty = '(' ')' ;
|
||||||
TyTuple = '(' (Ty ',')* Ty? ')' ;
|
TyTuple = '(' (Ty ',')* Ty? ')' ;
|
||||||
TyRef = ('&' | '&&')* Path ;
|
TyRef = Amps* Path ;
|
||||||
|
Amps = '&' | '&&' ;
|
||||||
TyFn = "fn" TyTuple ('->' Ty)? ;
|
TyFn = "fn" TyTuple ('->' Ty)? ;
|
||||||
|
|
||||||
|
|
||||||
@ -73,13 +74,13 @@ Let = "let" Mutability Identifier (':' Ty)? ('=' Expr)? ;
|
|||||||
Bool = "true" | "false" ;
|
Bool = "true" | "false" ;
|
||||||
|
|
||||||
|
|
||||||
/* expr */
|
(* expr *)
|
||||||
|
|
||||||
Expr = Assign ;
|
Expr = Assign ;
|
||||||
|
|
||||||
Assign = Path (AssignKind Assign ) | Compare ;
|
Assign = Path (AssignKind Assign ) | Compare ;
|
||||||
|
|
||||||
Binary = Compare | Range | Logic | Bitwise | Shift | Factor | Term ;
|
(* Binary = Compare | Range | Logic | Bitwise | Shift | Factor | Term ; *)
|
||||||
Compare = Range (CompareOp Range )* ;
|
Compare = Range (CompareOp Range )* ;
|
||||||
Range = Logic (RangeOp Logic )* ;
|
Range = Logic (RangeOp Logic )* ;
|
||||||
Logic = Bitwise (LogicOp Bitwise)* ;
|
Logic = Bitwise (LogicOp Bitwise)* ;
|
||||||
@ -106,13 +107,12 @@ Literal = STRING | CHARACTER | FLOAT | INTEGER | Bool ;
|
|||||||
Array = '[' (Expr ',')* Expr? ']' ;
|
Array = '[' (Expr ',')* Expr? ']' ;
|
||||||
ArrayRep = '[' Expr ';' Expr ']' ;
|
ArrayRep = '[' Expr ';' Expr ']' ;
|
||||||
|
|
||||||
AddrOf = ('&' | '&&')* Mutability Expr ;
|
AddrOf = Amps Amps* Mutability Expr ;
|
||||||
|
|
||||||
Block = '{' Stmt* '}';
|
Block = '{' Stmt* '}';
|
||||||
|
|
||||||
Group = '(' (Empty | Expr | Tuple) ')' ;
|
Group = Empty | '(' (Expr | Tuple) ')' ;
|
||||||
Tuple = (Expr ',')* Expr? ;
|
Tuple = (Expr ',')* Expr? ;
|
||||||
Empty = ;
|
|
||||||
|
|
||||||
While = "while" Expr Block Else ;
|
While = "while" Expr Block Else ;
|
||||||
If = "if" Expr Block Else ;
|
If = "if" Expr Block Else ;
|
||||||
|
Loading…
Reference in New Issue
Block a user