Unnamed repository; edit this file 'description' to name the repository.
Merge rust-analyzer/ungrammar#21
21: Replace other self/super/crate usages with NameRef r=matklad a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
bors[bot] 2021-01-16
parent 453edd5 · parent 72d659c · commit 5031759
-rw-r--r--lib/ungrammar/Cargo.toml2
-rw-r--r--lib/ungrammar/rust.ungram15
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/ungrammar/Cargo.toml b/lib/ungrammar/Cargo.toml
index 2a86a58d83..dcb1aea5ea 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.8.0"
+version = "1.9.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 cb55060a88..34377f5e92 100644
--- a/lib/ungrammar/rust.ungram
+++ b/lib/ungrammar/rust.ungram
@@ -21,7 +21,7 @@
//*************************//
Name =
- 'ident'
+ 'ident' | 'self'
NameRef =
'ident' | 'int_number' | 'self' | 'super' | 'crate'
@@ -121,7 +121,7 @@ ItemList =
ExternCrate =
Attr* Visibility?
- 'extern' 'crate' (NameRef | 'self') Rename? ';'
+ 'extern' 'crate' NameRef Rename? ';'
Rename =
'as' (Name | '_')
@@ -155,8 +155,8 @@ ParamList =
SelfParam =
Attr* (
- ('&' Lifetime?)? 'mut'? 'self'
- | 'mut'? 'self' ':' Type
+ ('&' Lifetime?)? 'mut'? Name
+ | 'mut'? Name ':' Type
)
Param =
@@ -292,12 +292,7 @@ WherePred =
('for' GenericParamList)? (Lifetime | Type) ':' TypeBoundList
Visibility =
- 'pub' ('('
- 'super'
- | 'self'
- | 'crate'
- | 'in' Path
- ')')?
+ 'pub' ('(' 'in'? Path ')')?
Attr =
'#' '!'? '[' Path ('=' Literal | TokenTree)? ']'