diff options
Diffstat (limited to 'lptree.c')
-rw-r--r-- | lptree.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -19,7 +19,7 @@ | |||
19 | const byte numsiblings[] = { | 19 | const byte numsiblings[] = { |
20 | 0, 0, 0, /* char, set, any */ | 20 | 0, 0, 0, /* char, set, any */ |
21 | 0, 0, 0, /* true, false, utf-range */ | 21 | 0, 0, 0, /* true, false, utf-range */ |
22 | 1, /* rep */ | 22 | 1, /* acc */ |
23 | 2, 2, /* seq, choice */ | 23 | 2, 2, /* seq, choice */ |
24 | 1, 1, /* not, and */ | 24 | 1, 1, /* not, and */ |
25 | 0, 0, 2, 1, 1, /* call, opencall, rule, prerule, grammar */ | 25 | 0, 0, 2, 1, 1, /* call, opencall, rule, prerule, grammar */ |
@@ -850,6 +850,11 @@ static int lp_divcapture (lua_State *L) { | |||
850 | } | 850 | } |
851 | 851 | ||
852 | 852 | ||
853 | static int lp_acccapture (lua_State *L) { | ||
854 | return capture_aux(L, Cacc, 2); | ||
855 | } | ||
856 | |||
857 | |||
853 | static int lp_substcapture (lua_State *L) { | 858 | static int lp_substcapture (lua_State *L) { |
854 | return capture_aux(L, Csubst, 0); | 859 | return capture_aux(L, Csubst, 0); |
855 | } | 860 | } |
@@ -1250,7 +1255,7 @@ static int lp_match (lua_State *L) { | |||
1250 | int ptop = lua_gettop(L); | 1255 | int ptop = lua_gettop(L); |
1251 | lua_pushnil(L); /* initialize subscache */ | 1256 | lua_pushnil(L); /* initialize subscache */ |
1252 | lua_pushlightuserdata(L, capture); /* initialize caplistidx */ | 1257 | lua_pushlightuserdata(L, capture); /* initialize caplistidx */ |
1253 | lua_getuservalue(L, 1); /* initialize penvidx */ | 1258 | lua_getuservalue(L, 1); /* initialize ktableidx */ |
1254 | r = match(L, s, s + i, s + l, code, capture, ptop); | 1259 | r = match(L, s, s + i, s + l, code, capture, ptop); |
1255 | if (r == NULL) { | 1260 | if (r == NULL) { |
1256 | lua_pushnil(L); | 1261 | lua_pushnil(L); |
@@ -1369,6 +1374,7 @@ static struct luaL_Reg metareg[] = { | |||
1369 | {"__gc", lp_gc}, | 1374 | {"__gc", lp_gc}, |
1370 | {"__len", lp_and}, | 1375 | {"__len", lp_and}, |
1371 | {"__div", lp_divcapture}, | 1376 | {"__div", lp_divcapture}, |
1377 | {"__mod", lp_acccapture}, | ||
1372 | {"__unm", lp_not}, | 1378 | {"__unm", lp_not}, |
1373 | {"__sub", lp_sub}, | 1379 | {"__sub", lp_sub}, |
1374 | {NULL, NULL} | 1380 | {NULL, NULL} |