1
Fork 0

parser comments

parser comments
This commit is contained in:
John Clements 2013-03-29 12:51:10 -07:00
parent 1b4ced8bcb
commit fa5ba17c89
3 changed files with 20 additions and 6 deletions

View file

@ -870,6 +870,7 @@ pub impl Parser {
}
}
// matches token_lit = LIT_INT | ...
fn lit_from_token(&self, tok: &token::Token) -> lit_ {
match *tok {
token::LIT_INT(i, it) => lit_int(i, it),
@ -884,6 +885,7 @@ pub impl Parser {
}
}
// matches lit = true | false | token_lit
fn parse_lit(&self) -> lit {
let lo = self.span.lo;
let lit = if self.eat_keyword(&~"true") {
@ -2762,8 +2764,6 @@ pub impl Parser {
// 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;
@ -3085,6 +3085,7 @@ pub impl Parser {
}
}
// matches fn_header = IDENT generics
// parse the name and optional generic types of a function header.
fn parse_fn_header(&self) -> (ident, ast::Generics) {
let id = self.parse_ident();
@ -3436,7 +3437,7 @@ pub impl Parser {
let attrs_remaining_len = attrs_remaining.len();
// looks like this code depends on the invariant that
// outer attributes can't occur on view items (or macros
// outer attributes can't occur on view items (or macro
// invocations?)
let mut first = true;
while *self.token != term {
@ -3449,9 +3450,9 @@ pub impl Parser {
attrs);
match self.parse_item_or_view_item(
/*bad*/ copy attrs,
true,
false,
true
true, // items allowed
false, // foreign items allowed
true // macros allowed
) {
iovi_item(item) => items.push(item),
iovi_view_item(view_item) => {
@ -3706,6 +3707,7 @@ pub impl Parser {
}
}
// parse extern mod foo { ... } or extern { ... }
fn parse_item_foreign_mod(&self,
lo: BytePos,
opt_abis: Option<AbiSet>,