Resolve visibility issues
use syntax::ast::Name; is a reexport of syntax::symbol::Symbol(u32);
This commit is contained in:
parent
0bcb05cf50
commit
2dc3fdf2bd
@ -23,7 +23,6 @@ use std::fs::File;
|
|||||||
use std::io::{BufRead, Read};
|
use std::io::{BufRead, Read};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use syntax::parse;
|
|
||||||
use syntax::parse::lexer;
|
use syntax::parse::lexer;
|
||||||
use rustc::dep_graph::DepGraph;
|
use rustc::dep_graph::DepGraph;
|
||||||
use rustc::session::{self, config};
|
use rustc::session::{self, config};
|
||||||
@ -31,7 +30,6 @@ use rustc::middle::cstore::DummyCrateStore;
|
|||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast::Name;
|
|
||||||
use syntax::codemap;
|
use syntax::codemap;
|
||||||
use syntax::parse::token::{self, BinOpToken, DelimToken, Lit, Token};
|
use syntax::parse::token::{self, BinOpToken, DelimToken, Lit, Token};
|
||||||
use syntax::parse::lexer::TokenAndSpan;
|
use syntax::parse::lexer::TokenAndSpan;
|
||||||
@ -41,7 +39,7 @@ use syntax::symbol::Symbol;
|
|||||||
|
|
||||||
fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
|
fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
|
||||||
fn id() -> token::Token {
|
fn id() -> token::Token {
|
||||||
Token::Ident(ast::Ident::with_empty_ctxt(Name(0)))
|
Token::Ident(ast::Ident::with_empty_ctxt(Symbol::invalid()))
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut res = HashMap::new();
|
let mut res = HashMap::new();
|
||||||
@ -67,7 +65,7 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
|
|||||||
"SHL" => Token::BinOp(BinOpToken::Shl),
|
"SHL" => Token::BinOp(BinOpToken::Shl),
|
||||||
"LBRACE" => Token::OpenDelim(DelimToken::Brace),
|
"LBRACE" => Token::OpenDelim(DelimToken::Brace),
|
||||||
"RARROW" => Token::RArrow,
|
"RARROW" => Token::RArrow,
|
||||||
"LIT_STR" => Token::Literal(Lit::Str_(Name(0)), None),
|
"LIT_STR" => Token::Literal(Lit::Str_(Symbol::invalid()), None),
|
||||||
"DOTDOT" => Token::DotDot,
|
"DOTDOT" => Token::DotDot,
|
||||||
"MOD_SEP" => Token::ModSep,
|
"MOD_SEP" => Token::ModSep,
|
||||||
"DOTDOTDOT" => Token::DotDotDot,
|
"DOTDOTDOT" => Token::DotDotDot,
|
||||||
@ -77,21 +75,21 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
|
|||||||
"ANDAND" => Token::AndAnd,
|
"ANDAND" => Token::AndAnd,
|
||||||
"AT" => Token::At,
|
"AT" => Token::At,
|
||||||
"LBRACKET" => Token::OpenDelim(DelimToken::Bracket),
|
"LBRACKET" => Token::OpenDelim(DelimToken::Bracket),
|
||||||
"LIT_STR_RAW" => Token::Literal(Lit::StrRaw(Name(0), 0), None),
|
"LIT_STR_RAW" => Token::Literal(Lit::StrRaw(Symbol::invalid(), 0), None),
|
||||||
"RPAREN" => Token::CloseDelim(DelimToken::Paren),
|
"RPAREN" => Token::CloseDelim(DelimToken::Paren),
|
||||||
"SLASH" => Token::BinOp(BinOpToken::Slash),
|
"SLASH" => Token::BinOp(BinOpToken::Slash),
|
||||||
"COMMA" => Token::Comma,
|
"COMMA" => Token::Comma,
|
||||||
"LIFETIME" => Token::Lifetime(ast::Ident::with_empty_ctxt(Name(0))),
|
"LIFETIME" => Token::Lifetime(ast::Ident::with_empty_ctxt(Symbol::invalid())),
|
||||||
"CARET" => Token::BinOp(BinOpToken::Caret),
|
"CARET" => Token::BinOp(BinOpToken::Caret),
|
||||||
"TILDE" => Token::Tilde,
|
"TILDE" => Token::Tilde,
|
||||||
"IDENT" => id(),
|
"IDENT" => id(),
|
||||||
"PLUS" => Token::BinOp(BinOpToken::Plus),
|
"PLUS" => Token::BinOp(BinOpToken::Plus),
|
||||||
"LIT_CHAR" => Token::Literal(Lit::Char(Name(0)), None),
|
"LIT_CHAR" => Token::Literal(Lit::Char(Symbol::invalid()), None),
|
||||||
"LIT_BYTE" => Token::Literal(Lit::Byte(Name(0)), None),
|
"LIT_BYTE" => Token::Literal(Lit::Byte(Symbol::invalid()), None),
|
||||||
"EQ" => Token::Eq,
|
"EQ" => Token::Eq,
|
||||||
"RBRACKET" => Token::CloseDelim(DelimToken::Bracket),
|
"RBRACKET" => Token::CloseDelim(DelimToken::Bracket),
|
||||||
"COMMENT" => Token::Comment,
|
"COMMENT" => Token::Comment,
|
||||||
"DOC_COMMENT" => Token::DocComment(Name(0)),
|
"DOC_COMMENT" => Token::DocComment(Symbol::invalid()),
|
||||||
"DOT" => Token::Dot,
|
"DOT" => Token::Dot,
|
||||||
"EQEQ" => Token::EqEq,
|
"EQEQ" => Token::EqEq,
|
||||||
"NE" => Token::Ne,
|
"NE" => Token::Ne,
|
||||||
@ -101,9 +99,9 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
|
|||||||
"BINOP" => Token::BinOp(BinOpToken::Plus),
|
"BINOP" => Token::BinOp(BinOpToken::Plus),
|
||||||
"POUND" => Token::Pound,
|
"POUND" => Token::Pound,
|
||||||
"OROR" => Token::OrOr,
|
"OROR" => Token::OrOr,
|
||||||
"LIT_INTEGER" => Token::Literal(Lit::Integer(Name(0)), None),
|
"LIT_INTEGER" => Token::Literal(Lit::Integer(Symbol::invalid()), None),
|
||||||
"BINOPEQ" => Token::BinOpEq(BinOpToken::Plus),
|
"BINOPEQ" => Token::BinOpEq(BinOpToken::Plus),
|
||||||
"LIT_FLOAT" => Token::Literal(Lit::Float(Name(0)), None),
|
"LIT_FLOAT" => Token::Literal(Lit::Float(Symbol::invalid()), None),
|
||||||
"WHITESPACE" => Token::Whitespace,
|
"WHITESPACE" => Token::Whitespace,
|
||||||
"UNDERSCORE" => Token::Underscore,
|
"UNDERSCORE" => Token::Underscore,
|
||||||
"MINUS" => Token::BinOp(BinOpToken::Minus),
|
"MINUS" => Token::BinOp(BinOpToken::Minus),
|
||||||
@ -113,10 +111,10 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
|
|||||||
"OR" => Token::BinOp(BinOpToken::Or),
|
"OR" => Token::BinOp(BinOpToken::Or),
|
||||||
"GT" => Token::Gt,
|
"GT" => Token::Gt,
|
||||||
"LE" => Token::Le,
|
"LE" => Token::Le,
|
||||||
"LIT_BINARY" => Token::Literal(Lit::ByteStr(Name(0)), None),
|
"LIT_BINARY" => Token::Literal(Lit::ByteStr(Symbol::invalid()), None),
|
||||||
"LIT_BINARY_RAW" => Token::Literal(Lit::ByteStrRaw(Name(0), 0), None),
|
"LIT_BINARY_RAW" => Token::Literal(Lit::ByteStrRaw(Symbol::invalid(), 0), None),
|
||||||
"QUESTION" => Token::Question,
|
"QUESTION" => Token::Question,
|
||||||
"SHEBANG" => Token::Shebang(Name(0)),
|
"SHEBANG" => Token::Shebang(Symbol::invalid()),
|
||||||
_ => continue,
|
_ => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,6 +35,10 @@ impl Symbol {
|
|||||||
with_interner(|interner| interner.gensym(string))
|
with_interner(|interner| interner.gensym(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn invalid() -> Self {
|
||||||
|
Symbol(0u32)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn as_str(self) -> InternedString {
|
pub fn as_str(self) -> InternedString {
|
||||||
with_interner(|interner| unsafe {
|
with_interner(|interner| unsafe {
|
||||||
InternedString {
|
InternedString {
|
||||||
|
Loading…
Reference in New Issue
Block a user