diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-13 11:50:43 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-13 11:50:43 -0300 |
commit | fded0b4a844990b1a6d0cda1aba25df33eb5f46f (patch) | |
tree | 4f12b7359ed4d8d9d46589d5708de12992ad206b | |
parent | 3b9dd52be02fd43c598f4adb6fa7844e6a573923 (diff) | |
download | lua-fded0b4a844990b1a6d0cda1aba25df33eb5f46f.tar.gz lua-fded0b4a844990b1a6d0cda1aba25df33eb5f46f.tar.bz2 lua-fded0b4a844990b1a6d0cda1aba25df33eb5f46f.zip |
Remove compat code in parser when not needed
-rw-r--r-- | llex.c | 2 | ||||
-rw-r--r-- | lparser.c | 5 |
2 files changed, 5 insertions, 2 deletions
@@ -41,7 +41,7 @@ | |||
41 | #define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') | 41 | #define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') |
42 | 42 | ||
43 | #if defined(LUA_COMPAT_GLOBAL) | 43 | #if defined(LUA_COMPAT_GLOBAL) |
44 | #define GLOBALLEX ".g" /* not recognizable by the scanner */ | 44 | #define GLOBALLEX ".g" /* anything not recognizable as a name */ |
45 | #else | 45 | #else |
46 | #define GLOBALLEX "global" | 46 | #define GLOBALLEX "global" |
47 | #endif | 47 | #endif |
@@ -1997,6 +1997,7 @@ static void statement (LexState *ls) { | |||
1997 | gotostat(ls, line); | 1997 | gotostat(ls, line); |
1998 | break; | 1998 | break; |
1999 | } | 1999 | } |
2000 | #if defined(LUA_COMPAT_GLOBAL) | ||
2000 | case TK_NAME: { | 2001 | case TK_NAME: { |
2001 | /* compatibility code to parse global keyword when "global" | 2002 | /* compatibility code to parse global keyword when "global" |
2002 | is not reserved */ | 2003 | is not reserved */ |
@@ -2008,7 +2009,9 @@ static void statement (LexState *ls) { | |||
2008 | break; | 2009 | break; |
2009 | } | 2010 | } |
2010 | } /* else... */ | 2011 | } /* else... */ |
2011 | } /* FALLTHROUGH */ | 2012 | } |
2013 | #endif | ||
2014 | /* FALLTHROUGH */ | ||
2012 | default: { /* stat -> func | assignment */ | 2015 | default: { /* stat -> func | assignment */ |
2013 | exprstat(ls); | 2016 | exprstat(ls); |
2014 | break; | 2017 | break; |