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

@ -6,6 +6,7 @@ use std::path::PathBuf;
use anyhow::Result;
use rustpython_parser::lexer;
use rustpython_parser::mode::Mode;
#[derive(clap::Args)]
pub struct Args {
@ -16,7 +17,7 @@ pub struct Args {
pub fn main(args: &Args) -> Result<()> {
let contents = fs::read_to_string(&args.file)?;
for (_, tok, _) in lexer::make_tokenizer(&contents).flatten() {
for (_, tok, _) in lexer::make_tokenizer(&contents, Mode::Module).flatten() {
println!("{tok:#?}");
}
Ok(())