lua

A copy of the Lua development repository
Log | Files | Refs | README

commit ec422ec7d0f0af2bac368fe99b92d5ad7b381184
parent a8a15ff1bdcb7526625b717c64c1d286f0625dd2
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Wed,  5 Mar 1997 10:32:21 -0300

skips can be nested (why not?).

Diffstat:
Miolib.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/iolib.c b/iolib.c @@ -115,8 +115,14 @@ static void io_read (void) int c = NEED_OTHER; luaI_addchar(0); while (*p) { - if (*p == '{' || *p == '}') { - inskip = (*p == '{'); + if (*p == '{') { + inskip++; + p++; + } + else if (*p == '}') { + if (inskip == 0) + lua_error("unbalanced `{...}' in read pattern"); + inskip--; p++; } else { @@ -125,7 +131,7 @@ static void io_read (void) if (c == NEED_OTHER) c = getc(lua_infile); m = (c == EOF) ? 0 : singlematch((char)c, p); if (m) { - if (!inskip) luaI_addchar(c); + if (inskip == 0) luaI_addchar(c); c = NEED_OTHER; } switch (*ep) {