Parse simple number literal
This commit is contained in:
parent
4aecce8107
commit
c593e4c872
4 changed files with 133 additions and 3 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -1,9 +1,11 @@
|
|||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use chumsky::Parser as _;
|
||||
use clap::Parser;
|
||||
|
||||
mod builtin;
|
||||
mod parser;
|
||||
mod table;
|
||||
mod value;
|
||||
|
||||
|
|
@ -25,9 +27,14 @@ fn main() -> anyhow::Result<()> {
|
|||
match args.command {
|
||||
Command::Parse { file } => {
|
||||
let content = fs::read_to_string(&file)?;
|
||||
print!("{content}");
|
||||
if !content.ends_with('\n') {
|
||||
println!();
|
||||
match parser::parser().parse(&content as &str) {
|
||||
Ok(lit) => println!("Successful parse: {lit:#?}"),
|
||||
Err(errs) => {
|
||||
println!("Parsing failed");
|
||||
for err in errs {
|
||||
println!("{err:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue