Skip to content

Commit 54df3c1

Browse files
committed
Replace other self/super/crate usages with NameRef
1 parent 6ae4892 commit 54df3c1

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

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.8.0"
4+
version = "1.9.0"
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/matklad/ungrammar"
77
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]

rust.ungram

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//*************************//
2222

2323
Name =
24-
'ident'
24+
'ident' | 'self'
2525

2626
NameRef =
2727
'ident' | 'int_number' | 'self' | 'super' | 'crate'
@@ -121,7 +121,7 @@ ItemList =
121121

122122
ExternCrate =
123123
Attr* Visibility?
124-
'extern' 'crate' (NameRef | 'self') Rename? ';'
124+
'extern' 'crate' NameRef Rename? ';'
125125

126126
Rename =
127127
'as' (Name | '_')
@@ -155,8 +155,8 @@ ParamList =
155155

156156
SelfParam =
157157
Attr* (
158-
('&' Lifetime?)? 'mut'? 'self'
159-
| 'mut'? 'self' ':' Type
158+
('&' Lifetime?)? 'mut'? Name
159+
| 'mut'? Name ':' Type
160160
)
161161

162162
Param =
@@ -292,12 +292,7 @@ WherePred =
292292
('for' GenericParamList)? (Lifetime | Type) ':' TypeBoundList
293293

294294
Visibility =
295-
'pub' ('('
296-
'super'
297-
| 'self'
298-
| 'crate'
299-
| 'in' Path
300-
')')?
295+
'pub' ('(' 'in'? Path ')')?
301296

302297
Attr =
303298
'#' '!'? '[' Path ('=' Literal | TokenTree)? ']'

0 commit comments

Comments
 (0)