grammar: Make UseTree less ultra-janky

This commit is contained in:
2024-04-21 18:57:46 -05:00
parent 5341631781
commit e36a684422
7 changed files with 69 additions and 47 deletions

View File

@@ -45,10 +45,9 @@ Alias = "type" Identifier ('=' Ty)? ';' ;
Impl = "impl" Path '{' Item* '}' ;
(* TODO: Impl Trait for Target*)
Use = "use" UseTree ;
UseTree = Path '{' (UseTree ',')* UseTree? '}'
| Path "as" Identifier
| Path | '*' ;
Use = "use" '::'? UseTree ';' ;
UseTree = '*' | '{' (UseTree ',')* UseTree? '}'
| PathPart ('::' UseTree | "as" Identifier)? ;
(* type *)
Ty = Never | Empty | Path | TyTuple | TyRef | TyFn ;