Avoid match statement misidentification in token rules (#3129)

This commit is contained in:
Charlie Marsh 2023-02-22 10:44:45 -05:00 committed by GitHub
parent df3932f750
commit 1efa2e07ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 128 additions and 66 deletions

View file

@ -7,7 +7,7 @@ use rustpython_parser::{lexer, parser};
/// Collect tokens up to and including the first error.
pub fn tokenize(contents: &str) -> Vec<LexResult> {
let mut tokens: Vec<LexResult> = vec![];
for tok in lexer::make_tokenizer(contents) {
for tok in lexer::make_tokenizer(contents, Mode::Module) {
let is_err = tok.is_err();
tokens.push(tok);
if is_err {