diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-08-30 10:19:58 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-08-30 10:19:58 -0300 |
commit | 6087e67771d67a04efc1a067661ccd3a0d4ce40a (patch) | |
tree | 1747e4a5057b06454e727a02c79c438efcff7064 | |
parent | 93bf6185048256a5df05986460f233ee65136731 (diff) | |
download | lua-6087e67771d67a04efc1a067661ccd3a0d4ce40a.tar.gz lua-6087e67771d67a04efc1a067661ccd3a0d4ce40a.tar.bz2 lua-6087e67771d67a04efc1a067661ccd3a0d4ce40a.zip |
no more compatibility option for long strings
-rw-r--r-- | llex.c | 21 | ||||
-rw-r--r-- | luaconf.h | 10 |
2 files changed, 2 insertions, 29 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.20 2006/03/09 18:14:31 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.21 2006/07/11 15:53:29 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 | */ |
@@ -222,8 +222,6 @@ static int skip_sep (LexState *ls) { | |||
222 | 222 | ||
223 | 223 | ||
224 | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { | 224 | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { |
225 | int cont = 0; | ||
226 | (void)(cont); /* avoid warnings when `cont' is not used */ | ||
227 | save_and_next(ls); /* skip 2nd `[' */ | 225 | save_and_next(ls); /* skip 2nd `[' */ |
228 | if (currIsNewline(ls)) /* string starts with a newline? */ | 226 | if (currIsNewline(ls)) /* string starts with a newline? */ |
229 | inclinenumber(ls); /* skip it */ | 227 | inclinenumber(ls); /* skip it */ |
@@ -233,26 +231,9 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { | |||
233 | luaX_lexerror(ls, (seminfo) ? "unfinished long string" : | 231 | luaX_lexerror(ls, (seminfo) ? "unfinished long string" : |
234 | "unfinished long comment", TK_EOS); | 232 | "unfinished long comment", TK_EOS); |
235 | break; /* to avoid warnings */ | 233 | break; /* to avoid warnings */ |
236 | #if defined(LUA_COMPAT_LSTR) | ||
237 | case '[': { | ||
238 | if (skip_sep(ls) == sep) { | ||
239 | save_and_next(ls); /* skip 2nd `[' */ | ||
240 | cont++; | ||
241 | #if LUA_COMPAT_LSTR == 1 | ||
242 | if (sep == 0) | ||
243 | luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); | ||
244 | #endif | ||
245 | } | ||
246 | break; | ||
247 | } | ||
248 | #endif | ||
249 | case ']': { | 234 | case ']': { |
250 | if (skip_sep(ls) == sep) { | 235 | if (skip_sep(ls) == sep) { |
251 | save_and_next(ls); /* skip 2nd `]' */ | 236 | save_and_next(ls); /* skip 2nd `]' */ |
252 | #if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 | ||
253 | cont--; | ||
254 | if (sep == 0 && cont >= 0) break; | ||
255 | #endif | ||
256 | goto endloop; | 237 | goto endloop; |
257 | } | 238 | } |
258 | break; | 239 | break; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.83 2006/08/04 13:34:37 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.84 2006/08/07 19:14:30 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -343,14 +343,6 @@ | |||
343 | #define LUA_COMPAT_MOD | 343 | #define LUA_COMPAT_MOD |
344 | 344 | ||
345 | /* | 345 | /* |
346 | @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting | ||
347 | @* facility. | ||
348 | ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn | ||
349 | ** off the advisory error when nesting [[...]]. | ||
350 | */ | ||
351 | #define LUA_COMPAT_LSTR 1 | ||
352 | |||
353 | /* | ||
354 | @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. | 346 | @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. |
355 | ** CHANGE it to undefined as soon as you rename 'string.gfind' to | 347 | ** CHANGE it to undefined as soon as you rename 'string.gfind' to |
356 | ** 'string.gmatch'. | 348 | ** 'string.gmatch'. |