diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-09-02 02:50:59 +0200 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-09-02 02:51:21 +0200 |
| commit | 857f8673206fd2d8803e02c68cdeb38e26b95df0 (patch) | |
| tree | 7cfb11be2843774595371087f2829d0e2e830fe2 /src/libsyntax/parse | |
| parent | 1f4aba8cbf7caa3a82b52b6f171221ed6067eed5 (diff) | |
| download | rust-857f8673206fd2d8803e02c68cdeb38e26b95df0.tar.gz rust-857f8673206fd2d8803e02c68cdeb38e26b95df0.zip | |
Renamed syntax::ast::ident -> Ident
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 172 |
2 files changed, 98 insertions, 98 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ea3437820a1..02af6d23b44 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -34,7 +34,7 @@ use ast::{expr_vstore_slice, expr_vstore_box}; use ast::{expr_vstore_mut_slice, expr_while, expr_for_loop, extern_fn, Field, fn_decl}; use ast::{expr_vstore_uniq, Onceness, Once, Many}; use ast::{foreign_item, foreign_item_static, foreign_item_fn, foreign_mod}; -use ast::{ident, impure_fn, inherited, item, item_, item_static}; +use ast::{Ident, impure_fn, inherited, item, item_, item_static}; use ast::{item_enum, item_fn, item_foreign_mod, item_impl}; use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_}; use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int}; @@ -95,7 +95,7 @@ enum restriction { } type arg_or_capture_item = Either<arg, ()>; -type item_info = (ident, item_, Option<~[Attribute]>); +type item_info = (Ident, item_, Option<~[Attribute]>); /// How to parse a path. There are four different kinds of paths, all of which /// are parsed somewhat differently. @@ -476,7 +476,7 @@ impl Parser { self.commit_stmt(s, &[edible], &[]) } - pub fn parse_ident(&self) -> ast::ident { + pub fn parse_ident(&self) -> ast::Ident { self.check_strict_keywords(); self.check_reserved_keywords(); match *self.token { @@ -756,7 +756,7 @@ impl Parser { } pub fn get_id(&self) -> NodeId { next_node_id(self.sess) } - pub fn id_to_str(&self, id: ident) -> @str { + pub fn id_to_str(&self, id: Ident) -> @str { get_ident_interner().get(id.name) } @@ -775,7 +775,7 @@ impl Parser { } } - pub fn get_lifetime(&self, tok: &token::Token) -> ast::ident { + pub fn get_lifetime(&self, tok: &token::Token) -> ast::Ident { match *tok { token::LIFETIME(ref ident) => *ident, _ => self.bug("not a lifetime"), @@ -1664,7 +1664,7 @@ impl Parser { pub fn mk_method_call(&self, rcvr: @expr, - ident: ident, + ident: Ident, tps: ~[Ty], args: ~[@expr], sugar: CallSugar) -> ast::expr_ { @@ -1675,7 +1675,7 @@ impl Parser { expr_index(self.get_id(), expr, idx) } - pub fn mk_field(&self, expr: @expr, ident: ident, tys: ~[Ty]) -> ast::expr_ { + pub fn mk_field(&self, expr: @expr, ident: Ident, tys: ~[Ty]) -> ast::expr_ { expr_field(expr, ident, tys) } @@ -2550,7 +2550,7 @@ impl Parser { return self.mk_expr(lo, hi, expr_while(cond, body)); } - pub fn parse_loop_expr(&self, opt_ident: Option<ast::ident>) -> @expr { + pub fn parse_loop_expr(&self, opt_ident: Option<ast::Ident>) -> @expr { // loop headers look like 'loop {' or 'loop unsafe {' let is_loop_header = *self.token == token::LBRACE @@ -3713,13 +3713,13 @@ impl Parser { } // parse the name and optional generic types of a function header. - fn parse_fn_header(&self) -> (ident, ast::Generics) { + fn parse_fn_header(&self) -> (Ident, ast::Generics) { let id = self.parse_ident(); let generics = self.parse_generics(); (id, generics) } - fn mk_item(&self, lo: BytePos, hi: BytePos, ident: ident, + fn mk_item(&self, lo: BytePos, hi: BytePos, ident: Ident, node: item_, vis: visibility, attrs: ~[Attribute]) -> @item { @ast::item { ident: ident, @@ -4107,7 +4107,7 @@ impl Parser { } } - fn push_mod_path(&self, id: ident, attrs: &[Attribute]) { + fn push_mod_path(&self, id: Ident, attrs: &[Attribute]) { let default_path = token::interner_get(id.name); let file_path = match ::attr::first_attr_value_str_by_name(attrs, "path") { @@ -4123,7 +4123,7 @@ impl Parser { // read a module from a source file. fn eval_src_mod(&self, - id: ast::ident, + id: ast::Ident, outer_attrs: &[ast::Attribute], id_sp: Span) -> (ast::item_, ~[ast::Attribute]) { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 8128a4e905c..3d47b1141dd 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -76,22 +76,22 @@ pub enum Token { LIT_INT(i64, ast::int_ty), LIT_UINT(u64, ast::uint_ty), LIT_INT_UNSUFFIXED(i64), - LIT_FLOAT(ast::ident, ast::float_ty), - LIT_FLOAT_UNSUFFIXED(ast::ident), - LIT_STR(ast::ident), + LIT_FLOAT(ast::Ident, ast::float_ty), + LIT_FLOAT_UNSUFFIXED(ast::Ident), + LIT_STR(ast::Ident), /* Name components */ // an identifier contains an "is_mod_name" boolean, // indicating whether :: follows this token with no // whitespace in between. - IDENT(ast::ident, bool), + IDENT(ast::Ident, bool), UNDERSCORE, - LIFETIME(ast::ident), + LIFETIME(ast::Ident), /* For interpolation */ INTERPOLATED(nonterminal), - DOC_COMMENT(ast::ident), + DOC_COMMENT(ast::Ident), EOF, } @@ -104,7 +104,7 @@ pub enum nonterminal { nt_pat( @ast::pat), nt_expr(@ast::expr), nt_ty( ~ast::Ty), - nt_ident(~ast::ident, bool), + nt_ident(~ast::Ident, bool), nt_attr(@ast::Attribute), // #[foo] nt_path(~ast::Path), nt_tt( @ast::token_tree), //needs @ed to break a circularity @@ -307,46 +307,46 @@ pub fn is_bar(t: &Token) -> bool { pub mod special_idents { - use ast::ident; + use ast::Ident; - pub static underscore : ident = ident { name: 0, ctxt: 0}; - pub static anon : ident = ident { name: 1, ctxt: 0}; - pub static invalid : ident = ident { name: 2, ctxt: 0}; // '' - pub static unary : ident = ident { name: 3, ctxt: 0}; - pub static not_fn : ident = ident { name: 4, ctxt: 0}; - pub static idx_fn : ident = ident { name: 5, ctxt: 0}; - pub static unary_minus_fn : ident = ident { name: 6, ctxt: 0}; - pub static clownshoes_extensions : ident = ident { name: 7, ctxt: 0}; + pub static underscore : Ident = Ident { name: 0, ctxt: 0}; + pub static anon : Ident = Ident { name: 1, ctxt: 0}; + pub static invalid : Ident = Ident { name: 2, ctxt: 0}; // '' + pub static unary : Ident = Ident { name: 3, ctxt: 0}; + pub static not_fn : Ident = Ident { name: 4, ctxt: 0}; + pub static idx_fn : Ident = Ident { name: 5, ctxt: 0}; + pub static unary_minus_fn : Ident = Ident { name: 6, ctxt: 0}; + pub static clownshoes_extensions : Ident = Ident { name: 7, ctxt: 0}; - pub static self_ : ident = ident { name: 8, ctxt: 0}; // 'self' + pub static self_ : Ident = Ident { name: 8, ctxt: 0}; // 'self' /* for matcher NTs */ - pub static item : ident = ident { name: 9, ctxt: 0}; - pub static block : ident = ident { name: 10, ctxt: 0}; - pub static stmt : ident = ident { name: 11, ctxt: 0}; - pub static pat : ident = ident { name: 12, ctxt: 0}; - pub static expr : ident = ident { name: 13, ctxt: 0}; - pub static ty : ident = ident { name: 14, ctxt: 0}; - pub static ident : ident = ident { name: 15, ctxt: 0}; - pub static path : ident = ident { name: 16, ctxt: 0}; - pub static tt : ident = ident { name: 17, ctxt: 0}; - pub static matchers : ident = ident { name: 18, ctxt: 0}; - - pub static str : ident = ident { name: 19, ctxt: 0}; // for the type + pub static item : Ident = Ident { name: 9, ctxt: 0}; + pub static block : Ident = Ident { name: 10, ctxt: 0}; + pub static stmt : Ident = Ident { name: 11, ctxt: 0}; + pub static pat : Ident = Ident { name: 12, ctxt: 0}; + pub static expr : Ident = Ident { name: 13, ctxt: 0}; + pub static ty : Ident = Ident { name: 14, ctxt: 0}; + pub static ident : Ident = Ident { name: 15, ctxt: 0}; + pub static path : Ident = Ident { name: 16, ctxt: 0}; + pub static tt : Ident = Ident { name: 17, ctxt: 0}; + pub static matchers : Ident = Ident { name: 18, ctxt: 0}; + + pub static str : Ident = Ident { name: 19, ctxt: 0}; // for the type /* outside of libsyntax */ - pub static arg : ident = ident { name: 20, ctxt: 0}; - pub static descrim : ident = ident { name: 21, ctxt: 0}; - pub static clownshoe_abi : ident = ident { name: 22, ctxt: 0}; - pub static clownshoe_stack_shim : ident = ident { name: 23, ctxt: 0}; - pub static main : ident = ident { name: 24, ctxt: 0}; - pub static opaque : ident = ident { name: 25, ctxt: 0}; - pub static blk : ident = ident { name: 26, ctxt: 0}; - pub static statik : ident = ident { name: 27, ctxt: 0}; - pub static clownshoes_foreign_mod: ident = ident { name: 28, ctxt: 0}; - pub static unnamed_field: ident = ident { name: 29, ctxt: 0}; - pub static c_abi: ident = ident { name: 30, ctxt: 0}; - pub static type_self: ident = ident { name: 31, ctxt: 0}; // `Self` + pub static arg : Ident = Ident { name: 20, ctxt: 0}; + pub static descrim : Ident = Ident { name: 21, ctxt: 0}; + pub static clownshoe_abi : Ident = Ident { name: 22, ctxt: 0}; + pub static clownshoe_stack_shim : Ident = Ident { name: 23, ctxt: 0}; + pub static main : Ident = Ident { name: 24, ctxt: 0}; + pub static opaque : Ident = Ident { name: 25, ctxt: 0}; + pub static blk : Ident = Ident { name: 26, ctxt: 0}; + pub static statik : Ident = Ident { name: 27, ctxt: 0}; + pub static clownshoes_foreign_mod: Ident = Ident { name: 28, ctxt: 0}; + pub static unnamed_field: Ident = Ident { name: 29, ctxt: 0}; + pub static c_abi: Ident = Ident { name: 30, ctxt: 0}; + pub static type_self: Ident = Ident { name: 31, ctxt: 0}; // `Self` } /** @@ -525,18 +525,18 @@ pub fn interner_get(name : Name) -> @str { } // maps an identifier to the string that it corresponds to -pub fn ident_to_str(id : &ast::ident) -> @str { +pub fn ident_to_str(id : &ast::Ident) -> @str { interner_get(id.name) } // maps a string to an identifier with an empty syntax context -pub fn str_to_ident(str : &str) -> ast::ident { - ast::new_ident(intern(str)) +pub fn str_to_ident(str : &str) -> ast::Ident { + ast::Ident::new(intern(str)) } // maps a string to a gensym'ed identifier -pub fn gensym_ident(str : &str) -> ast::ident { - ast::new_ident(gensym(str)) +pub fn gensym_ident(str : &str) -> ast::Ident { + ast::Ident::new(gensym(str)) } @@ -561,7 +561,7 @@ pub fn fresh_name(src_name : &str) -> Name { * the language and may not appear as identifiers. */ pub mod keywords { - use ast::ident; + use ast::Ident; pub enum Keyword { // Strict keywords @@ -608,46 +608,46 @@ pub mod keywords { } impl Keyword { - pub fn to_ident(&self) -> ident { + pub fn to_ident(&self) -> Ident { match *self { - As => ident { name: 32, ctxt: 0 }, - Break => ident { name: 33, ctxt: 0 }, - Const => ident { name: 34, ctxt: 0 }, - Do => ident { name: 35, ctxt: 0 }, - Else => ident { name: 36, ctxt: 0 }, - Enum => ident { name: 37, ctxt: 0 }, - Extern => ident { name: 38, ctxt: 0 }, - False => ident { name: 39, ctxt: 0 }, - Fn => ident { name: 40, ctxt: 0 }, - For => ident { name: 41, ctxt: 0 }, - If => ident { name: 42, ctxt: 0 }, - Impl => ident { name: 43, ctxt: 0 }, - In => ident { name: 63, ctxt: 0 }, - Let => ident { name: 44, ctxt: 0 }, - __Log => ident { name: 45, ctxt: 0 }, - Loop => ident { name: 46, ctxt: 0 }, - Match => ident { name: 47, ctxt: 0 }, - Mod => ident { name: 48, ctxt: 0 }, - Mut => ident { name: 49, ctxt: 0 }, - Once => ident { name: 50, ctxt: 0 }, - Priv => ident { name: 51, ctxt: 0 }, - Pub => ident { name: 52, ctxt: 0 }, - Ref => ident { name: 53, ctxt: 0 }, - Return => ident { name: 54, ctxt: 0 }, - Static => ident { name: 27, ctxt: 0 }, - Self => ident { name: 8, ctxt: 0 }, - Struct => ident { name: 55, ctxt: 0 }, - Super => ident { name: 56, ctxt: 0 }, - True => ident { name: 57, ctxt: 0 }, - Trait => ident { name: 58, ctxt: 0 }, - Type => ident { name: 59, ctxt: 0 }, - Typeof => ident { name: 67, ctxt: 0 }, - Unsafe => ident { name: 60, ctxt: 0 }, - Use => ident { name: 61, ctxt: 0 }, - While => ident { name: 62, ctxt: 0 }, - Be => ident { name: 64, ctxt: 0 }, - Pure => ident { name: 65, ctxt: 0 }, - Yield => ident { name: 66, ctxt: 0 }, + As => Ident { name: 32, ctxt: 0 }, + Break => Ident { name: 33, ctxt: 0 }, + Const => Ident { name: 34, ctxt: 0 }, + Do => Ident { name: 35, ctxt: 0 }, + Else => Ident { name: 36, ctxt: 0 }, + Enum => Ident { name: 37, ctxt: 0 }, + Extern => Ident { name: 38, ctxt: 0 }, + False => Ident { name: 39, ctxt: 0 }, + Fn => Ident { name: 40, ctxt: 0 }, + For => Ident { name: 41, ctxt: 0 }, + If => Ident { name: 42, ctxt: 0 }, + Impl => Ident { name: 43, ctxt: 0 }, + In => Ident { name: 63, ctxt: 0 }, + Let => Ident { name: 44, ctxt: 0 }, + __Log => Ident { name: 45, ctxt: 0 }, + Loop => Ident { name: 46, ctxt: 0 }, + Match => Ident { name: 47, ctxt: 0 }, + Mod => Ident { name: 48, ctxt: 0 }, + Mut => Ident { name: 49, ctxt: 0 }, + Once => Ident { name: 50, ctxt: 0 }, + Priv => Ident { name: 51, ctxt: 0 }, + Pub => Ident { name: 52, ctxt: 0 }, + Ref => Ident { name: 53, ctxt: 0 }, + Return => Ident { name: 54, ctxt: 0 }, + Static => Ident { name: 27, ctxt: 0 }, + Self => Ident { name: 8, ctxt: 0 }, + Struct => Ident { name: 55, ctxt: 0 }, + Super => Ident { name: 56, ctxt: 0 }, + True => Ident { name: 57, ctxt: 0 }, + Trait => Ident { name: 58, ctxt: 0 }, + Type => Ident { name: 59, ctxt: 0 }, + Typeof => Ident { name: 67, ctxt: 0 }, + Unsafe => Ident { name: 60, ctxt: 0 }, + Use => Ident { name: 61, ctxt: 0 }, + While => Ident { name: 62, ctxt: 0 }, + Be => Ident { name: 64, ctxt: 0 }, + Pure => Ident { name: 65, ctxt: 0 }, + Yield => Ident { name: 66, ctxt: 0 }, } } } |
