X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fgrammar%2Fverify.rs;h=b7714a7e3c5dd96ec94ec4c2e9e86f2310d2d247;hb=1181ca4b515cc7bb68ab62f99999d06c0e6f763a;hp=3235389f1d19309bf83d68418185ef987a36b18f;hpb=b780bc513c416840ef7da3580b50248e4af07659;p=rust.git diff --git a/src/grammar/verify.rs b/src/grammar/verify.rs index 3235389f1d1..b7714a7e3c5 100644 --- a/src/grammar/verify.rs +++ b/src/grammar/verify.rs @@ -35,7 +35,7 @@ fn parse_token_list(file: &str) -> HashMap { fn id() -> token::Token { - token::Ident(ast::Ident { name: Name(0), ctxt: 0, }, token::Plain) + token::Ident(ast::Ident::with_empty_ctxt(Name(0))), token::Plain) } let mut res = HashMap::new(); @@ -75,7 +75,7 @@ fn id() -> token::Token { "RPAREN" => token::CloseDelim(token::Paren), "SLASH" => token::BinOp(token::Slash), "COMMA" => token::Comma, - "LIFETIME" => token::Lifetime(ast::Ident { name: Name(0), ctxt: 0 }), + "LIFETIME" => token::Lifetime(ast::Ident::with_empty_ctxt(Name(0))), "CARET" => token::BinOp(token::Caret), "TILDE" => token::Tilde, "IDENT" => id(), @@ -107,8 +107,8 @@ fn id() -> token::Token { "OR" => token::BinOp(token::Or), "GT" => token::Gt, "LE" => token::Le, - "LIT_BINARY" => token::Literal(token::Binary(Name(0)), None), - "LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None), + "LIT_BYTE_STR" => token::Literal(token::ByteStr(Name(0)), None), + "LIT_BYTE_STR_RAW" => token::Literal(token::ByteStrRaw(Name(0), 0), None), "QUESTION" => token::Question, "SHEBANG" => token::Shebang(Name(0)), _ => continue, @@ -137,8 +137,8 @@ fn str_to_binop(s: &str) -> token::BinOpToken { } } -/// Assuming a string/binary literal, strip out the leading/trailing -/// hashes and surrounding quotes/raw/binary prefix. +/// Assuming a string/byte string literal, strip out the leading/trailing +/// hashes and surrounding quotes/raw/byte prefix. fn fix(mut lit: &str) -> ast::Name { if lit.char_at(0) == 'r' { if lit.char_at(1) == 'b' { @@ -205,12 +205,12 @@ fn parse_antlr_token(s: &str, tokens: &HashMap, surrogate_ token::DocComment(..) => token::DocComment(nm), token::Literal(token::Integer(..), n) => token::Literal(token::Integer(nm), n), token::Literal(token::Float(..), n) => token::Literal(token::Float(nm), n), - token::Literal(token::Binary(..), n) => token::Literal(token::Binary(nm), n), - token::Literal(token::BinaryRaw(..), n) => token::Literal(token::BinaryRaw(fix(content), + token::Literal(token::ByteStr(..), n) => token::Literal(token::ByteStr(nm), n), + token::Literal(token::ByteStrRaw(..), n) => token::Literal(token::ByteStrRaw(fix(content), count(content)), n), - token::Ident(..) => token::Ident(ast::Ident { name: nm, ctxt: 0 }, + token::Ident(..) => token::Ident(ast::Ident::with_empty_ctxt(nm)), token::ModName), - token::Lifetime(..) => token::Lifetime(ast::Ident { name: nm, ctxt: 0 }), + token::Lifetime(..) => token::Lifetime(ast::Ident::with_empty_ctxt(nm)), ref t => t.clone() }; @@ -340,8 +340,8 @@ macro_rules! matches { token::Literal(token::Float(..), _), token::Literal(token::Str_(..), _), token::Literal(token::StrRaw(..), _), - token::Literal(token::Binary(..), _), - token::Literal(token::BinaryRaw(..), _), + token::Literal(token::ByteStr(..), _), + token::Literal(token::ByteStrRaw(..), _), token::Ident(..), token::Lifetime(..), token::Interpolated(..),