Skip to content

Commit a28544c

Browse files
committed
Node-ify lifetime
1 parent 8bb6876 commit a28544c

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/tools/rust-analyzer/lib/ungrammar/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ungrammar"
33
description = "A DSL for describing concrete syntax trees"
4-
version = "1.2.2"
4+
version = "1.3.0"
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/matklad/ungrammar"
77
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]

src/tools/rust-analyzer/lib/ungrammar/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
@@ -147,7 +150,7 @@ ParamList =
147150

148151
SelfParam =
149152
Attr* (
150-
('&' 'lifetime'?)? 'mut'? 'self'
153+
('&' Lifetime?)? 'mut'? 'self'
151154
| 'mut'? 'self' ':' Type
152155
)
153156

@@ -275,13 +278,13 @@ ConstParam =
275278
('=' default_val:Expr)?
276279

277280
LifetimeParam =
278-
Attr* 'lifetime' (':' TypeBoundList?)?
281+
Attr* Lifetime (':' TypeBoundList?)?
279282

280283
WhereClause =
281284
'where' predicates:(WherePred (',' WherePred)* ','?)
282285

283286
WherePred =
284-
('for' GenericParamList)? ('lifetime' | Type) ':' TypeBoundList
287+
('for' GenericParamList)? (Lifetime | Type) ':' TypeBoundList
285288

286289
Visibility =
287290
'pub' ('('
@@ -453,13 +456,13 @@ WhileExpr =
453456
loop_body:BlockExpr
454457

455458
Label =
456-
'lifetime' ':'
459+
Lifetime ':'
457460

458461
BreakExpr =
459-
Attr* 'break' 'lifetime'? Expr?
462+
Attr* 'break' Lifetime? Expr?
460463

461464
ContinueExpr =
462-
Attr* 'continue' 'lifetime'?
465+
Attr* 'continue' Lifetime?
463466

464467
RangeExpr =
465468
Attr* start:Expr? op:('..' | '..=') end:Expr?
@@ -523,7 +526,7 @@ PtrType =
523526
'*' ('const' | 'mut') Type
524527

525528
RefType =
526-
'&' 'lifetime'? 'mut'? Type
529+
'&' Lifetime? 'mut'? Type
527530

528531
ArrayType =
529532
'[' Type ';' Expr ']'
@@ -550,7 +553,7 @@ TypeBoundList =
550553
bounds:(TypeBound ('+' TypeBound)* '+'?)
551554

552555
TypeBound =
553-
'lifetime'
556+
Lifetime
554557
| '?'? Type
555558

556559
//************************//

0 commit comments

Comments
 (0)