diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-07-29 10:33:15 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-07-29 10:33:15 -0300 |
commit | 11d97c34d5e3d5e45e3e6ffd12effe95d6f483cc (patch) | |
tree | 71ad9881572f476fb8650fbae2201c26e442943d /lex.c | |
parent | 66be42549e5eb5f25de6b8cbfee8a064b914cbb0 (diff) | |
download | lua-11d97c34d5e3d5e45e3e6ffd12effe95d6f483cc.tar.gz lua-11d97c34d5e3d5e45e3e6ffd12effe95d6f483cc.tar.bz2 lua-11d97c34d5e3d5e45e3e6ffd12effe95d6f483cc.zip |
skipping of '#' in first line is done by lex.c.
Diffstat (limited to 'lex.c')
-rw-r--r-- | lex.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | char *rcs_lex = "$Id: lex.c,v 3.5 1997/06/16 16:50:22 roberto Exp roberto $"; | 1 | char *rcs_lex = "$Id: lex.c,v 3.6 1997/07/01 19:32:41 roberto Exp roberto $"; |
2 | 2 | ||
3 | 3 | ||
4 | #include <ctype.h> | 4 | #include <ctype.h> |
@@ -37,6 +37,16 @@ static struct { | |||
37 | static int iflevel; /* level of nested $if's */ | 37 | static int iflevel; /* level of nested $if's */ |
38 | 38 | ||
39 | 39 | ||
40 | |||
41 | static void firstline (void) | ||
42 | { | ||
43 | int c = zgetc(lex_z); | ||
44 | if (c == '#') | ||
45 | while((c=zgetc(lex_z)) != '\n' && c != EOZ) /* skip first line */; | ||
46 | zungetc(lex_z); | ||
47 | } | ||
48 | |||
49 | |||
40 | void lua_setinput (ZIO *z) | 50 | void lua_setinput (ZIO *z) |
41 | { | 51 | { |
42 | current = '\n'; | 52 | current = '\n'; |
@@ -45,6 +55,7 @@ void lua_setinput (ZIO *z) | |||
45 | ifstate[0].skip = 0; | 55 | ifstate[0].skip = 0; |
46 | ifstate[0].elsepart = 1; /* to avoid a free $else */ | 56 | ifstate[0].elsepart = 1; /* to avoid a free $else */ |
47 | lex_z = z; | 57 | lex_z = z; |
58 | firstline(); | ||
48 | } | 59 | } |
49 | 60 | ||
50 | 61 | ||