diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-05-05 15:11:04 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-05-05 15:11:04 -0400 |
| commit | 4300d4d2fa9d35ac73742c7d815ee157ce0f9c17 (patch) | |
| tree | 9e5db5a04493a573f280b2c8863d0eaf0ca47c0d /src/libsyntax/parse | |
| parent | 6cb273ed4efb6724b1c713c3ac35d14e52999fb1 (diff) | |
| parent | 063851ffa1b8388a0b70446c0209af16264e8181 (diff) | |
| download | rust-4300d4d2fa9d35ac73742c7d815ee157ce0f9c17.tar.gz rust-4300d4d2fa9d35ac73742c7d815ee157ce0f9c17.zip | |
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze
Conflicts: src/libcore/core.rc src/libcore/hashmap.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/num/float.rs src/libcore/num/int-template.rs src/libcore/num/num.rs src/libcore/num/strconv.rs src/libcore/num/uint-template.rs src/libcore/ops.rs src/libcore/os.rs src/libcore/prelude.rs src/libcore/rt/mod.rs src/libcore/unstable/lang.rs src/librustc/driver/session.rs src/librustc/middle/astencode.rs src/librustc/middle/borrowck/check_loans.rs src/librustc/middle/borrowck/gather_loans.rs src/librustc/middle/borrowck/loan.rs src/librustc/middle/borrowck/preserve.rs src/librustc/middle/liveness.rs src/librustc/middle/mem_categorization.rs src/librustc/middle/region.rs src/librustc/middle/trans/base.rs src/librustc/middle/trans/inline.rs src/librustc/middle/trans/reachable.rs src/librustc/middle/typeck/check/_match.rs src/librustc/middle/typeck/check/regionck.rs src/librustc/util/ppaux.rs src/libstd/arena.rs src/libstd/ebml.rs src/libstd/json.rs src/libstd/serialize.rs src/libstd/std.rc src/libsyntax/ast_map.rs src/libsyntax/parse/parser.rs src/test/compile-fail/borrowck-uniq-via-box.rs src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs src/test/run-pass/borrowck-nested-calls.rs
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 15 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 196 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 155 |
6 files changed, 136 insertions, 257 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index cc580155d70..037b2c089f4 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -179,13 +179,3 @@ impl parser_attr for Parser { } } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 163c7852132..8956622a06b 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -892,13 +892,3 @@ mod test { assert_eq!(tok, token::LIFETIME(id)); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 5d51a54d770..0c024958a24 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -418,9 +418,10 @@ mod test { new_parser_from_source_str(ps,~[],~"bogofile",source_str) } - #[test] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str { + #[cfg(test)] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str { do io::with_str_writer |writer| { - val.encode(~std::json::Encoder(writer)); + let mut encoder = std::json::Encoder(writer); + val.encode(&mut encoder); } } @@ -674,13 +675,3 @@ mod test { string_to_expr(@~"a::z.froob(b,@(987+3))"); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index ce21e0f672d..e486a6254e7 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -18,7 +18,7 @@ removed. */ -use ast::{expr, expr_lit, lit_nil}; +use ast::{expr, expr_lit, lit_nil, attribute}; use ast; use codemap::{span, respan}; use parse::parser::Parser; @@ -282,13 +282,13 @@ pub impl Parser { } } - fn try_parse_obsolete_priv_section(&self) -> bool { + fn try_parse_obsolete_priv_section(&self, attrs: ~[attribute]) -> bool { if self.is_keyword(&~"priv") && self.look_ahead(1) == token::LBRACE { self.obsolete(copy *self.span, ObsoletePrivSection); self.eat_keyword(&~"priv"); self.bump(); while *self.token != token::RBRACE { - self.parse_single_struct_field(ast::private); + self.parse_single_struct_field(ast::private, attrs); } self.bump(); true @@ -298,4 +298,3 @@ pub impl Parser { } } - diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 457c6df8db2..4839b179723 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -19,7 +19,7 @@ use ast::{_mod, add, arg, arm, attribute, bind_by_ref, bind_infer}; use ast::{bind_by_copy, bitand, bitor, bitxor, blk}; use ast::{blk_check_mode, box}; use ast::{crate, crate_cfg, decl, decl_item}; -use ast::{decl_local, default_blk, deref, quot, enum_def}; +use ast::{decl_local, default_blk, deref, div, enum_def}; use ast::{expr, expr_, expr_addr_of, expr_match, expr_again}; use ast::{expr_assign, expr_assign_op, expr_binary, expr_block}; use ast::{expr_break, expr_call, expr_cast, expr_copy, expr_do_body}; @@ -102,11 +102,6 @@ enum restriction { RESTRICT_NO_BAR_OR_DOUBLEBAR_OP, } -// So that we can distinguish a class dtor from other class members - -enum class_contents { dtor_decl(blk, ~[attribute], codemap::span), - members(~[@struct_field]) } - type arg_or_capture_item = Either<arg, ()>; type item_info = (ident, item_, Option<~[attribute]>); @@ -313,22 +308,22 @@ pub impl Parser { } return copy self.buffer[(*self.buffer_start + dist - 1) & 3].tok; } - fn fatal(&self, m: ~str) -> ! { + fn fatal(&self, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(*copy self.span, m) } - fn span_fatal(&self, sp: span, m: ~str) -> ! { + fn span_fatal(&self, sp: span, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(sp, m) } - fn span_note(&self, sp: span, m: ~str) { + fn span_note(&self, sp: span, m: &str) { self.sess.span_diagnostic.span_note(sp, m) } - fn bug(&self, m: ~str) -> ! { + fn bug(&self, m: &str) -> ! { self.sess.span_diagnostic.span_bug(*copy self.span, m) } - fn warn(&self, m: ~str) { + fn warn(&self, m: &str) { self.sess.span_diagnostic.span_warn(*copy self.span, m) } - fn span_err(&self, sp: span, m: ~str) { + fn span_err(&self, sp: span, m: &str) { self.sess.span_diagnostic.span_err(sp, m) } fn abort_if_errors(&self) { @@ -937,7 +932,7 @@ pub impl Parser { loop { match *self.token { token::MOD_SEP => { - match self.look_ahead(1u) { + match self.look_ahead(1) { token::IDENT(*) => { self.bump(); ids.push(self.parse_ident()); @@ -1836,7 +1831,7 @@ pub impl Parser { token::PLUS => aop = add, token::MINUS => aop = subtract, token::STAR => aop = mul, - token::SLASH => aop = quot, + token::SLASH => aop = div, token::PERCENT => aop = rem, token::CARET => aop = bitxor, token::AND => aop = bitand, @@ -2034,8 +2029,7 @@ pub impl Parser { // This is a 'continue' expression if opt_ident.is_some() { self.span_err(*self.last_span, - ~"a label may not be used with a `loop` \ - expression"); + "a label may not be used with a `loop` expression"); } let lo = self.span.lo; @@ -2172,7 +2166,7 @@ pub impl Parser { @ast::pat { node: pat_wild, _ } => (), @ast::pat { node: pat_ident(_, _, _), _ } => (), @ast::pat { span, _ } => self.span_fatal( - span, ~"expected an identifier or `_`" + span, "expected an identifier or `_`" ) } slice = Some(subpat); @@ -2464,7 +2458,7 @@ pub impl Parser { -> ast::pat_ { if !is_plain_ident(&*self.token) { self.span_fatal(*self.last_span, - ~"expected identifier, found path"); + "expected identifier, found path"); } // why a path here, and not just an identifier? let name = self.parse_path_without_tps(); @@ -2483,7 +2477,7 @@ pub impl Parser { if *self.token == token::LPAREN { self.span_fatal( *self.last_span, - ~"expected identifier, found enum pattern"); + "expected identifier, found enum pattern"); } pat_ident(binding_mode, name, sub) @@ -2525,7 +2519,9 @@ pub impl Parser { } // parse a structure field - fn parse_name_and_ty(&self, pr: visibility) -> @struct_field { + fn parse_name_and_ty(&self, + pr: visibility, + attrs: ~[attribute]) -> @struct_field { let mut is_mutbl = struct_immutable; let lo = self.span.lo; if self.eat_keyword(&~"mut") { @@ -2540,7 +2536,8 @@ pub impl Parser { @spanned(lo, self.last_span.hi, ast::struct_field_ { kind: named_field(name, is_mutbl, pr), id: self.get_id(), - ty: ty + ty: ty, + attrs: attrs, }) } @@ -2611,19 +2608,19 @@ pub impl Parser { match self.parse_item_or_view_item(/*bad*/ copy item_attrs, false) { - iovi_item(i) => { - let hi = i.span.hi; - let decl = @spanned(lo, hi, decl_item(i)); - return @spanned(lo, hi, stmt_decl(decl, self.get_id())); - } - iovi_view_item(vi) => { - self.span_fatal(vi.span, ~"view items must be declared at \ - the top of the block"); - } - iovi_foreign_item(_) => { - self.fatal(~"foreign items are not allowed here"); - } - iovi_none() => { /* fallthrough */ } + iovi_item(i) => { + let hi = i.span.hi; + let decl = @spanned(lo, hi, decl_item(i)); + return @spanned(lo, hi, stmt_decl(decl, self.get_id())); + } + iovi_view_item(vi) => { + self.span_fatal(vi.span, + "view items must be declared at the top of the block"); + } + iovi_foreign_item(_) => { + self.fatal(~"foreign items are not allowed here"); + } + iovi_none() => { /* fallthrough */ } } check_expected_item(self, item_attrs); @@ -2824,8 +2821,7 @@ pub impl Parser { result.push(RegionTyParamBound); } else { self.span_err(*self.span, - ~"`'static` is the only permissible \ - region bound here"); + "`'static` is the only permissible region bound here"); } self.bump(); } @@ -3240,7 +3236,7 @@ pub impl Parser { }) } _ => { - self.span_err(*self.span, ~"not a trait"); + self.span_err(*self.span, "not a trait"); None } }; @@ -3299,7 +3295,6 @@ pub impl Parser { } let mut fields: ~[@struct_field]; - let mut the_dtor: Option<(blk, ~[attribute], codemap::span)> = None; let is_tuple_like; if self.eat(&token::LBRACE) { @@ -3307,26 +3302,8 @@ pub impl Parser { is_tuple_like = false; fields = ~[]; while *self.token != token::RBRACE { - match self.parse_struct_decl_field() { - dtor_decl(ref blk, ref attrs, s) => { - match the_dtor { - Some((_, _, s_first)) => { - self.span_note(s, fmt!("Duplicate destructor \ - declaration for class %s", - *self.interner.get(class_name))); - self.span_fatal(copy s_first, ~"First destructor \ - declared here"); - } - None => { - the_dtor = Some((copy *blk, copy *attrs, s)); - } - } - } - members(mms) => { - for mms.each |struct_field| { - fields.push(*struct_field) - } - } + for self.parse_struct_decl_field().each |struct_field| { + fields.push(*struct_field) } } if fields.len() == 0 { @@ -3342,11 +3319,13 @@ pub impl Parser { &token::RPAREN, seq_sep_trailing_allowed(token::COMMA) ) |p| { + let attrs = self.parse_outer_attributes(); let lo = p.span.lo; let struct_field_ = ast::struct_field_ { kind: unnamed_field, id: self.get_id(), - ty: p.parse_ty(false) + ty: p.parse_ty(false), + attrs: attrs, }; @spanned(lo, p.span.hi, struct_field_) }; @@ -3365,19 +3344,11 @@ pub impl Parser { ); } - let actual_dtor = do the_dtor.map |dtor| { - let (d_body, d_attrs, d_s) = copy *dtor; - codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(), - attrs: d_attrs, - self_id: self.get_id(), - body: d_body}, - span: d_s}}; let _ = self.get_id(); // XXX: Workaround for crazy bug. let new_id = self.get_id(); (class_name, item_struct(@ast::struct_def { fields: fields, - dtor: actual_dtor, ctor_id: if is_tuple_like { Some(new_id) } else { None } }, generics), None) @@ -3391,12 +3362,14 @@ pub impl Parser { } // parse a structure field declaration - fn parse_single_struct_field(&self, vis: visibility) -> @struct_field { + fn parse_single_struct_field(&self, + vis: visibility, + attrs: ~[attribute]) -> @struct_field { if self.eat_obsolete_ident("let") { self.obsolete(*self.last_span, ObsoleteLet); } - let a_var = self.parse_name_and_ty(vis); + let a_var = self.parse_name_and_ty(vis, attrs); match *self.token { token::SEMI => { self.obsolete(copy *self.span, ObsoleteFieldTerminator); @@ -3420,34 +3393,27 @@ pub impl Parser { } // parse an element of a struct definition - fn parse_struct_decl_field(&self) -> class_contents { - - if self.try_parse_obsolete_priv_section() { - return members(~[]); - } + fn parse_struct_decl_field(&self) -> ~[@struct_field] { let attrs = self.parse_outer_attributes(); + if self.try_parse_obsolete_priv_section(attrs) { + return ~[]; + } + if self.eat_keyword(&~"priv") { - return members(~[self.parse_single_struct_field(private)]) + return ~[self.parse_single_struct_field(private, attrs)] } if self.eat_keyword(&~"pub") { - return members(~[self.parse_single_struct_field(public)]); + return ~[self.parse_single_struct_field(public, attrs)]; } if self.try_parse_obsolete_struct_ctor() { - return members(~[]); + return ~[]; } - if self.eat_keyword(&~"drop") { - let lo = self.last_span.lo; - let body = self.parse_block(); - return dtor_decl(body, attrs, mk_sp(lo, self.last_span.hi)) - } - else { - return members(~[self.parse_single_struct_field(inherited)]); - } + return ~[self.parse_single_struct_field(inherited, attrs)]; } // parse visiility: PUB, PRIV, or nothing @@ -3499,9 +3465,8 @@ pub impl Parser { ) { iovi_item(item) => items.push(item), iovi_view_item(view_item) => { - self.span_fatal(view_item.span, ~"view items must be \ - declared at the top of the \ - module"); + self.span_fatal(view_item.span, "view items must be declared at the top of the \ + module"); } _ => { self.fatal( @@ -3793,7 +3758,7 @@ pub impl Parser { } if opt_abis.is_some() { - self.span_err(*self.span, ~"an ABI may not be specified here"); + self.span_err(*self.span, "an ABI may not be specified here"); } // extern mod foo; @@ -3829,44 +3794,16 @@ pub impl Parser { // parse a structure-like enum variant definition // this should probably be renamed or refactored... fn parse_struct_def(&self) -> @struct_def { - let mut the_dtor: Option<(blk, ~[attribute], codemap::span)> = None; let mut fields: ~[@struct_field] = ~[]; while *self.token != token::RBRACE { - match self.parse_struct_decl_field() { - dtor_decl(ref blk, ref attrs, s) => { - match the_dtor { - Some((_, _, s_first)) => { - self.span_note(s, ~"duplicate destructor \ - declaration"); - self.span_fatal(copy s_first, - ~"first destructor \ - declared here"); - } - None => { - the_dtor = Some((copy *blk, copy *attrs, s)); - } - } - } - members(mms) => { - for mms.each |struct_field| { - fields.push(*struct_field); - } - } + for self.parse_struct_decl_field().each |struct_field| { + fields.push(*struct_field); } } self.bump(); - let actual_dtor = do the_dtor.map |dtor| { - let (d_body, d_attrs, d_s) = copy *dtor; - codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(), - attrs: d_attrs, - self_id: self.get_id(), - body: d_body }, - span: d_s } - }; return @ast::struct_def { fields: fields, - dtor: actual_dtor, ctor_id: None }; } @@ -4456,9 +4393,7 @@ pub impl Parser { view_item_extern_mod(*) if !extern_mod_allowed => { self.span_err(view_item.span, - ~"\"extern mod\" \ - declarations are not \ - allowed here"); + "\"extern mod\" declarations are not allowed here"); } view_item_extern_mod(*) => {} } @@ -4484,8 +4419,7 @@ pub impl Parser { iovi_none => break, iovi_view_item(view_item) => { self.span_err(view_item.span, - ~"`use` and `extern mod` declarations \ - must precede items"); + "`use` and `extern mod` declarations must precede items"); } iovi_item(item) => { items.push(item) @@ -4520,8 +4454,7 @@ pub impl Parser { iovi_view_item(view_item) => { // I think this can't occur: self.span_err(view_item.span, - ~"`use` and `extern mod` declarations \ - must precede items"); + "`use` and `extern mod` declarations must precede items"); } iovi_item(_) => { // FIXME #5668: this will occur for a macro invocation: @@ -4568,14 +4501,3 @@ pub impl Parser { } } } - - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 0327a3b80da..fe7bd5b3bc1 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -305,50 +305,47 @@ pub fn is_bar(t: &Token) -> bool { pub mod special_idents { use ast::ident; - pub static underscore : ident = ident { repr: 0u, ctxt: 0}; - pub static anon : ident = ident { repr: 1u, ctxt: 0}; - pub static dtor : ident = ident { repr: 2u, ctxt: 0}; // 'drop', but that's - // reserved - pub static invalid : ident = ident { repr: 3u, ctxt: 0}; // '' - pub static unary : ident = ident { repr: 4u, ctxt: 0}; - pub static not_fn : ident = ident { repr: 5u, ctxt: 0}; - pub static idx_fn : ident = ident { repr: 6u, ctxt: 0}; - pub static unary_minus_fn : ident = ident { repr: 7u, ctxt: 0}; - pub static clownshoes_extensions : ident = ident { repr: 8u, ctxt: 0}; - - pub static self_ : ident = ident { repr: 9u, ctxt: 0}; // 'self' + pub static underscore : ident = ident { repr: 0, ctxt: 0}; + pub static anon : ident = ident { repr: 1, ctxt: 0}; + pub static invalid : ident = ident { repr: 2, ctxt: 0}; // '' + pub static unary : ident = ident { repr: 3, ctxt: 0}; + pub static not_fn : ident = ident { repr: 4, ctxt: 0}; + pub static idx_fn : ident = ident { repr: 5, ctxt: 0}; + pub static unary_minus_fn : ident = ident { repr: 6, ctxt: 0}; + pub static clownshoes_extensions : ident = ident { repr: 7, ctxt: 0}; + + pub static self_ : ident = ident { repr: 8, ctxt: 0}; // 'self' /* for matcher NTs */ - pub static item : ident = ident { repr: 10u, ctxt: 0}; - pub static block : ident = ident { repr: 11u, ctxt: 0}; - pub static stmt : ident = ident { repr: 12u, ctxt: 0}; - pub static pat : ident = ident { repr: 13u, ctxt: 0}; - pub static expr : ident = ident { repr: 14u, ctxt: 0}; - pub static ty : ident = ident { repr: 15u, ctxt: 0}; - pub static ident : ident = ident { repr: 16u, ctxt: 0}; - pub static path : ident = ident { repr: 17u, ctxt: 0}; - pub static tt : ident = ident { repr: 18u, ctxt: 0}; - pub static matchers : ident = ident { repr: 19u, ctxt: 0}; - - pub static str : ident = ident { repr: 20u, ctxt: 0}; // for the type + pub static item : ident = ident { repr: 9, ctxt: 0}; + pub static block : ident = ident { repr: 10, ctxt: 0}; + pub static stmt : ident = ident { repr: 11, ctxt: 0}; + pub static pat : ident = ident { repr: 12, ctxt: 0}; + pub static expr : ident = ident { repr: 13, ctxt: 0}; + pub static ty : ident = ident { repr: 14, ctxt: 0}; + pub static ident : ident = ident { repr: 15, ctxt: 0}; + pub static path : ident = ident { repr: 16, ctxt: 0}; + pub static tt : ident = ident { repr: 17, ctxt: 0}; + pub static matchers : ident = ident { repr: 18, ctxt: 0}; + + pub static str : ident = ident { repr: 19, ctxt: 0}; // for the type /* outside of libsyntax */ - pub static ty_visitor : ident = ident { repr: 21u, ctxt: 0}; - pub static arg : ident = ident { repr: 22u, ctxt: 0}; - pub static descrim : ident = ident { repr: 23u, ctxt: 0}; - pub static clownshoe_abi : ident = ident { repr: 24u, ctxt: 0}; - pub static clownshoe_stack_shim : ident = ident { repr: 25u, ctxt: 0}; - pub static tydesc : ident = ident { repr: 26u, ctxt: 0}; - pub static literally_dtor : ident = ident { repr: 27u, ctxt: 0}; - pub static main : ident = ident { repr: 28u, ctxt: 0}; - pub static opaque : ident = ident { repr: 29u, ctxt: 0}; - pub static blk : ident = ident { repr: 30u, ctxt: 0}; - pub static static : ident = ident { repr: 31u, ctxt: 0}; - pub static intrinsic : ident = ident { repr: 32u, ctxt: 0}; - pub static clownshoes_foreign_mod: ident = ident { repr: 33u, ctxt: 0}; - pub static unnamed_field: ident = ident { repr: 34u, ctxt: 0}; - pub static c_abi: ident = ident { repr: 35u, ctxt: 0}; - pub static type_self: ident = ident { repr: 36u, ctxt: 0}; // `Self` + pub static ty_visitor : ident = ident { repr: 20, ctxt: 0}; + pub static arg : ident = ident { repr: 21, ctxt: 0}; + pub static descrim : ident = ident { repr: 22, ctxt: 0}; + pub static clownshoe_abi : ident = ident { repr: 23, ctxt: 0}; + pub static clownshoe_stack_shim : ident = ident { repr: 24, ctxt: 0}; + pub static tydesc : ident = ident { repr: 25, ctxt: 0}; + pub static main : ident = ident { repr: 26, ctxt: 0}; + pub static opaque : ident = ident { repr: 27, ctxt: 0}; + pub static blk : ident = ident { repr: 28, ctxt: 0}; + pub static static : ident = ident { repr: 29, ctxt: 0}; + pub static intrinsic : ident = ident { repr: 30, ctxt: 0}; + pub static clownshoes_foreign_mod: ident = ident { repr: 31, ctxt: 0}; + pub static unnamed_field: ident = ident { repr: 32, ctxt: 0}; + pub static c_abi: ident = ident { repr: 33, ctxt: 0}; + pub static type_self: ident = ident { repr: 34, ctxt: 0}; // `Self` } pub struct StringRef<'self>(&'self str); @@ -371,7 +368,7 @@ impl<'self> to_bytes::IterBytes for StringRef<'self> { pub fn token_to_binop(tok: Token) -> Option<ast::binop> { match tok { BINOP(STAR) => Some(ast::mul), - BINOP(SLASH) => Some(ast::quot), + BINOP(SLASH) => Some(ast::div), BINOP(PERCENT) => Some(ast::rem), BINOP(PLUS) => Some(ast::add), BINOP(MINUS) => Some(ast::subtract), @@ -426,41 +423,39 @@ pub fn mk_fresh_ident_interner() -> @ident_interner { let init_vec = ~[ @~"_", // 0 @~"anon", // 1 - @~"drop", // 2 - @~"", // 3 - @~"unary", // 4 - @~"!", // 5 - @~"[]", // 6 - @~"unary-", // 7 - @~"__extensions__", // 8 - @~"self", // 9 - @~"item", // 10 - @~"block", // 11 - @~"stmt", // 12 - @~"pat", // 13 - @~"expr", // 14 - @~"ty", // 15 - @~"ident", // 16 - @~"path", // 17 - @~"tt", // 18 - @~"matchers", // 19 - @~"str", // 20 - @~"TyVisitor", // 21 - @~"arg", // 22 - @~"descrim", // 23 - @~"__rust_abi", // 24 - @~"__rust_stack_shim", // 25 - @~"TyDesc", // 26 - @~"dtor", // 27 - @~"main", // 28 - @~"<opaque>", // 29 - @~"blk", // 30 - @~"static", // 31 - @~"intrinsic", // 32 - @~"__foreign_mod__", // 33 - @~"__field__", // 34 - @~"C", // 35 - @~"Self", // 36 + @~"", // 2 + @~"unary", // 3 + @~"!", // 4 + @~"[]", // 5 + @~"unary-", // 6 + @~"__extensions__", // 7 + @~"self", // 8 + @~"item", // 9 + @~"block", // 10 + @~"stmt", // 11 + @~"pat", // 12 + @~"expr", // 13 + @~"ty", // 14 + @~"ident", // 15 + @~"path", // 16 + @~"tt", // 17 + @~"matchers", // 18 + @~"str", // 19 + @~"TyVisitor", // 20 + @~"arg", // 21 + @~"descrim", // 22 + @~"__rust_abi", // 23 + @~"__rust_stack_shim", // 24 + @~"TyDesc", // 25 + @~"main", // 26 + @~"<opaque>", // 27 + @~"blk", // 28 + @~"static", // 29 + @~"intrinsic", // 30 + @~"__foreign_mod__", // 31 + @~"__field__", // 32 + @~"C", // 33 + @~"Self", // 34 ]; let rv = @ident_interner { @@ -561,11 +556,3 @@ pub fn reserved_keyword_table() -> HashSet<~str> { } return words; } - - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: |
