summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-07-05 11:36:46 -0700
committerOri Bernstein <ori@eigenstate.org>2015-07-05 11:36:46 -0700
commitcf357b748945f161ed4a4c7ebac9e1353f3307a3 (patch)
tree8d1f1991d97c37da7f7558454eafd4a46ee4d989 /mi
parent4fac3196061c75f159d37bd8e7e51dc64f0dd5df (diff)
downloadmc-cf357b748945f161ed4a4c7ebac9e1353f3307a3.tar.gz
Add proper support for a 'gap' variable.
'_' is now a reserved token.
Diffstat (limited to 'mi')
-rw-r--r--mi/match.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mi/match.c b/mi/match.c
index 343b383..969a049 100644
--- a/mi/match.c
+++ b/mi/match.c
@@ -107,7 +107,8 @@ static Dtree *addwild(Dtree *t, Node *pat, Node *val, Node ***cap, size_t *ncap)
return t->any;
t->any = mkdtree();
t->any->patexpr = pat;
- lappend(cap, ncap, pat);
+ if (cap && ncap)
+ lappend(cap, ncap, pat);
return t->any;
}
@@ -228,6 +229,9 @@ static Dtree *addpat(Dtree *t, Node *pat, Node *val, Node ***cap, size_t *ncap)
case Ostruct:
ret = addstruct(t, pat, val, cap, ncap);
break;
+ case Ogap:
+ ret = addwild(t, pat, val, NULL, NULL);
+ break;
default:
ret = NULL;
fatal(pat, "unsupported pattern %s of type %s", opstr[exprop(pat)], tystr(exprtype(pat)));