Allow optional comma before with
in FRU. Closes #2463.
This commit is contained in:
parent
abef5f54c9
commit
f394933641
2 changed files with 25 additions and 0 deletions
|
@ -724,6 +724,12 @@ class parser {
|
||||||
let mut fields = [self.parse_field(token::COLON)];
|
let mut fields = [self.parse_field(token::COLON)];
|
||||||
let mut base = none;
|
let mut base = none;
|
||||||
while self.token != token::RBRACE {
|
while self.token != token::RBRACE {
|
||||||
|
// optional comma before "with"
|
||||||
|
if self.token == token::COMMA
|
||||||
|
&& self.token_is_keyword("with",
|
||||||
|
self.look_ahead(1u)) {
|
||||||
|
self.bump();
|
||||||
|
}
|
||||||
if self.eat_keyword("with") {
|
if self.eat_keyword("with") {
|
||||||
base = some(self.parse_expr()); break;
|
base = some(self.parse_expr()); break;
|
||||||
}
|
}
|
||||||
|
|
19
src/test/run-pass/issue-2463.rs
Normal file
19
src/test/run-pass/issue-2463.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
fn main() {
|
||||||
|
|
||||||
|
let x = {
|
||||||
|
f: 0,
|
||||||
|
g: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
let y = {
|
||||||
|
f: 1,
|
||||||
|
g: 1,
|
||||||
|
with x
|
||||||
|
};
|
||||||
|
|
||||||
|
let z = {
|
||||||
|
f: 1,
|
||||||
|
with x
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue