aboutsummaryrefslogtreecommitdiff
path: root/lptree.c
diff options
context:
space:
mode:
Diffstat (limited to 'lptree.c')
-rw-r--r--lptree.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lptree.c b/lptree.c
index 6d6b399..ba091d6 100644
--- a/lptree.c
+++ b/lptree.c
@@ -1204,8 +1204,16 @@ static int lp_match (lua_State *L) {
1204 r = match(L, s, s + i, s + l, code, capture, ptop, &labelf, &sfail); /* labeled failure */ 1204 r = match(L, s, s + i, s + l, code, capture, ptop, &labelf, &sfail); /* labeled failure */
1205 if (r == NULL) { /* labeled failure begin */ 1205 if (r == NULL) { /* labeled failure begin */
1206 lua_pushnil(L); 1206 lua_pushnil(L);
1207 if (labelf) 1207 if (labelf) {
1208 int isnum;
1209 lua_Integer lInt;
1208 lua_rawgeti(L, ktableidx(ptop), labelf); 1210 lua_rawgeti(L, ktableidx(ptop), labelf);
1211 lInt = lua_tointegerx(L, -1, &isnum);
1212 if (isnum) {
1213 lua_pop(L, 1);
1214 lua_pushinteger(L, lInt);
1215 }
1216 }
1209 else 1217 else
1210 lua_pushstring(L, "fail"); 1218 lua_pushstring(L, "fail");
1211 lua_pushinteger(L, sfail - (s + i) + 1); /* subject position related to the error */ 1219 lua_pushinteger(L, sfail - (s + i) + 1); /* subject position related to the error */