diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-30 16:48:08 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-30 16:48:08 -0300 |
| commit | b9dcf9974d4dbff3ca28ff618259e277cb0090ea (patch) | |
| tree | 66b903add6a56545bb50fda02d33baab24ba44d5 /liolib.c | |
| parent | a77d263e86feea55529800028f960d7124c1385f (diff) | |
| download | lua-b9dcf9974d4dbff3ca28ff618259e277cb0090ea.tar.gz lua-b9dcf9974d4dbff3ca28ff618259e277cb0090ea.tar.bz2 lua-b9dcf9974d4dbff3ca28ff618259e277cb0090ea.zip | |
detail (typos in comments)
Diffstat (limited to 'liolib.c')
| -rw-r--r-- | liolib.c | 18 |
1 files changed, 9 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 2.125 2014/05/21 15:24:21 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.126 2014/06/02 03:00:51 roberto Exp roberto $ |
| 3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -402,11 +402,11 @@ static int test2 (RN *rn, const char *set) { | |||
| 402 | 402 | ||
| 403 | 403 | ||
| 404 | /* | 404 | /* |
| 405 | ** Read a sequence of (hexa)digits | 405 | ** Read a sequence of (hex)digits |
| 406 | */ | 406 | */ |
| 407 | static int readdigits (RN *rn, int hexa) { | 407 | static int readdigits (RN *rn, int hex) { |
| 408 | int count = 0; | 408 | int count = 0; |
| 409 | while ((hexa ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) | 409 | while ((hex ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) |
| 410 | count++; | 410 | count++; |
| 411 | return count; | 411 | return count; |
| 412 | } | 412 | } |
| @@ -426,7 +426,7 @@ static int readdigits (RN *rn, int hexa) { | |||
| 426 | static int read_number (lua_State *L, FILE *f) { | 426 | static int read_number (lua_State *L, FILE *f) { |
| 427 | RN rn; | 427 | RN rn; |
| 428 | int count = 0; | 428 | int count = 0; |
| 429 | int hexa = 0; | 429 | int hex = 0; |
| 430 | char decp[2] = "."; | 430 | char decp[2] = "."; |
| 431 | rn.f = f; rn.n = 0; | 431 | rn.f = f; rn.n = 0; |
| 432 | decp[0] = getlocaledecpoint(); /* get decimal point from locale */ | 432 | decp[0] = getlocaledecpoint(); /* get decimal point from locale */ |
| @@ -434,13 +434,13 @@ static int read_number (lua_State *L, FILE *f) { | |||
| 434 | do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ | 434 | do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ |
| 435 | test2(&rn, "-+"); /* optional signal */ | 435 | test2(&rn, "-+"); /* optional signal */ |
| 436 | if (test2(&rn, "0")) { | 436 | if (test2(&rn, "0")) { |
| 437 | if (test2(&rn, "xX")) hexa = 1; /* numeral is hexadecimal */ | 437 | if (test2(&rn, "xX")) hex = 1; /* numeral is hexadecimal */ |
| 438 | else count = 1; /* count initial '0' as a valid digit */ | 438 | else count = 1; /* count initial '0' as a valid digit */ |
| 439 | } | 439 | } |
| 440 | count += readdigits(&rn, hexa); /* integral part */ | 440 | count += readdigits(&rn, hex); /* integral part */ |
| 441 | if (test2(&rn, decp)) /* decimal point? */ | 441 | if (test2(&rn, decp)) /* decimal point? */ |
| 442 | count += readdigits(&rn, hexa); /* fractionary part */ | 442 | count += readdigits(&rn, hex); /* fractional part */ |
| 443 | if (count > 0 && test2(&rn, (hexa ? "pP" : "eE"))) { /* exponent mark? */ | 443 | if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) { /* exponent mark? */ |
| 444 | test2(&rn, "-+"); /* exponent signal */ | 444 | test2(&rn, "-+"); /* exponent signal */ |
| 445 | readdigits(&rn, 0); /* exponent digits */ | 445 | readdigits(&rn, 0); /* exponent digits */ |
| 446 | } | 446 | } |
