Unnamed repository; edit this file 'description' to name the repository.
Node-ify lifetime
| -rw-r--r-- | lib/ungrammar/Cargo.toml | 2 | ||||
| -rw-r--r-- | lib/ungrammar/rust.ungram | 21 |
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/ungrammar/Cargo.toml b/lib/ungrammar/Cargo.toml index c49486f08d..533abba2fe 100644 --- a/lib/ungrammar/Cargo.toml +++ b/lib/ungrammar/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ungrammar" description = "A DSL for describing concrete syntax trees" -version = "1.2.2" +version = "1.3.0" license = "MIT OR Apache-2.0" repository = "https://github.com/matklad/ungrammar" authors = ["Aleksey Kladov <[email protected]>"] diff --git a/lib/ungrammar/rust.ungram b/lib/ungrammar/rust.ungram index e0142b64cd..fdff06a0f2 100644 --- a/lib/ungrammar/rust.ungram +++ b/lib/ungrammar/rust.ungram @@ -26,6 +26,9 @@ Name = NameRef = 'ident' | 'int_number' +Lifetime = + 'lifetime_ident' + Path = (qualifier:Path '::')? segment:PathSegment @@ -52,7 +55,7 @@ AssocTypeArg = NameRef (':' TypeBoundList | '=' Type) LifetimeArg = - 'lifetime' + Lifetime ConstArg = Expr @@ -147,7 +150,7 @@ ParamList = SelfParam = Attr* ( - ('&' 'lifetime'?)? 'mut'? 'self' + ('&' Lifetime?)? 'mut'? 'self' | 'mut'? 'self' ':' Type ) @@ -275,13 +278,13 @@ ConstParam = ('=' default_val:Expr)? LifetimeParam = - Attr* 'lifetime' (':' TypeBoundList?)? + Attr* Lifetime (':' TypeBoundList?)? WhereClause = 'where' predicates:(WherePred (',' WherePred)* ','?) WherePred = - ('for' GenericParamList)? ('lifetime' | Type) ':' TypeBoundList + ('for' GenericParamList)? (Lifetime | Type) ':' TypeBoundList Visibility = 'pub' ('(' @@ -453,13 +456,13 @@ WhileExpr = loop_body:BlockExpr Label = - 'lifetime' ':' + Lifetime ':' BreakExpr = - Attr* 'break' 'lifetime'? Expr? + Attr* 'break' Lifetime? Expr? ContinueExpr = - Attr* 'continue' 'lifetime'? + Attr* 'continue' Lifetime? RangeExpr = Attr* start:Expr? op:('..' | '..=') end:Expr? @@ -523,7 +526,7 @@ PtrType = '*' ('const' | 'mut') Type RefType = - '&' 'lifetime'? 'mut'? Type + '&' Lifetime? 'mut'? Type ArrayType = '[' Type ';' Expr ']' @@ -550,7 +553,7 @@ TypeBoundList = bounds:(TypeBound ('+' TypeBound)* '+'?) TypeBound = - 'lifetime' + Lifetime | '?'? Type //************************// |