mirror of
https://github.com/danog/parser.git
synced 2024-11-27 04:14:55 +01:00
phpast: allow only executing lexer
This commit is contained in:
parent
6f80c051a4
commit
5fe2c9c6c5
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user