Tidy up the grammar #94
This commit is contained in:
@@ -62,7 +62,6 @@ pub enum Postfix {
|
||||
delimiter: MacroDelimiter,
|
||||
},
|
||||
StructCall(Vec<(Identifier, Option<Expression>)>),
|
||||
Assign(String, Box<Expression>),
|
||||
Index(Expression),
|
||||
As(TypeExpr),
|
||||
Increment,
|
||||
|
||||
@@ -12,6 +12,7 @@ COMMENT = _{ "//" ~ (!"\n" ~ ANY)* }
|
||||
keyword = {
|
||||
"if"
|
||||
| "else"
|
||||
| "fn"
|
||||
| "for"
|
||||
| "while"
|
||||
| "match"
|
||||
@@ -163,7 +164,7 @@ literal = {
|
||||
etc_pattern = { ".." }
|
||||
|
||||
multi_pat_template = _{
|
||||
((pattern | etc_pattern) ~ ("," ~ (pattern | etc_pattern))*)?
|
||||
((pattern | etc_pattern) ~ ("," ~ (pattern | etc_pattern))* ~ ","?)?
|
||||
}
|
||||
|
||||
tuple_pattern = {
|
||||
@@ -290,7 +291,7 @@ enum_fields = _{
|
||||
}
|
||||
|
||||
enum_decl = {
|
||||
visibility? ~ "enum" ~ identifier ~ generics_decl? ~ "{" ~ enum_fields ~ "}"
|
||||
visibility? ~ "enum" ~ identifier ~ generics_decl? ~ "{" ~ enum_fields? ~ "}"
|
||||
}
|
||||
|
||||
// ======================================================
|
||||
|
||||
@@ -317,12 +317,6 @@ impl GetMutability for Expression {
|
||||
// Recurse into all postfix sub-expressions
|
||||
for postfix in postfixes {
|
||||
match postfix {
|
||||
Postfix::Assign(_, rhs) => {
|
||||
if let Some(self_ref) = get_self_ref(initial, postfixes) {
|
||||
result.push(self_ref);
|
||||
}
|
||||
result.append(&mut rhs.get_mutability());
|
||||
}
|
||||
Postfix::Call(args) => {
|
||||
for arg in args {
|
||||
result.append(&mut arg.get_mutability());
|
||||
|
||||
Reference in New Issue
Block a user