mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-27 22:04:50 +00:00
Allow trailing commas in MappingPattern
This commit is contained in:
parent
2a8aa6f308
commit
b61f4d7b69
4 changed files with 983 additions and 4 deletions
|
@ -801,7 +801,7 @@ MappingPattern: ast::PatternKind = {
|
|||
rest: None,
|
||||
};
|
||||
},
|
||||
<location:@L> "{" <e:OneOrMore<MatchMappingEntry>> "}" <end_location:@R> => {
|
||||
<location:@L> "{" <e:OneOrMore<MatchMappingEntry>> ","? "}" <end_location:@R> => {
|
||||
let (keys, patterns) = e
|
||||
.into_iter()
|
||||
.unzip();
|
||||
|
@ -811,14 +811,14 @@ MappingPattern: ast::PatternKind = {
|
|||
rest: None,
|
||||
};
|
||||
},
|
||||
<location:@L> "{" "**" <rest:Identifier> "}" <end_location:@R> => {
|
||||
<location:@L> "{" "**" <rest:Identifier> ","? "}" <end_location:@R> => {
|
||||
return ast::PatternKind::MatchMapping {
|
||||
keys: vec![],
|
||||
patterns: vec![],
|
||||
rest: Some(rest),
|
||||
};
|
||||
},
|
||||
<location:@L> "{" <e:OneOrMore<MatchMappingEntry>> "," "**" <rest:Identifier> "}" <end_location:@R> => {
|
||||
<location:@L> "{" <e:OneOrMore<MatchMappingEntry>> "," "**" <rest:Identifier> ","? "}" <end_location:@R> => {
|
||||
let (keys, patterns) = e
|
||||
.into_iter()
|
||||
.unzip();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue