Rename FnDef -> Fn

This commit is contained in:
Aleksey Kladov 2020-07-30 14:51:08 +02:00
parent 3e1e6227ca
commit 1142112c70
244 changed files with 683 additions and 675 deletions

View file

@ -471,6 +471,7 @@ impl Field {
"::" => "coloncolon",
"#" => "pound",
"?" => "question_mark",
"," => "comma",
_ => name,
};
format_ident!("{}_token", name)
@ -599,13 +600,9 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, rule: &Rule) {
}
}
// (T (',' T)* ','?)?
// (T (',' T)* ','?)
fn lower_comma_list(acc: &mut Vec<Field>, grammar: &Grammar, rule: &Rule) -> bool {
let rule = match rule {
Rule::Opt(it) => it,
_ => return false,
};
let rule = match &**rule {
Rule::Seq(it) => it,
_ => return false,
};

View file

@ -8,7 +8,7 @@ Item =
| EnumDef
| ExternBlock
| ExternCrate
| FnDef
| Fn
| ImplDef
| MacroCall
| Module
@ -42,12 +42,33 @@ UseTree =
UseTreeList =
'{' (UseTree (',' UseTree)* ','?)? '}'
FnDef =
Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList?
ParamList RetType?
Fn =
Attr* Visibility?
'default'? ('async' | 'const')? 'unsafe'? Abi?
'fn' Name TypeParamList? ParamList RetType?
WhereClause?
(body:BlockExpr | ';')
Abi =
'extern' 'string'?
ParamList =
'('(
(Param (',' Param)* ','?)?
| SelfParam ','?
| SelfParam ',' (Param (',' Param)* ','?)
)')'
SelfParam =
Attr* (
('&' 'lifetime'?)? 'mut'? 'self'
| 'mut'? 'self' ':' ascribed_type:TypeRef
)
Param =
Attr* Pat (':' ascribed_type:TypeRef)
| '...'
RetType =
'->' TypeRef
@ -388,9 +409,6 @@ WherePred =
WhereClause =
'where' predicates:WherePred*
Abi =
'string'
ExprStmt =
Attr* Expr ';'
@ -398,16 +416,6 @@ LetStmt =
Attr* 'let' Pat (':' ascribed_type:TypeRef)
'=' initializer:Expr ';'
ParamList =
'(' SelfParam Param* ')'
SelfParam =
Attr* ('&' 'lifetime'?)? 'mut'? 'self' (':' ascribed_type:TypeRef)
Param =
Attr* Pat (':' ascribed_type:TypeRef)
| '...'
Path =
(qualifier:Path '::')? segment:PathSegment
@ -465,13 +473,13 @@ TypeRef =
| DynTraitType
AssocItem =
FnDef
Fn
| TypeAliasDef
| ConstDef
| MacroCall
ExternItem =
FnDef | StaticDef
Fn | StaticDef
AttrInput =
Literal