Skip to content

Commit

Permalink
[lexer] Move self.next() in the match itself.
Browse files Browse the repository at this point in the history
  • Loading branch information
croraf committed Feb 19, 2020
1 parent f047eff commit 04185b4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions boa/src/syntax/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ impl<'a> Lexer<'a> {
return Ok(());
}
self.column_number += 1;
let ch = self.next();
match ch {
'"' | '\'' => {
match self.next() {
// StringLiteral (")
ch @ '"' | ch @ '\'' => {
let mut buf = String::new();
loop {
match self.next() {
Expand Down Expand Up @@ -436,7 +436,7 @@ impl<'a> Lexer<'a> {
return Err(e)
};
}
_ if ch.is_digit(10) => {
ch if ch.is_digit(10) => {
let mut buf = ch.to_string();
'digitloop: while let Some(ch) = self.preview_next() {
match ch {
Expand Down Expand Up @@ -679,7 +679,7 @@ impl<'a> Lexer<'a> {
'\u{0020}' | '\u{0009}' | '\u{000B}' | '\u{000C}' | '\u{00A0}' | '\u{FEFF}' |
// Unicode Space_Seperator category (minus \u{0020} and \u{00A0} which are allready stated above)
'\u{1680}' | '\u{2000}'..='\u{200A}' | '\u{202F}' | '\u{205F}' | '\u{3000}' => (),
_ => {
ch => {
let details = format!("{}:{}: Unexpected '{}'", self.line_number, self.column_number, ch);
return Err(LexerError { details });
},
Expand Down

0 comments on commit 04185b4

Please sign in to comment.