ref: 0529dbb64b33733ef6caeb7403e708e49e8f1b36
parent: 3eb19da0ab48e2040438dee79a5a2c578516f30c
parent: 5d6dda0307498ac0371f9f8275e584c9718cbfdf
author: Ori Bernstein <[email protected]>
date: Tue Oct 22 17:52:38 EDT 2013
Merge branch 'master' of git+ssh://git.eigenstate.org/git/ori/libregex h
--- a/compile.myr
+++ b/compile.myr
@@ -40,7 +40,7 @@
re = std.zalloc()
re.pat = pat
match parse(re)
- `None: std.put("Empty parse\n");;
+ `None: -> `std.Failure (`Earlystop);;
`Fail f: -> `std.Failure f;;
`Some t:
dump(t, 0)
@@ -187,7 +187,7 @@
var i
for i = 0; i < indent; i++
- std.put(" ")
+ std.put(" ")
;;
match t#
`Alt (a, b):
@@ -274,7 +274,6 @@
;;
other: -> other;;
;;
- std.put("<- alt\n")
-> `Some ret
}
@@ -281,7 +280,6 @@
const catexpr = {re
var ret
- std.put("-> cat\n")
match repexpr(re)
`Some t:
ret = t
@@ -295,7 +293,6 @@
;;
other: -> other;;
;;
- std.put("<- cat\n")
-> `Some ret
}
@@ -302,7 +299,6 @@
const repexpr = {re
var ret
- std.put("-> rep\n")
match baseexpr(re)
`Some t:
if matchc(re, '*')
@@ -317,7 +313,6 @@
;;
other: -> other;;
;;
- std.put("<- rep")
-> `Some ret
}
@@ -324,7 +319,6 @@
const baseexpr = {re
var ret
- std.put("-> base\n")
if re.pat.len == 0
-> `None
;;
@@ -346,7 +340,6 @@
`None: -> `Fail (`Emptyparen);;
;;
if !matchc(re, ')')
- std.put("Can't find match: got %c\n", getc(re))
free(ret)
-> `Fail (`Unbalanced)
;;
@@ -362,7 +355,6 @@
ret = mk(`Chr c)
;;
;;
- std.put("<- base\n")
dump(ret, 0)
-> `Some ret
}
--- a/main.myr
+++ b/main.myr
@@ -3,7 +3,7 @@
const main = {
var found
- match regex.compile("(a|b)*")
+ match regex.compile("(a|b)*s*")
`std.Success re:
found = regex.exec(re, "ababaasssss")
std.put("Found = %t: len = %z\n", found, re.strp)