nightly fixes 22.12.24
This commit is contained in:
parent
006e982cde
commit
6494e827fb
|
@ -172,7 +172,11 @@ impl Token {
|
||||||
}
|
}
|
||||||
pub fn is_unary_op(self) -> bool {
|
pub fn is_unary_op(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Token::Plus | Token::Minus | Token::Star | Token::Ampersand | Token::Bang => true,
|
Token::Plus
|
||||||
|
| Token::Minus
|
||||||
|
| Token::Star
|
||||||
|
| Token::Ampersand
|
||||||
|
| Token::Bang => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,15 +268,16 @@ impl LexemeParser {
|
||||||
// them is represented by a single byte and we know they must be
|
// them is represented by a single byte and we know they must be
|
||||||
// utf8/ascii.
|
// utf8/ascii.
|
||||||
unsafe {
|
unsafe {
|
||||||
char::from_u32_unchecked(tok.lexeme().unwrap().as_bytes()[self.len - 1] as u32)
|
char::from_u32_unchecked(
|
||||||
== ch
|
tok.lexeme().unwrap().as_bytes()[self.len - 1] as u32,
|
||||||
|
) == ch
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// A token has been successfully matched completely if it has not yet
|
// A token has been successfully matched completely if it has not yet
|
||||||
// been removed from the lexeme list but the length of it's lexeme is no
|
// been removed from the lexeme list but the length of it's lexeme is no
|
||||||
// greater than the number of chars we've received.
|
// greater than the number of chars we've received.
|
||||||
self.candidates.extend(self.lexemes.extract_if(|tok| {
|
self.candidates.extend(self.lexemes.extract_if(.., |tok| {
|
||||||
// SAFETY: as above, all of the tokens in self.lexemes are
|
// SAFETY: as above, all of the tokens in self.lexemes are
|
||||||
// lexical and are all single byte characters.
|
// lexical and are all single byte characters.
|
||||||
tok.lexeme().unwrap().as_bytes().len() <= self.len
|
tok.lexeme().unwrap().as_bytes().len() <= self.len
|
||||||
|
|
Loading…
Reference in a new issue