From e984cdc66f005c07ed9c5363f413259879d4d21e Mon Sep 17 00:00:00 2001 From: Soispha Date: Sun, 24 Mar 2024 19:28:27 +0100 Subject: [PATCH] feat(parser/bin): Allow `lex` as an alias to `tokenize` --- trixy-parser/src/bin/trixy-parser.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/trixy-parser/src/bin/trixy-parser.rs b/trixy-parser/src/bin/trixy-parser.rs index 2340ce7..3545150 100644 --- a/trixy-parser/src/bin/trixy-parser.rs +++ b/trixy-parser/src/bin/trixy-parser.rs @@ -51,6 +51,14 @@ pub enum Command { /// The file containing the trixy code to tokenize file: PathBuf, }, + #[clap(value_parser)] + /// Only try to tokenize the file + Lex { + #[clap(value_parser)] + /// The file containing the trixy code to tokenize + file: PathBuf, + }, + /// Check syntax, without type checking Parse { #[clap(value_parser)] @@ -75,7 +83,7 @@ pub enum Command { pub fn main() { let args = Args::parse(); match args.subcommand { - Command::Tokenize { file } => { + Command::Tokenize { file } | Command::Lex { file } => { let input = fs::read_to_string(file).unwrap(); let input_tokens = match TokenStream::lex(&input) {