mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-20 11:43:04 +00:00
rename repr to name
This commit is contained in:
parent
7266981b4c
commit
22d21ab4c2
@ -734,7 +734,7 @@ pub fn mangle_internal_name_by_path(ccx: @CrateContext, path: path) -> ~str {
|
||||
}
|
||||
|
||||
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, flav: &str) -> ~str {
|
||||
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
|
||||
return fmt!("%s_%u", flav, (ccx.names)(flav).name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ pub fn new_namegen(intr: @ident_interner) -> namegen {
|
||||
let f: @fn(s: &str) -> ident = |prefix| {
|
||||
intr.gensym(fmt!("%s_%u",
|
||||
prefix,
|
||||
intr.gensym(prefix).repr))
|
||||
intr.gensym(prefix).name))
|
||||
};
|
||||
f
|
||||
}
|
||||
@ -1195,7 +1195,7 @@ pub fn C_cstr(cx: @CrateContext, s: @~str) -> ValueRef {
|
||||
llvm::LLVMConstString(buf, s.len() as c_uint, False)
|
||||
};
|
||||
let g =
|
||||
str::as_c_str(fmt!("str%u", (cx.names)("str").repr),
|
||||
str::as_c_str(fmt!("str%u", (cx.names)("str").name),
|
||||
|buf| llvm::LLVMAddGlobal(cx.llmod, val_ty(sc), buf));
|
||||
llvm::LLVMSetInitializer(g, sc);
|
||||
llvm::LLVMSetGlobalConstant(g, True);
|
||||
@ -1287,7 +1287,7 @@ pub fn C_bytes_plus_null(bytes: &[u8]) -> ValueRef {
|
||||
pub fn C_shape(ccx: @CrateContext, bytes: ~[u8]) -> ValueRef {
|
||||
unsafe {
|
||||
let llshape = C_bytes_plus_null(bytes);
|
||||
let name = fmt!("shape%u", (ccx.names)("shape").repr);
|
||||
let name = fmt!("shape%u", (ccx.names)("shape").name);
|
||||
let llglobal = str::as_c_str(name, |buf| {
|
||||
llvm::LLVMAddGlobal(ccx.llmod, val_ty(llshape), buf)
|
||||
});
|
||||
|
@ -2678,7 +2678,7 @@ impl cmp::TotalOrd for bound_region {
|
||||
(&ty::br_anon(ref a1), &ty::br_anon(ref a2)) => a1.cmp(a2),
|
||||
(&ty::br_anon(*), _) => cmp::Less,
|
||||
|
||||
(&ty::br_named(ref a1), &ty::br_named(ref a2)) => a1.repr.cmp(&a2.repr),
|
||||
(&ty::br_named(ref a1), &ty::br_named(ref a2)) => a1.name.cmp(&a2.name),
|
||||
(&ty::br_named(*), _) => cmp::Less,
|
||||
|
||||
(&ty::br_cap_avoid(ref a1, @ref b1),
|
||||
|
@ -25,12 +25,12 @@ use core::to_str::ToStr;
|
||||
use extra::serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
|
||||
// an identifier contains an index into the interner
|
||||
// table and a SyntaxContext to track renaming and
|
||||
// an identifier contains a Name (index into the interner
|
||||
// table) and a SyntaxContext to track renaming and
|
||||
// macro expansion per Flatt et al., "Macros
|
||||
// That Work Together"
|
||||
#[deriving(Eq)]
|
||||
pub struct ident { repr: Name, ctxt: SyntaxContext }
|
||||
pub struct ident { name: Name, ctxt: SyntaxContext }
|
||||
|
||||
// a SyntaxContext represents a chain of macro-expandings
|
||||
// and renamings. Each macro expansion corresponds to
|
||||
@ -96,7 +96,7 @@ impl<D:Decoder> Decodable<D> for ident {
|
||||
impl to_bytes::IterBytes for ident {
|
||||
#[inline(always)]
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
|
||||
self.repr.iter_bytes(lsb0, f)
|
||||
self.name.iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,8 +620,8 @@ pub enum Privacy {
|
||||
|
||||
// HYGIENE FUNCTIONS
|
||||
|
||||
/// Construct an identifier with the given repr and an empty context:
|
||||
pub fn new_ident(repr: uint) -> ident { ident {repr: repr, ctxt: 0}}
|
||||
/// Construct an identifier with the given name and an empty context:
|
||||
pub fn new_ident(name: Name) -> ident { ident {name: name, ctxt: 0}}
|
||||
|
||||
/// Extend a syntax context with a given mark
|
||||
pub fn new_mark (m:Mrk, tail:SyntaxContext,table:&mut SCTable)
|
||||
@ -686,14 +686,14 @@ fn idx_push<T>(vec: &mut ~[T], val: T) -> uint {
|
||||
/// Resolve a syntax object to a name, per MTWT.
|
||||
pub fn resolve (id : ident, table : &mut SCTable) -> Name {
|
||||
match table.table[id.ctxt] {
|
||||
EmptyCtxt => id.repr,
|
||||
EmptyCtxt => id.name,
|
||||
// ignore marks here:
|
||||
Mark(_,subctxt) => resolve (ident{repr:id.repr, ctxt: subctxt},table),
|
||||
Mark(_,subctxt) => resolve (ident{name:id.name, ctxt: subctxt},table),
|
||||
// do the rename if necessary:
|
||||
Rename(ident{repr,ctxt},toname,subctxt) => {
|
||||
Rename(ident{name,ctxt},toname,subctxt) => {
|
||||
// this could be cached or computed eagerly:
|
||||
let resolvedfrom = resolve(ident{repr:repr,ctxt:ctxt},table);
|
||||
let resolvedthis = resolve(ident{repr:id.repr,ctxt:subctxt},table);
|
||||
let resolvedfrom = resolve(ident{name:name,ctxt:ctxt},table);
|
||||
let resolvedthis = resolve(ident{name:id.name,ctxt:subctxt},table);
|
||||
if ((resolvedthis == resolvedfrom)
|
||||
&& (marksof (ctxt,resolvedthis,table)
|
||||
== marksof (subctxt,resolvedthis,table))) {
|
||||
@ -777,11 +777,11 @@ mod test {
|
||||
// convert a list of uints to an @~[ident]
|
||||
// (ignores the interner completely)
|
||||
fn uints_to_idents (uints: &~[uint]) -> @~[ident] {
|
||||
@uints.map(|u|{ ident {repr:*u, ctxt: empty_ctxt} })
|
||||
@uints.map(|u|{ ident {name:*u, ctxt: empty_ctxt} })
|
||||
}
|
||||
|
||||
fn id (u : uint, s: SyntaxContext) -> ident {
|
||||
ident{repr:u, ctxt: s}
|
||||
ident{name:u, ctxt: s}
|
||||
}
|
||||
|
||||
// because of the SCTable, I now need a tidy way of
|
||||
|
@ -52,7 +52,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
|
||||
let extname = pth.idents[0];
|
||||
let extnamestr = get_ident_interner().get(extname);
|
||||
// leaving explicit deref here to highlight unbox op:
|
||||
match (*extsbox).find(&extname.repr) {
|
||||
match (*extsbox).find(&extname.name) {
|
||||
None => {
|
||||
cx.span_fatal(
|
||||
pth.span,
|
||||
@ -219,7 +219,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
|
||||
let extname = pth.idents[0];
|
||||
let interner = get_ident_interner();
|
||||
let extnamestr = interner.get(extname);
|
||||
let expanded = match (*extsbox).find(&extname.repr) {
|
||||
let expanded = match (*extsbox).find(&extname.name) {
|
||||
None => cx.span_fatal(pth.span,
|
||||
fmt!("macro undefined: '%s!'", *extnamestr)),
|
||||
|
||||
@ -317,7 +317,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
|
||||
}
|
||||
let extname = pth.idents[0];
|
||||
let extnamestr = get_ident_interner().get(extname);
|
||||
let (fully_expanded, sp) = match (*extsbox).find(&extname.repr) {
|
||||
let (fully_expanded, sp) = match (*extsbox).find(&extname.name) {
|
||||
None =>
|
||||
cx.span_fatal(pth.span, fmt!("macro undefined: '%s'", *extnamestr)),
|
||||
|
||||
@ -391,7 +391,7 @@ fn renames_to_fold(renames : @mut ~[(ast::ident,ast::Name)]) -> @ast_fold {
|
||||
let new_ctxt = renames.foldl(id.ctxt,|ctxt,&(from,to)| {
|
||||
new_rename(from,to,*ctxt,table)
|
||||
});
|
||||
ast::ident{repr:id.repr,ctxt:new_ctxt}
|
||||
ast::ident{name:id.name,ctxt:new_ctxt}
|
||||
},
|
||||
.. *afp
|
||||
};
|
||||
@ -697,7 +697,7 @@ pub fn new_ident_renamer(from: ast::ident,
|
||||
@fn(ast::ident)->ast::ident {
|
||||
|id : ast::ident|
|
||||
ast::ident{
|
||||
repr: id.repr,
|
||||
name: id.name,
|
||||
ctxt: new_rename(from,to,id.ctxt,table)
|
||||
}
|
||||
}
|
||||
@ -709,7 +709,7 @@ pub fn new_ident_marker(mark: uint,
|
||||
@fn(ast::ident)->ast::ident {
|
||||
|id : ast::ident|
|
||||
ast::ident{
|
||||
repr: id.repr,
|
||||
name: id.name,
|
||||
ctxt: new_mark(mark,id.ctxt,table)
|
||||
}
|
||||
}
|
||||
@ -720,7 +720,7 @@ pub fn new_ident_resolver(table: @mut SCTable) ->
|
||||
@fn(ast::ident)->ast::ident {
|
||||
|id : ast::ident|
|
||||
ast::ident {
|
||||
repr : resolve(id,table),
|
||||
name : resolve(id,table),
|
||||
ctxt : illegal_ctxt
|
||||
}
|
||||
}
|
||||
@ -848,8 +848,8 @@ mod test {
|
||||
};
|
||||
let table = @mut new_sctable();
|
||||
let a_name = 100; // enforced by testing_interner
|
||||
let a2_name = sess.interner.gensym("a2").repr;
|
||||
let renamer = new_ident_renamer(ast::ident{repr:a_name,ctxt:empty_ctxt},
|
||||
let a2_name = sess.interner.gensym("a2").name;
|
||||
let renamer = new_ident_renamer(ast::ident{name:a_name,ctxt:empty_ctxt},
|
||||
a2_name,table);
|
||||
let renamed_ast = fun_to_ident_folder(renamer).fold_item(item_ast).get();
|
||||
let resolver = new_ident_resolver(table);
|
||||
|
@ -142,7 +142,7 @@ impl Parser {
|
||||
// true. Otherwise, return false.
|
||||
pub fn eat_keyword(&self, kw: keywords::Keyword) -> bool {
|
||||
let is_kw = match *self.token {
|
||||
token::IDENT(sid, false) => kw.to_ident().repr == sid.repr,
|
||||
token::IDENT(sid, false) => kw.to_ident().name == sid.name,
|
||||
_ => false
|
||||
};
|
||||
if is_kw { self.bump() }
|
||||
|
@ -304,47 +304,47 @@ pub fn is_bar(t: &Token) -> bool {
|
||||
pub mod special_idents {
|
||||
use ast::ident;
|
||||
|
||||
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 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 { repr: 8, ctxt: 0}; // 'self'
|
||||
pub static self_ : ident = ident { name: 8, ctxt: 0}; // 'self'
|
||||
|
||||
/* for matcher NTs */
|
||||
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 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 { repr: 19, ctxt: 0}; // for the type
|
||||
pub static str : ident = ident { name: 19, ctxt: 0}; // for the type
|
||||
|
||||
/* outside of libsyntax */
|
||||
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 statik : 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 static ty_visitor : ident = ident { name: 20, ctxt: 0};
|
||||
pub static arg : ident = ident { name: 21, ctxt: 0};
|
||||
pub static descrim : ident = ident { name: 22, ctxt: 0};
|
||||
pub static clownshoe_abi : ident = ident { name: 23, ctxt: 0};
|
||||
pub static clownshoe_stack_shim : ident = ident { name: 24, ctxt: 0};
|
||||
pub static tydesc : ident = ident { name: 25, ctxt: 0};
|
||||
pub static main : ident = ident { name: 26, ctxt: 0};
|
||||
pub static opaque : ident = ident { name: 27, ctxt: 0};
|
||||
pub static blk : ident = ident { name: 28, ctxt: 0};
|
||||
pub static statik : ident = ident { name: 29, ctxt: 0};
|
||||
pub static intrinsic : ident = ident { name: 30, ctxt: 0};
|
||||
pub static clownshoes_foreign_mod: ident = ident { name: 31, ctxt: 0};
|
||||
pub static unnamed_field: ident = ident { name: 32, ctxt: 0};
|
||||
pub static c_abi: ident = ident { name: 33, ctxt: 0};
|
||||
pub static type_self: ident = ident { name: 34, ctxt: 0}; // `Self`
|
||||
}
|
||||
|
||||
pub struct StringRef<'self>(&'self str);
|
||||
@ -397,13 +397,13 @@ impl ident_interner {
|
||||
// I'm torn as to whether these should produce idents or
|
||||
// just uints.
|
||||
pub fn intern(&self, val: &str) -> ast::ident {
|
||||
ast::ident { repr: self.interner.intern(val), ctxt: 0 }
|
||||
ast::ident { name: self.interner.intern(val), ctxt: 0 }
|
||||
}
|
||||
pub fn gensym(&self, val: &str) -> ast::ident {
|
||||
ast::ident { repr: self.interner.gensym(val), ctxt: 0 }
|
||||
ast::ident { name: self.interner.gensym(val), ctxt: 0 }
|
||||
}
|
||||
pub fn get(&self, idx: ast::ident) -> @~str {
|
||||
self.interner.get(idx.repr)
|
||||
self.interner.get(idx.name)
|
||||
}
|
||||
pub fn len(&self) -> uint {
|
||||
self.interner.len()
|
||||
@ -412,7 +412,7 @@ impl ident_interner {
|
||||
IterBytes +
|
||||
Equiv<@~str>>(&self, val: &Q) -> Option<ast::ident> {
|
||||
match self.interner.find_equiv(val) {
|
||||
Some(v) => Some(ast::ident { repr: v, ctxt: 0 }),
|
||||
Some(v) => Some(ast::ident { name: v, ctxt: 0 }),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
@ -534,7 +534,7 @@ pub fn mk_fake_ident_interner() -> @ident_interner {
|
||||
// maps a string to its interned representation
|
||||
pub fn intern(str : &str) -> uint {
|
||||
let interner = get_ident_interner();
|
||||
interner.intern(str).repr
|
||||
interner.intern(str).name
|
||||
}
|
||||
|
||||
/**
|
||||
@ -592,42 +592,42 @@ pub mod keywords {
|
||||
impl Keyword {
|
||||
pub fn to_ident(&self) -> ident {
|
||||
match *self {
|
||||
As => ident { repr: 35, ctxt: 0 },
|
||||
Break => ident { repr: 36, ctxt: 0 },
|
||||
Const => ident { repr: 37, ctxt: 0 },
|
||||
Copy => ident { repr: 38, ctxt: 0 },
|
||||
Do => ident { repr: 39, ctxt: 0 },
|
||||
Else => ident { repr: 41, ctxt: 0 },
|
||||
Enum => ident { repr: 42, ctxt: 0 },
|
||||
Extern => ident { repr: 43, ctxt: 0 },
|
||||
False => ident { repr: 44, ctxt: 0 },
|
||||
Fn => ident { repr: 45, ctxt: 0 },
|
||||
For => ident { repr: 46, ctxt: 0 },
|
||||
If => ident { repr: 47, ctxt: 0 },
|
||||
Impl => ident { repr: 48, ctxt: 0 },
|
||||
Let => ident { repr: 49, ctxt: 0 },
|
||||
__Log => ident { repr: 50, ctxt: 0 },
|
||||
Loop => ident { repr: 51, ctxt: 0 },
|
||||
Match => ident { repr: 52, ctxt: 0 },
|
||||
Mod => ident { repr: 53, ctxt: 0 },
|
||||
Mut => ident { repr: 54, ctxt: 0 },
|
||||
Once => ident { repr: 55, ctxt: 0 },
|
||||
Priv => ident { repr: 56, ctxt: 0 },
|
||||
Pub => ident { repr: 57, ctxt: 0 },
|
||||
Pure => ident { repr: 58, ctxt: 0 },
|
||||
Ref => ident { repr: 59, ctxt: 0 },
|
||||
Return => ident { repr: 60, ctxt: 0 },
|
||||
Static => ident { repr: 29, ctxt: 0 },
|
||||
Self => ident { repr: 8, ctxt: 0 },
|
||||
Struct => ident { repr: 61, ctxt: 0 },
|
||||
Super => ident { repr: 62, ctxt: 0 },
|
||||
True => ident { repr: 63, ctxt: 0 },
|
||||
Trait => ident { repr: 64, ctxt: 0 },
|
||||
Type => ident { repr: 65, ctxt: 0 },
|
||||
Unsafe => ident { repr: 66, ctxt: 0 },
|
||||
Use => ident { repr: 67, ctxt: 0 },
|
||||
While => ident { repr: 68, ctxt: 0 },
|
||||
Be => ident { repr: 69, ctxt: 0 },
|
||||
As => ident { name: 35, ctxt: 0 },
|
||||
Break => ident { name: 36, ctxt: 0 },
|
||||
Const => ident { name: 37, ctxt: 0 },
|
||||
Copy => ident { name: 38, ctxt: 0 },
|
||||
Do => ident { name: 39, ctxt: 0 },
|
||||
Else => ident { name: 41, ctxt: 0 },
|
||||
Enum => ident { name: 42, ctxt: 0 },
|
||||
Extern => ident { name: 43, ctxt: 0 },
|
||||
False => ident { name: 44, ctxt: 0 },
|
||||
Fn => ident { name: 45, ctxt: 0 },
|
||||
For => ident { name: 46, ctxt: 0 },
|
||||
If => ident { name: 47, ctxt: 0 },
|
||||
Impl => ident { name: 48, ctxt: 0 },
|
||||
Let => ident { name: 49, ctxt: 0 },
|
||||
__Log => ident { name: 50, ctxt: 0 },
|
||||
Loop => ident { name: 51, ctxt: 0 },
|
||||
Match => ident { name: 52, ctxt: 0 },
|
||||
Mod => ident { name: 53, ctxt: 0 },
|
||||
Mut => ident { name: 54, ctxt: 0 },
|
||||
Once => ident { name: 55, ctxt: 0 },
|
||||
Priv => ident { name: 56, ctxt: 0 },
|
||||
Pub => ident { name: 57, ctxt: 0 },
|
||||
Pure => ident { name: 58, ctxt: 0 },
|
||||
Ref => ident { name: 59, ctxt: 0 },
|
||||
Return => ident { name: 60, ctxt: 0 },
|
||||
Static => ident { name: 29, ctxt: 0 },
|
||||
Self => ident { name: 8, ctxt: 0 },
|
||||
Struct => ident { name: 61, ctxt: 0 },
|
||||
Super => ident { name: 62, ctxt: 0 },
|
||||
True => ident { name: 63, ctxt: 0 },
|
||||
Trait => ident { name: 64, ctxt: 0 },
|
||||
Type => ident { name: 65, ctxt: 0 },
|
||||
Unsafe => ident { name: 66, ctxt: 0 },
|
||||
Use => ident { name: 67, ctxt: 0 },
|
||||
While => ident { name: 68, ctxt: 0 },
|
||||
Be => ident { name: 69, ctxt: 0 },
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -635,14 +635,14 @@ pub mod keywords {
|
||||
|
||||
pub fn is_keyword(kw: keywords::Keyword, tok: &Token) -> bool {
|
||||
match *tok {
|
||||
token::IDENT(sid, false) => { kw.to_ident().repr == sid.repr }
|
||||
token::IDENT(sid, false) => { kw.to_ident().name == sid.name }
|
||||
_ => { false }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_any_keyword(tok: &Token) -> bool {
|
||||
match *tok {
|
||||
token::IDENT(sid, false) => match sid.repr {
|
||||
token::IDENT(sid, false) => match sid.name {
|
||||
8 | 29 | 35 .. 69 => true,
|
||||
_ => false,
|
||||
},
|
||||
@ -652,7 +652,7 @@ pub fn is_any_keyword(tok: &Token) -> bool {
|
||||
|
||||
pub fn is_strict_keyword(tok: &Token) -> bool {
|
||||
match *tok {
|
||||
token::IDENT(sid, false) => match sid.repr {
|
||||
token::IDENT(sid, false) => match sid.name {
|
||||
8 | 29 | 35 .. 68 => true,
|
||||
_ => false,
|
||||
},
|
||||
@ -662,7 +662,7 @@ pub fn is_strict_keyword(tok: &Token) -> bool {
|
||||
|
||||
pub fn is_reserved_keyword(tok: &Token) -> bool {
|
||||
match *tok {
|
||||
token::IDENT(sid, false) => match sid.repr {
|
||||
token::IDENT(sid, false) => match sid.name {
|
||||
69 => true,
|
||||
_ => false,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user