Browse Source

no more compatibility option for long strings

pull/9/head
Roberto Ierusalimschy 18 years ago
parent
commit
6087e67771
  1. 21
      llex.c
  2. 10
      luaconf.h

21
llex.c

@ -1,5 +1,5 @@
/*
** $Id: llex.c,v 2.20 2006/03/09 18:14:31 roberto Exp roberto $
** $Id: llex.c,v 2.21 2006/07/11 15:53:29 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@ -222,8 +222,6 @@ static int skip_sep (LexState *ls) {
static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
int cont = 0;
(void)(cont); /* avoid warnings when `cont' is not used */
save_and_next(ls); /* skip 2nd `[' */
if (currIsNewline(ls)) /* string starts with a newline? */
inclinenumber(ls); /* skip it */
@ -233,26 +231,9 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
luaX_lexerror(ls, (seminfo) ? "unfinished long string" :
"unfinished long comment", TK_EOS);
break; /* to avoid warnings */
#if defined(LUA_COMPAT_LSTR)
case '[': {
if (skip_sep(ls) == sep) {
save_and_next(ls); /* skip 2nd `[' */
cont++;
#if LUA_COMPAT_LSTR == 1
if (sep == 0)
luaX_lexerror(ls, "nesting of [[...]] is deprecated", '[');
#endif
}
break;
}
#endif
case ']': {
if (skip_sep(ls) == sep) {
save_and_next(ls); /* skip 2nd `]' */
#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2
cont--;
if (sep == 0 && cont >= 0) break;
#endif
goto endloop;
}
break;

10
luaconf.h

@ -1,5 +1,5 @@
/*
** $Id: luaconf.h,v 1.83 2006/08/04 13:34:37 roberto Exp roberto $
** $Id: luaconf.h,v 1.84 2006/08/07 19:14:30 roberto Exp roberto $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@ -342,14 +342,6 @@
*/
#define LUA_COMPAT_MOD
/*
@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
@* facility.
** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
** off the advisory error when nesting [[...]].
*/
#define LUA_COMPAT_LSTR 1
/*
@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
** CHANGE it to undefined as soon as you rename 'string.gfind' to

Loading…
Cancel
Save