diff options
Diffstat (limited to 'llex.c')
| -rw-r--r-- | llex.c | 11 |
1 files changed, 2 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.c,v 2.41 2010/11/18 18:38:44 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.42 2010/12/06 21:08:36 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -286,13 +286,6 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { | |||
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | 288 | ||
| 289 | static int hexavalue (int c) { | ||
| 290 | if (lisdigit(c)) return c - '0'; | ||
| 291 | else if (lisupper(c)) return c - 'A' + 10; | ||
| 292 | else return c - 'a' + 10; | ||
| 293 | } | ||
| 294 | |||
| 295 | |||
| 296 | static int readhexaesc (LexState *ls) { | 289 | static int readhexaesc (LexState *ls) { |
| 297 | int c1, c2 = EOZ; | 290 | int c1, c2 = EOZ; |
| 298 | if (!lisxdigit(c1 = next(ls)) || !lisxdigit(c2 = next(ls))) { | 291 | if (!lisxdigit(c1 = next(ls)) || !lisxdigit(c2 = next(ls))) { |
| @@ -302,7 +295,7 @@ static int readhexaesc (LexState *ls) { | |||
| 302 | if (c2 != EOZ) save(ls, c2); | 295 | if (c2 != EOZ) save(ls, c2); |
| 303 | lexerror(ls, "hexadecimal digit expected", TK_STRING); | 296 | lexerror(ls, "hexadecimal digit expected", TK_STRING); |
| 304 | } | 297 | } |
| 305 | return (hexavalue(c1) << 4) + hexavalue(c2); | 298 | return (luaO_hexavalue(c1) << 4) + luaO_hexavalue(c2); |
| 306 | } | 299 | } |
| 307 | 300 | ||
| 308 | 301 | ||
