phpast: allow only executing lexer

This commit is contained in:
Ryan Chandler 2022-07-21 20:16:34 +01:00
parent 6f80c051a4
commit 5fe2c9c6c5
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -12,6 +12,9 @@ struct Args {
#[structopt(short, long, help = "Output the abstract syntax tree as JSON.")]
json: bool,
#[structopt(short, long, help = "Only execute the lexer on the source file.")]
lexer: bool,
}
fn main() {
@ -28,6 +31,10 @@ fn main() {
let mut lexer = Lexer::new(None);
let tokens = lexer.tokenize(&input[..]).unwrap();
if args.lexer {
return;
}
let mut parser = Parser::new(tokens);
let ast = match parser.parse() {
Ok(a) => a,