Files
RedBear-OS/local/recipes/shells/brush/source/brush-parser/examples/miette.rs
T
vasilito 25fb843c40 brush: vendor the source tree (un-ignore) to complete the local fork
The prior commit switched the recipe to `[source] path = "source"`, but
.gitignore:77 still listed `local/recipes/shells/brush/source` (a leftover from
when brush was a transient upstream git fetch), so the vendored tree was not
tracked — a fresh clone would have no brush source and the build would fail.
Drop that ignore line and commit the vendored working tree (reubeno/brush @
897b373e, with the Redox port patches pre-applied). brush is now a durable
local fork like the other path=source recipes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-26 23:34:31 +09:00

25 lines
564 B
Rust

//! Simple example of miette usage
use std::io::Cursor;
use brush_parser::Parser;
use miette::{IntoDiagnostic, miette};
fn main() -> miette::Result<()> {
let f = std::env::args()
.nth(1)
.ok_or_else(|| miette!("Please provide a file name"))?;
let source = std::fs::read_to_string(&f).into_diagnostic()?;
let reader = Cursor::new(&source);
let mut parser = Parser::builder().build(reader);
let ast = parser
.parse_program()
.map_err(|e| e.to_pretty_error(&source))?;
println!("{ast:#?}");
Ok(())
}