diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-16 18:19:00 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-16 18:19:00 -0300 |
| commit | c2bb9abceceef125554595e23b7cc18ad3555c7c (patch) | |
| tree | 2c00262ddf0e4f8acc1db83bdee4a56bb2458117 /lparser.c | |
| parent | da32450c3d4c8abd3fd6709692859a12a8886511 (diff) | |
| download | lua-c2bb9abceceef125554595e23b7cc18ad3555c7c.tar.gz lua-c2bb9abceceef125554595e23b7cc18ad3555c7c.tar.bz2 lua-c2bb9abceceef125554595e23b7cc18ad3555c7c.zip | |
better quotes for strings in error messages
Diffstat (limited to 'lparser.c')
| -rw-r--r-- | lparser.c | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.24 2005/05/04 20:42:28 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.25 2005/05/05 20:47:02 roberto Exp roberto $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -82,7 +82,7 @@ static void anchor_token (LexState *ls) { | |||
| 82 | 82 | ||
| 83 | static void error_expected (LexState *ls, int token) { | 83 | static void error_expected (LexState *ls, int token) { |
| 84 | luaX_syntaxerror(ls, | 84 | luaX_syntaxerror(ls, |
| 85 | luaO_pushfstring(ls->L, "`%s' expected", luaX_token2str(ls, token))); | 85 | luaO_pushfstring(ls->L, LUA_SM " expected", luaX_token2str(ls, token))); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | 88 | ||
| @@ -125,7 +125,7 @@ static void check_match (LexState *ls, int what, int who, int where) { | |||
| 125 | error_expected(ls, what); | 125 | error_expected(ls, what); |
| 126 | else { | 126 | else { |
| 127 | luaX_syntaxerror(ls, luaO_pushfstring(ls->L, | 127 | luaX_syntaxerror(ls, luaO_pushfstring(ls->L, |
| 128 | "`%s' expected (to close `%s' at line %d)", | 128 | LUA_SM " expected (to close " LUA_SM " at line %d)", |
| 129 | luaX_token2str(ls, what), luaX_token2str(ls, who), where)); | 129 | luaX_token2str(ls, what), luaX_token2str(ls, who), where)); |
| 130 | } | 130 | } |
| 131 | } | 131 | } |
| @@ -577,7 +577,7 @@ static void parlist (LexState *ls) { | |||
| 577 | f->is_vararg = 1; | 577 | f->is_vararg = 1; |
| 578 | break; | 578 | break; |
| 579 | } | 579 | } |
| 580 | default: luaX_syntaxerror(ls, "<name> or `...' expected"); | 580 | default: luaX_syntaxerror(ls, "<name> or '...' expected"); |
| 581 | } | 581 | } |
| 582 | } while (!f->is_vararg && testnext(ls, ',')); | 582 | } while (!f->is_vararg && testnext(ls, ',')); |
| 583 | } | 583 | } |
| @@ -765,7 +765,7 @@ static void simpleexp (LexState *ls, expdesc *v) { | |||
| 765 | case TK_DOTS: { /* vararg */ | 765 | case TK_DOTS: { /* vararg */ |
| 766 | FuncState *fs = ls->fs; | 766 | FuncState *fs = ls->fs; |
| 767 | check_condition(ls, fs->f->is_vararg, | 767 | check_condition(ls, fs->f->is_vararg, |
| 768 | "cannot use `...' outside a vararg function"); | 768 | "cannot use '...' outside a vararg function"); |
| 769 | fs->f->is_vararg = NEWSTYLEVARARG; | 769 | fs->f->is_vararg = NEWSTYLEVARARG; |
| 770 | init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); | 770 | init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); |
| 771 | break; | 771 | break; |
| @@ -1017,7 +1017,7 @@ static void whilestat (LexState *ls, int line) { | |||
| 1017 | fs->jpc = NO_JUMP; | 1017 | fs->jpc = NO_JUMP; |
| 1018 | sizeexp = fs->pc - expinit; /* size of expression code */ | 1018 | sizeexp = fs->pc - expinit; /* size of expression code */ |
| 1019 | if (sizeexp > LUAI_MAXEXPWHILE) | 1019 | if (sizeexp > LUAI_MAXEXPWHILE) |
| 1020 | luaX_syntaxerror(ls, "`while' condition too complex"); | 1020 | luaX_syntaxerror(ls, "'while' condition too complex"); |
| 1021 | for (i = 0; i < sizeexp; i++) /* save `exp' code */ | 1021 | for (i = 0; i < sizeexp; i++) /* save `exp' code */ |
| 1022 | codeexp[i] = fs->f->code[expinit + i]; | 1022 | codeexp[i] = fs->f->code[expinit + i]; |
| 1023 | fs->pc = expinit; /* remove `exp' code */ | 1023 | fs->pc = expinit; /* remove `exp' code */ |
| @@ -1141,7 +1141,7 @@ static void forstat (LexState *ls, int line) { | |||
| 1141 | switch (ls->t.token) { | 1141 | switch (ls->t.token) { |
| 1142 | case '=': fornum(ls, varname, line); break; | 1142 | case '=': fornum(ls, varname, line); break; |
| 1143 | case ',': case TK_IN: forlist(ls, varname); break; | 1143 | case ',': case TK_IN: forlist(ls, varname); break; |
| 1144 | default: luaX_syntaxerror(ls, "`=' or `in' expected"); | 1144 | default: luaX_syntaxerror(ls, "'=' or 'in' expected"); |
| 1145 | } | 1145 | } |
| 1146 | check_match(ls, TK_END, TK_FOR, line); | 1146 | check_match(ls, TK_END, TK_FOR, line); |
| 1147 | leaveblock(fs); /* loop scope (`break' jumps to this point) */ | 1147 | leaveblock(fs); /* loop scope (`break' jumps to this point) */ |
