several small details

This commit is contained in:
Roberto Ierusalimschy
2005-05-17 16:49:15 -03:00
parent c2bb9abcec
commit 67578ec51f
20 changed files with 152 additions and 137 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstrlib.c,v 1.113 2005/05/16 19:21:11 roberto Exp roberto $
** $Id: lstrlib.c,v 1.114 2005/05/16 21:19:00 roberto Exp roberto $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@@ -200,14 +200,14 @@ static const char *classend (MatchState *ms, const char *p) {
switch (*p++) {
case L_ESC: {
if (*p == '\0')
luaL_error(ms->L, "malformed pattern (ends with '%%')");
luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
return p+1;
}
case '[': {
if (*p == '^') p++;
do { /* look for a `]' */
if (*p == '\0')
luaL_error(ms->L, "malformed pattern (missing ']')");
luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
if (*(p++) == L_ESC && *p != '\0')
p++; /* skip escapes (e.g. `%]') */
} while (*p != ']');
@@ -382,7 +382,8 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
const char *ep; char previous;
p += 2;
if (*p != '[')
luaL_error(ms->L, "missing '[' after '%%f' in pattern");
luaL_error(ms->L, "missing " LUA_QL("[") " after "
LUA_QL("%%f") " in pattern");
ep = classend(ms, p); /* points to what is next */
previous = (s == ms->src_init) ? '\0' : *(s-1);
if (matchbracketclass(uchar(previous), p, ep-1) ||
@@ -741,7 +742,7 @@ static int str_format (lua_State *L) {
}
}
default: { /* also treat cases `pnLlh' */
return luaL_error(L, "invalid option to " LUA_SM, "format");
return luaL_error(L, "invalid option to " LUA_QL("format"));
}
}
luaL_addlstring(&b, buff, strlen(buff));