summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorstuebinm2024-04-16 20:18:00 +0200
committerstuebinm2024-04-16 20:18:00 +0200
commitcf418ce76679f019834e4b6ff2cbafc6d40c180e (patch)
treed772f07ea4754073675ed07359729f453ef3bf5c /src/main.rs
parent238dabec513eac8af699756281d5aec12720686c (diff)
produces & print errors for unknown query constructs
Not sure yet if i'll keep the printing code, it's kinda fragile & there's almost definitely a crate which i could use instead.
Diffstat (limited to '')
-rw-r--r--src/main.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 54f17a5..2a4898d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -35,6 +35,7 @@ fn parse_nexp(path: &PathBuf) -> anyhow::Result<(String, rnix::Root)> {
Ok((content, parse.tree()))
}
+
fn main() {
let args = Args::parse();
@@ -51,13 +52,15 @@ fn main() {
let query = match parse.to_query() {
Err(es) => {
- eprintln!("{}", es.join("\n"));
+ queries::print_query_errors(&args.query, es);
exit(1);
},
Ok(query) => query
};
- // println!("{nexp:#?}");
+ if args.debug {
+ println!("{query:?}");
+ }
if args.batchmode {
batchmode::batchmode(args.path, query, args.debug);
@@ -196,7 +199,7 @@ fn surrounding_noise(node: &rnix::SyntaxNode) -> (NixNodeOrToken, NixNodeOrToken
fn remove_node(node: &rnix::SyntaxNode) -> (usize, usize) {
let (before, after) = surrounding_noise(node);
- let (mut prev, mut next) =
+ let (mut prev, /*mut*/ next) =
eat_whitespace(&before, &after);
// println!("{prev:?}, {next:?}");