aboutsummaryrefslogtreecommitdiff
path: root/lstrlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-17 13:28:21 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-17 13:28:21 -0300
commitf97c64d7bf4c0f373711795d8faba0e8cd206761 (patch)
tree99c9e25132b2ef193dc417873e8f44e5c0ea8738 /lstrlib.c
parentea3155e380080095a6f8c63297f0505789cf08b7 (diff)
downloadlua-f97c64d7bf4c0f373711795d8faba0e8cd206761.tar.gz
lua-f97c64d7bf4c0f373711795d8faba0e8cd206761.tar.bz2
lua-f97c64d7bf4c0f373711795d8faba0e8cd206761.zip
macros 'LUA_QL'/'LUA_QL' deprecated
Diffstat (limited to 'lstrlib.c')
-rw-r--r--lstrlib.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/lstrlib.c b/lstrlib.c
index dfb1f8c1..f1239df5 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.202 2014/10/01 11:54:56 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.203 2014/10/17 10:55:28 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*/
@@ -250,14 +250,14 @@ static const char *classend (MatchState *ms, const char *p) {
250 switch (*p++) { 250 switch (*p++) {
251 case L_ESC: { 251 case L_ESC: {
252 if (p == ms->p_end) 252 if (p == ms->p_end)
253 luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); 253 luaL_error(ms->L, "malformed pattern (ends with '%%')");
254 return p+1; 254 return p+1;
255 } 255 }
256 case '[': { 256 case '[': {
257 if (*p == '^') p++; 257 if (*p == '^') p++;
258 do { /* look for a `]' */ 258 do { /* look for a `]' */
259 if (p == ms->p_end) 259 if (p == ms->p_end)
260 luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); 260 luaL_error(ms->L, "malformed pattern (missing ']')");
261 if (*(p++) == L_ESC && p < ms->p_end) 261 if (*(p++) == L_ESC && p < ms->p_end)
262 p++; /* skip escapes (e.g. `%]') */ 262 p++; /* skip escapes (e.g. `%]') */
263 } while (*p != ']'); 263 } while (*p != ']');
@@ -332,8 +332,7 @@ static int singlematch (MatchState *ms, const char *s, const char *p,
332static const char *matchbalance (MatchState *ms, const char *s, 332static const char *matchbalance (MatchState *ms, const char *s,
333 const char *p) { 333 const char *p) {
334 if (p >= ms->p_end - 1) 334 if (p >= ms->p_end - 1)
335 luaL_error(ms->L, "malformed pattern " 335 luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')");
336 "(missing arguments to " LUA_QL("%%b") ")");
337 if (*s != *p) return NULL; 336 if (*s != *p) return NULL;
338 else { 337 else {
339 int b = *p; 338 int b = *p;
@@ -450,8 +449,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
450 const char *ep; char previous; 449 const char *ep; char previous;
451 p += 2; 450 p += 2;
452 if (*p != '[') 451 if (*p != '[')
453 luaL_error(ms->L, "missing " LUA_QL("[") " after " 452 luaL_error(ms->L, "missing '[' after '%%f' in pattern");
454 LUA_QL("%%f") " in pattern");
455 ep = classend(ms, p); /* points to what is next */ 453 ep = classend(ms, p); /* points to what is next */
456 previous = (s == ms->src_init) ? '\0' : *(s - 1); 454 previous = (s == ms->src_init) ? '\0' : *(s - 1);
457 if (!matchbracketclass(uchar(previous), p, ep - 1) && 455 if (!matchbracketclass(uchar(previous), p, ep - 1) &&
@@ -694,8 +692,7 @@ static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
694 i++; /* skip ESC */ 692 i++; /* skip ESC */
695 if (!isdigit(uchar(news[i]))) { 693 if (!isdigit(uchar(news[i]))) {
696 if (news[i] != L_ESC) 694 if (news[i] != L_ESC)
697 luaL_error(L, "invalid use of " LUA_QL("%c") 695 luaL_error(L, "invalid use of '%c' in replacement string", L_ESC);
698 " in replacement string", L_ESC);
699 luaL_addchar(b, news[i]); 696 luaL_addchar(b, news[i]);
700 } 697 }
701 else if (news[i] == '0') 698 else if (news[i] == '0')
@@ -929,8 +926,8 @@ static int str_format (lua_State *L) {
929 } 926 }
930 } 927 }
931 default: { /* also treat cases `pnLlh' */ 928 default: { /* also treat cases `pnLlh' */
932 return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " 929 return luaL_error(L, "invalid option '%%%c' to 'format'",
933 LUA_QL("format"), *(strfrmt - 1)); 930 *(strfrmt - 1));
934 } 931 }
935 } 932 }
936 luaL_addsize(&b, nb); 933 luaL_addsize(&b, nb);