summaryrefslogtreecommitdiff
path: root/libregex
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-06-14 21:09:40 -0700
committerOri Bernstein <ori@eigenstate.org>2015-06-15 01:19:24 -0700
commit94acc736ec2d8d80533439a24742d7c796aaab4f (patch)
tree36f4b2f9e9c9d4288df1c3b9171635903fac1d69 /libregex
parentfd91c0a3fc7e496e8d55e91ebe0e44b61bca8ce1 (diff)
downloadmc-94acc736ec2d8d80533439a24742d7c796aaab4f.tar.gz
Show where a regex failed.
Diffstat (limited to 'libregex')
-rw-r--r--libregex/redump.myr9
1 files changed, 7 insertions, 2 deletions
diff --git a/libregex/redump.myr b/libregex/redump.myr
index 7f7ed40..47df80d 100644
--- a/libregex/redump.myr
+++ b/libregex/redump.myr
@@ -42,7 +42,7 @@ const dump = {re, fd
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 dump = {re, fd
;;
}
-const show = {mg
+const show = {re, ln, mg
var i
match mg
@@ -61,5 +61,10 @@ const show = {mg
;;
| `std.None:
std.put("Match failed\n")
+ std.put("{}\n", ln)
+ for i = 0; i < re.strp - 1; i++
+ std.put(" ")
+ ;;
+ std.put("^\n")
;;
}