diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-06 18:24:29 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-06 18:24:29 -0200 |
commit | 3e94febfc10ae07adb4de0556de4d4c5d7f22d27 (patch) | |
tree | f9312f4f2b9727e1fe092e5feb0abfc99bb98d7f | |
parent | 243b3a1a47b30549198f874a497547b5656912c1 (diff) | |
download | lua-3e94febfc10ae07adb4de0556de4d4c5d7f22d27.tar.gz lua-3e94febfc10ae07adb4de0556de4d4c5d7f22d27.tar.bz2 lua-3e94febfc10ae07adb4de0556de4d4c5d7f22d27.zip |
pragmas should not be recognized inside literal strings.
-rw-r--r-- | lex.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,4 +1,4 @@ | |||
1 | char *rcs_lex = "$Id: lex.c,v 2.35 1996/09/09 14:11:11 roberto Exp roberto $"; | 1 | char *rcs_lex = "$Id: lex.c,v 2.36 1996/09/25 21:52:00 roberto Exp roberto $"; |
2 | 2 | ||
3 | 3 | ||
4 | #include <ctype.h> | 4 | #include <ctype.h> |
@@ -72,9 +72,9 @@ void luaI_addReserved (void) | |||
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | static int inclinenumber (void) | 75 | static int inclinenumber (int pragma_allowed) |
76 | { | 76 | { |
77 | if (current == '$') { /* is a pragma? */ | 77 | if (pragma_allowed && current == '$') { /* is a pragma? */ |
78 | char buff[MINBUFF]; | 78 | char buff[MINBUFF]; |
79 | int i = 0; | 79 | int i = 0; |
80 | next(); /* skip $ */ | 80 | next(); /* skip $ */ |
@@ -125,7 +125,7 @@ static int read_long_string (char *yytext, int buffsize) | |||
125 | continue; | 125 | continue; |
126 | case '\n': | 126 | case '\n': |
127 | save_and_next(); | 127 | save_and_next(); |
128 | inclinenumber(); | 128 | inclinenumber(0); |
129 | continue; | 129 | continue; |
130 | default: | 130 | default: |
131 | save_and_next(); | 131 | save_and_next(); |
@@ -156,7 +156,7 @@ int luaY_lex (void) | |||
156 | { | 156 | { |
157 | case '\n': | 157 | case '\n': |
158 | next(); | 158 | next(); |
159 | linelasttoken = inclinenumber(); | 159 | linelasttoken = inclinenumber(1); |
160 | continue; | 160 | continue; |
161 | 161 | ||
162 | case ' ': case '\t': case '\r': /* CR: to avoid problems with DOS */ | 162 | case ' ': case '\t': case '\r': /* CR: to avoid problems with DOS */ |
@@ -220,7 +220,7 @@ int luaY_lex (void) | |||
220 | case 'n': save('\n'); next(); break; | 220 | case 'n': save('\n'); next(); break; |
221 | case 't': save('\t'); next(); break; | 221 | case 't': save('\t'); next(); break; |
222 | case 'r': save('\r'); next(); break; | 222 | case 'r': save('\r'); next(); break; |
223 | case '\n': save_and_next(); inclinenumber(); break; | 223 | case '\n': save_and_next(); inclinenumber(0); break; |
224 | default : save_and_next(); break; | 224 | default : save_and_next(); break; |
225 | } | 225 | } |
226 | break; | 226 | break; |