Allow optional comma before with in FRU. Closes #2463.

This commit is contained in:
Lindsey Kuper 2012-05-31 11:33:18 -07:00
parent abef5f54c9
commit f394933641
2 changed files with 25 additions and 0 deletions

View file

@ -724,6 +724,12 @@ class parser {
let mut fields = [self.parse_field(token::COLON)];
let mut base = none;
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") {
base = some(self.parse_expr()); break;
}

View 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
};
}