diff options
| author | Paul Stansifer <paul.stansifer@gmail.com> | 2012-07-23 15:34:43 -0700 |
|---|---|---|
| committer | Paul Stansifer <paul.stansifer@gmail.com> | 2012-07-24 11:44:58 -0700 |
| commit | f785cccf0f9a4ea90b7cb752ec12ba749621a86e (patch) | |
| tree | 62df02d9d6d22d04da3e75776f95c7ac17a5e9f4 /src/libsyntax/parse | |
| parent | 1c472564e37567dda820062cfd117115113b9def (diff) | |
| download | rust-f785cccf0f9a4ea90b7cb752ec12ba749621a86e.tar.gz rust-f785cccf0f9a4ea90b7cb752ec12ba749621a86e.zip | |
Bugfix: make the parser handle the case where zero repetitions occur, by handling parse results on the basis of what names the matcher expects to bind, not on what names are actually bound.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 656e064d694..b9fb9dab374 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1194,13 +1194,14 @@ class parser { let m = if self.token == token::DOLLAR { self.bump(); if self.token == token::LPAREN { + let name_idx_lo = *name_idx; let ms = self.parse_matcher_subseq(name_idx, token::LPAREN, token::RPAREN); if ms.len() == 0u { self.fatal(~"repetition body must be nonempty"); } let (sep, zerok) = self.parse_sep_and_zerok(); - mtc_rep(ms, sep, zerok) + mtc_rep(ms, sep, zerok, name_idx_lo, *name_idx) } else { let bound_to = self.parse_ident(); self.expect(token::COLON); |
