diff options
| author | John Clements <clements@racket-lang.org> | 2013-04-23 16:47:47 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-04-28 09:49:20 -0700 |
| commit | 28b285764cd6d9b184584756177199d0f1c32ce3 (patch) | |
| tree | 148a73d40d20814a333da557ba60cac3dae5bcf0 /src/libsyntax/parse/parser.rs | |
| parent | 50a7f5483b4f474d7469ea7709aed8e370eab5ba (diff) | |
| download | rust-28b285764cd6d9b184584756177199d0f1c32ce3.tar.gz rust-28b285764cd6d9b184584756177199d0f1c32ce3.zip | |
comments, helper function for tests, more informative error message
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0afef442efc..c843698a1dc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1056,6 +1056,9 @@ pub impl Parser { } } + // matches lifetimes = ( lifetime ) | ( lifetime , lifetimes ) + // actually, it matches the empty one too, but putting that in there + // messes up the grammar.... fn parse_lifetimes(&self) -> OptVec<ast::Lifetime> { /*! * @@ -1081,7 +1084,8 @@ pub impl Parser { token::GT => { return res; } token::BINOP(token::SHR) => { return res; } _ => { - self.fatal(~"expected `,` or `>` after lifetime name"); + self.fatal(fmt!("expected `,` or `>` after lifetime name, got: %?", + *self.token)); } } } @@ -2741,6 +2745,11 @@ pub impl Parser { if self.eat_keyword(&~"once") { ast::Once } else { ast::Many } } + // matches optbounds = ( ( : ( boundseq )? )? ) + // where boundseq = ( bound + boundseq ) | bound + // and bound = ( 'static ) | ty + // you might want to insist on the boundseq having seen the colon, but + // that's not currently in place. fn parse_optional_ty_param_bounds(&self) -> @OptVec<TyParamBound> { if !self.eat(&token::COLON) { return @opt_vec::Empty; @@ -2801,6 +2810,7 @@ pub impl Parser { return @result; } + // matches typaram = IDENT optbounds fn parse_ty_param(&self) -> TyParam { let ident = self.parse_ident(); let bounds = self.parse_optional_ty_param_bounds(); |
