aboutsummaryrefslogtreecommitdiff
path: root/lstrlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lstrlib.c')
-rw-r--r--lstrlib.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lstrlib.c b/lstrlib.c
index fd898ce3..5080caba 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.113 2005/05/16 19:21:11 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.114 2005/05/16 21:19:00 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -200,14 +200,14 @@ static const char *classend (MatchState *ms, const char *p) {
200 switch (*p++) { 200 switch (*p++) {
201 case L_ESC: { 201 case L_ESC: {
202 if (*p == '\0') 202 if (*p == '\0')
203 luaL_error(ms->L, "malformed pattern (ends with '%%')"); 203 luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
204 return p+1; 204 return p+1;
205 } 205 }
206 case '[': { 206 case '[': {
207 if (*p == '^') p++; 207 if (*p == '^') p++;
208 do { /* look for a `]' */ 208 do { /* look for a `]' */
209 if (*p == '\0') 209 if (*p == '\0')
210 luaL_error(ms->L, "malformed pattern (missing ']')"); 210 luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
211 if (*(p++) == L_ESC && *p != '\0') 211 if (*(p++) == L_ESC && *p != '\0')
212 p++; /* skip escapes (e.g. `%]') */ 212 p++; /* skip escapes (e.g. `%]') */
213 } while (*p != ']'); 213 } while (*p != ']');
@@ -382,7 +382,8 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
382 const char *ep; char previous; 382 const char *ep; char previous;
383 p += 2; 383 p += 2;
384 if (*p != '[') 384 if (*p != '[')
385 luaL_error(ms->L, "missing '[' after '%%f' in pattern"); 385 luaL_error(ms->L, "missing " LUA_QL("[") " after "
386 LUA_QL("%%f") " in pattern");
386 ep = classend(ms, p); /* points to what is next */ 387 ep = classend(ms, p); /* points to what is next */
387 previous = (s == ms->src_init) ? '\0' : *(s-1); 388 previous = (s == ms->src_init) ? '\0' : *(s-1);
388 if (matchbracketclass(uchar(previous), p, ep-1) || 389 if (matchbracketclass(uchar(previous), p, ep-1) ||
@@ -741,7 +742,7 @@ static int str_format (lua_State *L) {
741 } 742 }
742 } 743 }
743 default: { /* also treat cases `pnLlh' */ 744 default: { /* also treat cases `pnLlh' */
744 return luaL_error(L, "invalid option to " LUA_SM, "format"); 745 return luaL_error(L, "invalid option to " LUA_QL("format"));
745 } 746 }
746 } 747 }
747 luaL_addlstring(&b, buff, strlen(buff)); 748 luaL_addlstring(&b, buff, strlen(buff));