Apply second and third patch from http://lua.org/bugs.html.diff -r1.4 -r1.5 src/external/mit/lua/dist/src/lparser.c
(mbalmer)
--- src/external/mit/lua/dist/src/lparser.c 2016/01/28 14:41:39 1.4
+++ src/external/mit/lua/dist/src/lparser.c 2016/03/25 08:15:20 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lparser.c,v 1.4 2016/01/28 14:41:39 lneto Exp $ */ | 1 | /* $NetBSD: lparser.c,v 1.5 2016/03/25 08:15:20 mbalmer Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | ** Id: lparser.c,v 2.149 2015/11/02 16:09:30 roberto Exp | 4 | ** Id: lparser.c,v 2.149 2015/11/02 16:09:30 roberto Exp | |
5 | ** Lua Parser | 5 | ** Lua Parser | |
6 | ** See Copyright Notice in lua.h | 6 | ** See Copyright Notice in lua.h | |
7 | */ | 7 | */ | |
8 | 8 | |||
9 | #define lparser_c | 9 | #define lparser_c | |
10 | #define LUA_CORE | 10 | #define LUA_CORE | |
11 | 11 | |||
12 | #include "lprefix.h" | 12 | #include "lprefix.h" | |
13 | 13 | |||
14 | 14 | |||
@@ -1230,27 +1230,27 @@ static void skipnoopstat (LexState *ls) | @@ -1230,27 +1230,27 @@ static void skipnoopstat (LexState *ls) | |||
1230 | while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) | 1230 | while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) | |
1231 | statement(ls); | 1231 | statement(ls); | |
1232 | } | 1232 | } | |
1233 | 1233 | |||
1234 | 1234 | |||
1235 | static void labelstat (LexState *ls, TString *label, int line) { | 1235 | static void labelstat (LexState *ls, TString *label, int line) { | |
1236 | /* label -> '::' NAME '::' */ | 1236 | /* label -> '::' NAME '::' */ | |
1237 | FuncState *fs = ls->fs; | 1237 | FuncState *fs = ls->fs; | |
1238 | Labellist *ll = &ls->dyd->label; | 1238 | Labellist *ll = &ls->dyd->label; | |
1239 | int l; /* index of new label being created */ | 1239 | int l; /* index of new label being created */ | |
1240 | checkrepeated(fs, ll, label); /* check for repeated labels */ | 1240 | checkrepeated(fs, ll, label); /* check for repeated labels */ | |
1241 | checknext(ls, TK_DBCOLON); /* skip double colon */ | 1241 | checknext(ls, TK_DBCOLON); /* skip double colon */ | |
1242 | /* create new entry for this label */ | 1242 | /* create new entry for this label */ | |
1243 | l = newlabelentry(ls, ll, label, line, fs->pc); | 1243 | l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); | |
1244 | skipnoopstat(ls); /* skip other no-op statements */ | 1244 | skipnoopstat(ls); /* skip other no-op statements */ | |
1245 | if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ | 1245 | if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ | |
1246 | /* assume that locals are already out of scope */ | 1246 | /* assume that locals are already out of scope */ | |
1247 | ll->arr[l].nactvar = fs->bl->nactvar; | 1247 | ll->arr[l].nactvar = fs->bl->nactvar; | |
1248 | } | 1248 | } | |
1249 | findgotos(ls, &ll->arr[l]); | 1249 | findgotos(ls, &ll->arr[l]); | |
1250 | } | 1250 | } | |
1251 | 1251 | |||
1252 | 1252 | |||
1253 | static void whilestat (LexState *ls, int line) { | 1253 | static void whilestat (LexState *ls, int line) { | |
1254 | /* whilestat -> WHILE cond DO block END */ | 1254 | /* whilestat -> WHILE cond DO block END */ | |
1255 | FuncState *fs = ls->fs; | 1255 | FuncState *fs = ls->fs; | |
1256 | int whileinit; | 1256 | int whileinit; |
--- src/external/mit/lua/dist/src/lstrlib.c 2016/01/28 14:41:39 1.11
+++ src/external/mit/lua/dist/src/lstrlib.c 2016/03/25 08:15:20 1.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lstrlib.c,v 1.11 2016/01/28 14:41:39 lneto Exp $ */ | 1 | /* $NetBSD: lstrlib.c,v 1.12 2016/03/25 08:15:20 mbalmer Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | ** Id: lstrlib.c,v 1.239 2015/11/25 16:28:17 roberto Exp | 4 | ** Id: lstrlib.c,v 1.239 2015/11/25 16:28:17 roberto Exp | |
5 | ** Standard library for string operations and pattern-matching | 5 | ** Standard library for string operations and pattern-matching | |
6 | ** See Copyright Notice in lua.h | 6 | ** See Copyright Notice in lua.h | |
7 | */ | 7 | */ | |
8 | 8 | |||
9 | #define lstrlib_c | 9 | #define lstrlib_c | |
10 | #define LUA_LIB | 10 | #define LUA_LIB | |
11 | 11 | |||
12 | #include "lprefix.h" | 12 | #include "lprefix.h" | |
13 | 13 | |||
14 | 14 | |||
@@ -682,26 +682,27 @@ static int str_match (lua_State *L) { | @@ -682,26 +682,27 @@ static int str_match (lua_State *L) { | |||
682 | 682 | |||
683 | 683 | |||
684 | /* state for 'gmatch' */ | 684 | /* state for 'gmatch' */ | |
685 | typedef struct GMatchState { | 685 | typedef struct GMatchState { | |
686 | const char *src; /* current position */ | 686 | const char *src; /* current position */ | |
687 | const char *p; /* pattern */ | 687 | const char *p; /* pattern */ | |
688 | MatchState ms; /* match state */ | 688 | MatchState ms; /* match state */ | |
689 | } GMatchState; | 689 | } GMatchState; | |
690 | 690 | |||
691 | 691 | |||
692 | static int gmatch_aux (lua_State *L) { | 692 | static int gmatch_aux (lua_State *L) { | |
693 | GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); | 693 | GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); | |
694 | const char *src; | 694 | const char *src; | |
695 | gm->ms.L = L; | |||
695 | for (src = gm->src; src <= gm->ms.src_end; src++) { | 696 | for (src = gm->src; src <= gm->ms.src_end; src++) { | |
696 | const char *e; | 697 | const char *e; | |
697 | reprepstate(&gm->ms); | 698 | reprepstate(&gm->ms); | |
698 | if ((e = match(&gm->ms, src, gm->p)) != NULL) { | 699 | if ((e = match(&gm->ms, src, gm->p)) != NULL) { | |
699 | if (e == src) /* empty match? */ | 700 | if (e == src) /* empty match? */ | |
700 | gm->src =src + 1; /* go at least one position */ | 701 | gm->src =src + 1; /* go at least one position */ | |
701 | else | 702 | else | |
702 | gm->src = e; | 703 | gm->src = e; | |
703 | return push_captures(&gm->ms, src, e); | 704 | return push_captures(&gm->ms, src, e); | |
704 | } | 705 | } | |
705 | } | 706 | } | |
706 | return 0; /* not found */ | 707 | return 0; /* not found */ | |
707 | } | 708 | } |