ref: 94acc736ec2d8d80533439a24742d7c796aaab4f
parent: fd91c0a3fc7e496e8d55e91ebe0e44b61bca8ce1
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 14 17:09:40 EDT 2015
Show where a regex failed.
--- a/libregex/redump.myr
+++ b/libregex/redump.myr
@@ -42,7 +42,7 @@
while true
match bio.readln(fd)
| `std.Some ln:
- show(regex.exec(re, ln))
+ show(re, ln, regex.exec(re, ln))
std.slfree(ln)
| `std.None:
break
@@ -50,7 +50,7 @@
;;
}
-const show = {mg
+const show = {re, ln, mg
var i
match mg
@@ -61,5 +61,10 @@
;;
| `std.None:
std.put("Match failed\n")
+ std.put("{}\n", ln)
+ for i = 0; i < re.strp - 1; i++
+ std.put(" ")
+ ;;
+ std.put("^\n")
;;
}