Skip to content

Commit 3ff83b0

Browse files
bors[bot]Veykril
andauthored
Merge #15
15: Node-ify lifetime r=Veykril a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 parents ccc54ed + 9e81b8b commit 3ff83b0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

rust.ungram

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ Name =
2626
NameRef =
2727
'ident' | 'int_number'
2828

29+
Lifetime =
30+
'lifetime_ident'
31+
2932
Path =
3033
(qualifier:Path '::')? segment:PathSegment
3134

@@ -52,7 +55,7 @@ AssocTypeArg =
5255
NameRef (':' TypeBoundList | '=' Type)
5356

5457
LifetimeArg =
55-
'lifetime'
58+
Lifetime
5659

5760
ConstArg =
5861
Expr
@@ -153,7 +156,7 @@ ParamList =
153156

154157
SelfParam =
155158
Attr* (
156-
('&' 'lifetime'?)? 'mut'? 'self'
159+
('&' Lifetime?)? 'mut'? 'self'
157160
| 'mut'? 'self' ':' Type
158161
)
159162

@@ -281,13 +284,13 @@ ConstParam =
281284
('=' default_val:Expr)?
282285

283286
LifetimeParam =
284-
Attr* 'lifetime' (':' TypeBoundList?)?
287+
Attr* Lifetime (':' TypeBoundList?)?
285288

286289
WhereClause =
287290
'where' predicates:(WherePred (',' WherePred)* ','?)
288291

289292
WherePred =
290-
('for' GenericParamList)? ('lifetime' | Type) ':' TypeBoundList
293+
('for' GenericParamList)? (Lifetime | Type) ':' TypeBoundList
291294

292295
Visibility =
293296
'pub' ('('
@@ -459,13 +462,13 @@ WhileExpr =
459462
loop_body:BlockExpr
460463

461464
Label =
462-
'lifetime'
465+
Lifetime ':'
463466

464467
BreakExpr =
465-
Attr* 'break' 'lifetime'? Expr?
468+
Attr* 'break' Lifetime? Expr?
466469

467470
ContinueExpr =
468-
Attr* 'continue' 'lifetime'?
471+
Attr* 'continue' Lifetime?
469472

470473
RangeExpr =
471474
Attr* start:Expr? op:('..' | '..=') end:Expr?
@@ -529,7 +532,7 @@ PtrType =
529532
'*' ('const' | 'mut') Type
530533

531534
RefType =
532-
'&' 'lifetime'? 'mut'? Type
535+
'&' Lifetime? 'mut'? Type
533536

534537
ArrayType =
535538
'[' Type ';' Expr ']'
@@ -556,7 +559,7 @@ TypeBoundList =
556559
bounds:(TypeBound ('+' TypeBound)* '+'?)
557560

558561
TypeBound =
559-
'lifetime'
562+
Lifetime
560563
| '?'? Type
561564

562565
//************************//

0 commit comments

Comments
 (0)