diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-10-04 11:55:58 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-10-05 08:57:35 +1100 |
| commit | e2631208b1888d6a340938314457446a7f8ed2fc (patch) | |
| tree | 6f35a5c1450bac43dc0d5e7b8d408afbf29a8567 /src/libsyntax/parse/lexer | |
| parent | cb92f5c6d6e09a7c1575241a05df15c96ca3b531 (diff) | |
| download | rust-e2631208b1888d6a340938314457446a7f8ed2fc.tar.gz rust-e2631208b1888d6a340938314457446a7f8ed2fc.zip | |
Rename StringReader::curr as ch.
Likewise, rename StringReader::curr_is as ch_is. This is a [breaking-change] for libsyntax.
Diffstat (limited to 'src/libsyntax/parse/lexer')
| -rw-r--r-- | src/libsyntax/parse/lexer/comments.rs | 30 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 168 |
2 files changed, 99 insertions, 99 deletions
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index c2a6e625fc0..38f811d54da 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -154,8 +154,8 @@ fn push_blank_line_comment(rdr: &StringReader, comments: &mut Vec<Comment>) { } fn consume_whitespace_counting_blank_lines(rdr: &mut StringReader, comments: &mut Vec<Comment>) { - while is_pattern_whitespace(rdr.curr) && !rdr.is_eof() { - if rdr.col == CharPos(0) && rdr.curr_is('\n') { + while is_pattern_whitespace(rdr.ch) && !rdr.is_eof() { + if rdr.col == CharPos(0) && rdr.ch_is('\n') { push_blank_line_comment(rdr, &mut *comments); } rdr.bump(); @@ -182,7 +182,7 @@ fn read_line_comments(rdr: &mut StringReader, debug!(">>> line comments"); let p = rdr.pos; let mut lines: Vec<String> = Vec::new(); - while rdr.curr_is('/') && rdr.nextch_is('/') { + while rdr.ch_is('/') && rdr.nextch_is('/') { let line = rdr.read_one_line_comment(); debug!("{}", line); // Doc comments are not put in comments. @@ -249,9 +249,9 @@ fn read_block_comment(rdr: &mut StringReader, let mut curr_line = String::from("/*"); // doc-comments are not really comments, they are attributes - if (rdr.curr_is('*') && !rdr.nextch_is('*')) || rdr.curr_is('!') { - while !(rdr.curr_is('*') && rdr.nextch_is('/')) && !rdr.is_eof() { - curr_line.push(rdr.curr.unwrap()); + if (rdr.ch_is('*') && !rdr.nextch_is('*')) || rdr.ch_is('!') { + while !(rdr.ch_is('*') && rdr.nextch_is('/')) && !rdr.is_eof() { + curr_line.push(rdr.ch.unwrap()); rdr.bump(); } if !rdr.is_eof() { @@ -271,19 +271,19 @@ fn read_block_comment(rdr: &mut StringReader, if rdr.is_eof() { panic!(rdr.fatal("unterminated block comment")); } - if rdr.curr_is('\n') { + if rdr.ch_is('\n') { trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col); curr_line = String::new(); rdr.bump(); } else { - curr_line.push(rdr.curr.unwrap()); - if rdr.curr_is('/') && rdr.nextch_is('*') { + curr_line.push(rdr.ch.unwrap()); + if rdr.ch_is('/') && rdr.nextch_is('*') { rdr.bump(); rdr.bump(); curr_line.push('*'); level += 1; } else { - if rdr.curr_is('*') && rdr.nextch_is('/') { + if rdr.ch_is('*') && rdr.nextch_is('/') { rdr.bump(); rdr.bump(); curr_line.push('/'); @@ -305,7 +305,7 @@ fn read_block_comment(rdr: &mut StringReader, Isolated }; rdr.consume_non_eol_whitespace(); - if !rdr.is_eof() && !rdr.curr_is('\n') && lines.len() == 1 { + if !rdr.is_eof() && !rdr.ch_is('\n') && lines.len() == 1 { style = Mixed; } debug!("<<< block comment"); @@ -319,11 +319,11 @@ fn read_block_comment(rdr: &mut StringReader, fn consume_comment(rdr: &mut StringReader, code_to_the_left: bool, comments: &mut Vec<Comment>) { debug!(">>> consume comment"); - if rdr.curr_is('/') && rdr.nextch_is('/') { + if rdr.ch_is('/') && rdr.nextch_is('/') { read_line_comments(rdr, code_to_the_left, comments); - } else if rdr.curr_is('/') && rdr.nextch_is('*') { + } else if rdr.ch_is('/') && rdr.nextch_is('*') { read_block_comment(rdr, code_to_the_left, comments); - } else if rdr.curr_is('#') && rdr.nextch_is('!') { + } else if rdr.ch_is('#') && rdr.nextch_is('!') { read_shebang_comment(rdr, code_to_the_left, comments); } else { panic!(); @@ -357,7 +357,7 @@ pub fn gather_comments_and_literals(span_diagnostic: &errors::Handler, loop { let mut code_to_the_left = !first_read; rdr.consume_non_eol_whitespace(); - if rdr.curr_is('\n') { + if rdr.ch_is('\n') { code_to_the_left = false; consume_whitespace_counting_blank_lines(&mut rdr, &mut comments); } diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index db15e076569..04d5f3a1ee4 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -82,8 +82,8 @@ pub struct StringReader<'a> { pub pos: BytePos, /// The column of the next character to read pub col: CharPos, - /// The last character to be read - pub curr: Option<char>, + /// The current character (which has been read from self.pos) + pub ch: Option<char>, pub filemap: Rc<syntax_pos::FileMap>, /// If Some, stop reading the source at this position (inclusive). pub terminator: Option<BytePos>, @@ -102,7 +102,7 @@ pub struct StringReader<'a> { impl<'a> Reader for StringReader<'a> { fn is_eof(&self) -> bool { - if self.curr.is_none() { + if self.ch.is_none() { return true; } @@ -173,7 +173,7 @@ impl<'a> Reader for TtReader<'a> { } impl<'a> StringReader<'a> { - /// For comments.rs, which hackily pokes into next_pos and curr + /// For comments.rs, which hackily pokes into next_pos and ch pub fn new_raw<'b>(span_diagnostic: &'b Handler, filemap: Rc<syntax_pos::FileMap>) -> StringReader<'b> { @@ -198,7 +198,7 @@ impl<'a> StringReader<'a> { next_pos: filemap.start_pos, pos: filemap.start_pos, col: CharPos(0), - curr: Some('\n'), + ch: Some('\n'), filemap: filemap, terminator: None, save_new_lines: true, @@ -221,8 +221,8 @@ impl<'a> StringReader<'a> { sr } - pub fn curr_is(&self, c: char) -> bool { - self.curr == Some(c) + pub fn ch_is(&self, c: char) -> bool { + self.ch == Some(c) } /// Report a fatal lexical error with a given span. @@ -332,7 +332,7 @@ impl<'a> StringReader<'a> { /// Calls `f` with a string slice of the source text spanning from `start` /// up to but excluding `self.pos`, meaning the slice does not include - /// the character `self.curr`. + /// the character `self.ch`. pub fn with_str_from<T, F>(&self, start: BytePos, f: F) -> T where F: FnOnce(&str) -> T { @@ -417,11 +417,11 @@ impl<'a> StringReader<'a> { self.pos = self.next_pos; let current_byte_offset = self.byte_offset(self.next_pos).to_usize(); if current_byte_offset < self.source_text.len() { - let last_char = self.curr.unwrap(); + let last_char = self.ch.unwrap(); let ch = char_at(&self.source_text, current_byte_offset); let byte_offset_diff = ch.len_utf8(); self.next_pos = self.next_pos + Pos::from_usize(byte_offset_diff); - self.curr = Some(ch); + self.ch = Some(ch); self.col = self.col + CharPos(1); if last_char == '\n' { if self.save_new_lines { @@ -434,7 +434,7 @@ impl<'a> StringReader<'a> { self.filemap.record_multibyte_char(self.pos, byte_offset_diff); } } else { - self.curr = None; + self.ch = None; } } @@ -471,11 +471,11 @@ impl<'a> StringReader<'a> { /// Eats <XID_start><XID_continue>*, if possible. fn scan_optional_raw_name(&mut self) -> Option<ast::Name> { - if !ident_start(self.curr) { + if !ident_start(self.ch) { return None; } let start = self.pos; - while ident_continue(self.curr) { + while ident_continue(self.ch) { self.bump(); } @@ -488,10 +488,10 @@ impl<'a> StringReader<'a> { }) } - /// PRECONDITION: self.curr is not whitespace + /// PRECONDITION: self.ch is not whitespace /// Eats any kind of comment. fn scan_comment(&mut self) -> Option<TokenAndSpan> { - if let Some(c) = self.curr { + if let Some(c) = self.ch { if c.is_whitespace() { self.span_diagnostic.span_err(syntax_pos::mk_sp(self.pos, self.pos), "called consume_any_line_comment, but there \ @@ -499,18 +499,18 @@ impl<'a> StringReader<'a> { } } - if self.curr_is('/') { + if self.ch_is('/') { match self.nextch() { Some('/') => { self.bump(); self.bump(); // line comments starting with "///" or "//!" are doc-comments - let doc_comment = self.curr_is('/') || self.curr_is('!'); + let doc_comment = self.ch_is('/') || self.ch_is('!'); let start_bpos = self.pos - BytePos(2); while !self.is_eof() { - match self.curr.unwrap() { + match self.ch.unwrap() { '\n' => break, '\r' => { if self.nextch_is('\n') { @@ -555,7 +555,7 @@ impl<'a> StringReader<'a> { } _ => None, } - } else if self.curr_is('#') { + } else if self.ch_is('#') { if self.nextch_is('!') { // Parse an inner attribute. @@ -572,7 +572,7 @@ impl<'a> StringReader<'a> { if loc.line == 1 && loc.col == CharPos(0) { // FIXME: Add shebang "token", return it let start = self.pos; - while !self.curr_is('\n') && !self.is_eof() { + while !self.ch_is('\n') && !self.is_eof() { self.bump(); } return Some(TokenAndSpan { @@ -590,7 +590,7 @@ impl<'a> StringReader<'a> { /// If there is whitespace, shebang, or a comment, scan it. Otherwise, /// return None. fn scan_whitespace_or_comment(&mut self) -> Option<TokenAndSpan> { - match self.curr.unwrap_or('\0') { + match self.ch.unwrap_or('\0') { // # to handle shebang at start of file -- this is the entry point // for skipping over all "junk" '/' | '#' => { @@ -600,7 +600,7 @@ impl<'a> StringReader<'a> { }, c if is_pattern_whitespace(Some(c)) => { let start_bpos = self.pos; - while is_pattern_whitespace(self.curr) { + while is_pattern_whitespace(self.ch) { self.bump(); } let c = Some(TokenAndSpan { @@ -617,7 +617,7 @@ impl<'a> StringReader<'a> { /// Might return a sugared-doc-attr fn scan_block_comment(&mut self) -> Option<TokenAndSpan> { // block comments starting with "/**" or "/*!" are doc-comments - let is_doc_comment = self.curr_is('*') || self.curr_is('!'); + let is_doc_comment = self.ch_is('*') || self.ch_is('!'); let start_bpos = self.pos - BytePos(2); let mut level: isize = 1; @@ -632,7 +632,7 @@ impl<'a> StringReader<'a> { let last_bpos = self.pos; panic!(self.fatal_span_(start_bpos, last_bpos, msg)); } - let n = self.curr.unwrap(); + let n = self.ch.unwrap(); match n { '/' if self.nextch_is('*') => { level += 1; @@ -682,7 +682,7 @@ impl<'a> StringReader<'a> { assert!(real_radix <= scan_radix); let mut len = 0; loop { - let c = self.curr; + let c = self.ch; if c == Some('_') { debug!("skipping a _"); self.bump(); @@ -715,7 +715,7 @@ impl<'a> StringReader<'a> { self.bump(); if c == '0' { - match self.curr.unwrap_or('\0') { + match self.ch.unwrap_or('\0') { 'b' => { self.bump(); base = 2; @@ -755,14 +755,14 @@ impl<'a> StringReader<'a> { // might be a float, but don't be greedy if this is actually an // integer literal followed by field/method access or a range pattern // (`0..2` and `12.foo()`) - if self.curr_is('.') && !self.nextch_is('.') && + if self.ch_is('.') && !self.nextch_is('.') && !self.nextch() .unwrap_or('\0') .is_xid_start() { // might have stuff after the ., and if it does, it needs to start // with a number self.bump(); - if self.curr.unwrap_or('\0').is_digit(10) { + if self.ch.unwrap_or('\0').is_digit(10) { self.scan_digits(10, 10); self.scan_float_exponent(); } @@ -771,7 +771,7 @@ impl<'a> StringReader<'a> { return token::Float(self.name_from(start_bpos)); } else { // it might be a float if it has an exponent - if self.curr_is('e') || self.curr_is('E') { + if self.ch_is('e') || self.ch_is('E') { self.scan_float_exponent(); let pos = self.pos; self.check_float_base(start_bpos, pos, base); @@ -797,7 +797,7 @@ impl<'a> StringReader<'a> { last_bpos, "unterminated numeric character escape")); } - if self.curr_is(delim) { + if self.ch_is(delim) { let last_bpos = self.pos; self.err_span_(start_bpos, last_bpos, @@ -805,7 +805,7 @@ impl<'a> StringReader<'a> { valid = false; break; } - let c = self.curr.unwrap_or('\x00'); + let c = self.ch.unwrap_or('\x00'); accum_int *= 16; accum_int += c.to_digit(16).unwrap_or_else(|| { self.err_span_char(self.pos, @@ -851,7 +851,7 @@ impl<'a> StringReader<'a> { match first_source_char { '\\' => { // '\X' for some X must be a character constant: - let escaped = self.curr; + let escaped = self.ch; let escaped_pos = self.pos; self.bump(); match escaped { @@ -861,7 +861,7 @@ impl<'a> StringReader<'a> { 'n' | 'r' | 't' | '\\' | '\'' | '"' | '0' => true, 'x' => self.scan_byte_escape(delim, !ascii_only), 'u' => { - let valid = if self.curr_is('{') { + let valid = if self.ch_is('{') { self.scan_unicode_escape(delim) && !ascii_only } else { let span = syntax_pos::mk_sp(start, self.pos); @@ -886,7 +886,7 @@ impl<'a> StringReader<'a> { self.consume_whitespace(); true } - '\r' if delim == '"' && self.curr_is('\n') => { + '\r' if delim == '"' && self.ch_is('\n') => { self.consume_whitespace(); true } @@ -932,7 +932,7 @@ impl<'a> StringReader<'a> { return false; } '\r' => { - if self.curr_is('\n') { + if self.ch_is('\n') { self.bump(); return true; } else { @@ -967,8 +967,8 @@ impl<'a> StringReader<'a> { let mut accum_int = 0; let mut valid = true; - while !self.curr_is('}') && count <= 6 { - let c = match self.curr { + while !self.ch_is('}') && count <= 6 { + let c = match self.ch { Some(c) => c, None => { panic!(self.fatal_span_(start_bpos, @@ -1015,9 +1015,9 @@ impl<'a> StringReader<'a> { /// Scan over a float exponent. fn scan_float_exponent(&mut self) { - if self.curr_is('e') || self.curr_is('E') { + if self.ch_is('e') || self.ch_is('E') { self.bump(); - if self.curr_is('-') || self.curr_is('+') { + if self.ch_is('-') || self.ch_is('+') { self.bump(); } if self.scan_digits(10, 10) == 0 { @@ -1053,7 +1053,7 @@ impl<'a> StringReader<'a> { fn binop(&mut self, op: token::BinOpToken) -> token::Token { self.bump(); - if self.curr_is('=') { + if self.ch_is('=') { self.bump(); return token::BinOpEq(op); } else { @@ -1064,7 +1064,7 @@ impl<'a> StringReader<'a> { /// Return the next token from the string, advances the input past that /// token, and updates the interner fn next_token_inner(&mut self) -> Result<token::Token, ()> { - let c = self.curr; + let c = self.ch; if ident_start(c) && match (c.unwrap(), self.nextch(), self.nextnextch()) { // Note: r as in r" or r#" is part of a raw string literal, @@ -1079,7 +1079,7 @@ impl<'a> StringReader<'a> { _ => true, } { let start = self.pos; - while ident_continue(self.curr) { + while ident_continue(self.ch) { self.bump(); } @@ -1112,9 +1112,9 @@ impl<'a> StringReader<'a> { } '.' => { self.bump(); - return if self.curr_is('.') { + return if self.ch_is('.') { self.bump(); - if self.curr_is('.') { + if self.ch_is('.') { self.bump(); Ok(token::DotDotDot) } else { @@ -1166,7 +1166,7 @@ impl<'a> StringReader<'a> { } ':' => { self.bump(); - if self.curr_is(':') { + if self.ch_is(':') { self.bump(); return Ok(token::ModSep); } else { @@ -1182,10 +1182,10 @@ impl<'a> StringReader<'a> { // Multi-byte tokens. '=' => { self.bump(); - if self.curr_is('=') { + if self.ch_is('=') { self.bump(); return Ok(token::EqEq); - } else if self.curr_is('>') { + } else if self.ch_is('>') { self.bump(); return Ok(token::FatArrow); } else { @@ -1194,7 +1194,7 @@ impl<'a> StringReader<'a> { } '!' => { self.bump(); - if self.curr_is('=') { + if self.ch_is('=') { self.bump(); return Ok(token::Ne); } else { @@ -1203,7 +1203,7 @@ impl<'a> StringReader<'a> { } '<' => { self.bump(); - match self.curr.unwrap_or('\x00') { + match self.ch.unwrap_or('\x00') { '=' => { self.bump(); return Ok(token::Le); @@ -1213,7 +1213,7 @@ impl<'a> StringReader<'a> { } '-' => { self.bump(); - match self.curr.unwrap_or('\x00') { + match self.ch.unwrap_or('\x00') { _ => { return Ok(token::LArrow); } @@ -1226,7 +1226,7 @@ impl<'a> StringReader<'a> { } '>' => { self.bump(); - match self.curr.unwrap_or('\x00') { + match self.ch.unwrap_or('\x00') { '=' => { self.bump(); return Ok(token::Ge); @@ -1246,18 +1246,18 @@ impl<'a> StringReader<'a> { let start = self.pos; // the eof will be picked up by the final `'` check below - let c2 = self.curr.unwrap_or('\x00'); + let c2 = self.ch.unwrap_or('\x00'); self.bump(); // If the character is an ident start not followed by another single // quote, then this is a lifetime name: - if ident_start(Some(c2)) && !self.curr_is('\'') { - while ident_continue(self.curr) { + if ident_start(Some(c2)) && !self.ch_is('\'') { + while ident_continue(self.ch) { self.bump(); } // lifetimes shouldn't end with a single quote // if we find one, then this is an invalid character literal - if self.curr_is('\'') { + if self.ch_is('\'') { panic!(self.fatal_span_verbose( start_with_quote, self.next_pos, String::from("character literal may only contain one codepoint"))); @@ -1292,7 +1292,7 @@ impl<'a> StringReader<'a> { false, '\''); - if !self.curr_is('\'') { + if !self.ch_is('\'') { panic!(self.fatal_span_verbose( start_with_quote, self.pos, String::from("character literal may only contain one codepoint"))); @@ -1303,13 +1303,13 @@ impl<'a> StringReader<'a> { } else { token::intern("0") }; - self.bump(); // advance curr past token + self.bump(); // advance ch past token let suffix = self.scan_optional_raw_name(); return Ok(token::Literal(token::Char(id), suffix)); } 'b' => { self.bump(); - let lit = match self.curr { + let lit = match self.ch { Some('\'') => self.scan_byte(), Some('"') => self.scan_byte_string(), Some('r') => self.scan_raw_byte_string(), @@ -1322,7 +1322,7 @@ impl<'a> StringReader<'a> { let start_bpos = self.pos; let mut valid = true; self.bump(); - while !self.curr_is('"') { + while !self.ch_is('"') { if self.is_eof() { let last_bpos = self.pos; panic!(self.fatal_span_(start_bpos, @@ -1331,7 +1331,7 @@ impl<'a> StringReader<'a> { } let ch_start = self.pos; - let ch = self.curr.unwrap(); + let ch = self.ch.unwrap(); self.bump(); valid &= self.scan_char_or_byte(ch_start, ch, @@ -1353,7 +1353,7 @@ impl<'a> StringReader<'a> { let start_bpos = self.pos; self.bump(); let mut hash_count = 0; - while self.curr_is('#') { + while self.ch_is('#') { self.bump(); hash_count += 1; } @@ -1361,9 +1361,9 @@ impl<'a> StringReader<'a> { if self.is_eof() { let last_bpos = self.pos; panic!(self.fatal_span_(start_bpos, last_bpos, "unterminated raw string")); - } else if !self.curr_is('"') { + } else if !self.ch_is('"') { let last_bpos = self.pos; - let curr_char = self.curr.unwrap(); + let curr_char = self.ch.unwrap(); panic!(self.fatal_span_char(start_bpos, last_bpos, "found invalid character; only `#` is allowed \ @@ -1379,19 +1379,19 @@ impl<'a> StringReader<'a> { let last_bpos = self.pos; panic!(self.fatal_span_(start_bpos, last_bpos, "unterminated raw string")); } - // if self.curr_is('"') { + // if self.ch_is('"') { // content_end_bpos = self.pos; // for _ in 0..hash_count { // self.bump(); - // if !self.curr_is('#') { + // if !self.ch_is('#') { // continue 'outer; - let c = self.curr.unwrap(); + let c = self.ch.unwrap(); match c { '"' => { content_end_bpos = self.pos; for _ in 0..hash_count { self.bump(); - if !self.curr_is('#') { + if !self.ch_is('#') { continue 'outer; } } @@ -1480,18 +1480,18 @@ impl<'a> StringReader<'a> { } fn consume_whitespace(&mut self) { - while is_pattern_whitespace(self.curr) && !self.is_eof() { + while is_pattern_whitespace(self.ch) && !self.is_eof() { self.bump(); } } fn read_to_eol(&mut self) -> String { let mut val = String::new(); - while !self.curr_is('\n') && !self.is_eof() { - val.push(self.curr.unwrap()); + while !self.ch_is('\n') && !self.is_eof() { + val.push(self.ch.unwrap()); self.bump(); } - if self.curr_is('\n') { + if self.ch_is('\n') { self.bump(); } return val; @@ -1505,15 +1505,15 @@ impl<'a> StringReader<'a> { } fn consume_non_eol_whitespace(&mut self) { - while is_pattern_whitespace(self.curr) && !self.curr_is('\n') && !self.is_eof() { + while is_pattern_whitespace(self.ch) && !self.ch_is('\n') && !self.is_eof() { self.bump(); } } fn peeking_at_comment(&self) -> bool { - (self.curr_is('/') && self.nextch_is('/')) || (self.curr_is('/') && self.nextch_is('*')) || + (self.ch_is('/') && self.nextch_is('/')) || (self.ch_is('/') && self.nextch_is('*')) || // consider shebangs comments, but not inner attributes - (self.curr_is('#') && self.nextch_is('!') && !self.nextnextch_is('[')) + (self.ch_is('#') && self.nextch_is('!') && !self.nextnextch_is('[')) } fn scan_byte(&mut self) -> token::Lit { @@ -1521,7 +1521,7 @@ impl<'a> StringReader<'a> { let start = self.pos; // the eof will be picked up by the final `'` check below - let c2 = self.curr.unwrap_or('\x00'); + let c2 = self.ch.unwrap_or('\x00'); self.bump(); let valid = self.scan_char_or_byte(start, @@ -1529,7 +1529,7 @@ impl<'a> StringReader<'a> { // ascii_only = true, '\''); - if !self.curr_is('\'') { + if !self.ch_is('\'') { // Byte offsetting here is okay because the // character before position `start` are an // ascii single quote and ascii 'b'. @@ -1544,7 +1544,7 @@ impl<'a> StringReader<'a> { } else { token::intern("?") }; - self.bump(); // advance curr past token + self.bump(); // advance ch past token return token::Byte(id); } @@ -1557,14 +1557,14 @@ impl<'a> StringReader<'a> { let start = self.pos; let mut valid = true; - while !self.curr_is('"') { + while !self.ch_is('"') { if self.is_eof() { let pos = self.pos; panic!(self.fatal_span_(start, pos, "unterminated double quote byte string")); } let ch_start = self.pos; - let ch = self.curr.unwrap(); + let ch = self.ch.unwrap(); self.bump(); valid &= self.scan_char_or_byte(ch_start, ch, @@ -1585,7 +1585,7 @@ impl<'a> StringReader<'a> { let start_bpos = self.pos; self.bump(); let mut hash_count = 0; - while self.curr_is('#') { + while self.ch_is('#') { self.bump(); hash_count += 1; } @@ -1593,9 +1593,9 @@ impl<'a> StringReader<'a> { if self.is_eof() { let pos = self.pos; panic!(self.fatal_span_(start_bpos, pos, "unterminated raw string")); - } else if !self.curr_is('"') { + } else if !self.ch_is('"') { let pos = self.pos; - let ch = self.curr.unwrap(); + let ch = self.ch.unwrap(); panic!(self.fatal_span_char(start_bpos, pos, "found invalid character; only `#` is allowed in raw \ @@ -1606,7 +1606,7 @@ impl<'a> StringReader<'a> { let content_start_bpos = self.pos; let mut content_end_bpos; 'outer: loop { - match self.curr { + match self.ch { None => { let pos = self.pos; panic!(self.fatal_span_(start_bpos, pos, "unterminated raw string")) @@ -1615,7 +1615,7 @@ impl<'a> StringReader<'a> { content_end_bpos = self.pos; for _ in 0..hash_count { self.bump(); - if !self.curr_is('#') { + if !self.ch_is('#') { continue 'outer; } } |
