aboutsummaryrefslogtreecommitdiff
path: root/src/parser.rs
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-04-29 12:45:48 +0100
committertslil <tslil@posteo.de>2026-04-29 14:12:10 +0100
commitcafb3a62af10bb09f8489ba0ab07258a70a75664 (patch)
treef42ebdbd75e0f4dda97750d10e95a6d930be639a /src/parser.rs
parent651a67cb568d80e72f8c6a650b985991f4b129d8 (diff)
wire in instance checking to the main checker
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/parser.rs b/src/parser.rs
index e917aac..418a17e 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -222,27 +222,30 @@ parser! {
}
}
-#[cfg(test)]
-mod tests {
- use super::*;
-
- fn debug_parse(src: &str) {
- match parser::program(src) {
- Ok(p) => println!("```{}\n```\n=>\n{}\n", src, p),
- Err(e) => {
- let line = e.location.line;
- let col = e.location.column;
- let off = e.location.offset;
- println!("FAIL at {}:{} (offset {})", line, col, off);
- println!("expected: {:#}", e.expected);
+pub fn debug_parse(src: &str) -> Programme {
+ match parser::program(src) {
+ Ok(p) => {
+ println!("```{}\n```\n=>\n{}\n", src, p);
+ p
+ }
+ Err(e) => {
+ let line = e.location.line;
+ let col = e.location.column;
+ let off = e.location.offset;
+ println!("FAIL at {}:{} (offset {})", line, col, off);
+ println!("expected: {:#}", e.expected);
- let before = &src[off.saturating_sub(40)..off];
- let after = &src[off..(off + 40).min(src.len())];
- println!("...{}⟨HERE⟩{}...", before, after);
- panic!("Parse failed!");
- }
+ let before = &src[off.saturating_sub(40)..off];
+ let after = &src[off..(off + 40).min(src.len())];
+ println!("...{}⟨HERE⟩{}...", before, after);
+ panic!("Parse failed!");
}
}
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
#[test]
fn test_sets() {