diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-05 15:19:11 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-05 15:19:11 -0300 |
| commit | 6b45ccf4ed24dcfe437cf0159d6185119a2e8f95 (patch) | |
| tree | 83f0122940fcd8c3f5594172d7ae4a37a737d408 | |
| parent | 93fd6892f85ecd8a4e82d2339016a9f71a42d0e8 (diff) | |
| download | lua-6b45ccf4ed24dcfe437cf0159d6185119a2e8f95.tar.gz lua-6b45ccf4ed24dcfe437cf0159d6185119a2e8f95.tar.bz2 lua-6b45ccf4ed24dcfe437cf0159d6185119a2e8f95.zip | |
Removed compatibility with "= exp" in the REPL
| -rw-r--r-- | lua.c | 5 | ||||
| -rw-r--r-- | testes/main.lua | 2 |
2 files changed, 2 insertions, 5 deletions
| @@ -565,10 +565,7 @@ static int pushline (lua_State *L, int firstline) { | |||
| 565 | l = strlen(b); | 565 | l = strlen(b); |
| 566 | if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ | 566 | if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ |
| 567 | b[--l] = '\0'; /* remove it */ | 567 | b[--l] = '\0'; /* remove it */ |
| 568 | if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ | 568 | lua_pushlstring(L, b, l); |
| 569 | lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ | ||
| 570 | else | ||
| 571 | lua_pushlstring(L, b, l); | ||
| 572 | lua_freeline(b); | 569 | lua_freeline(b); |
| 573 | return 1; | 570 | return 1; |
| 574 | } | 571 | } |
diff --git a/testes/main.lua b/testes/main.lua index 17fbcb61..7b0f4ee0 100644 --- a/testes/main.lua +++ b/testes/main.lua | |||
| @@ -345,7 +345,7 @@ a]] | |||
| 345 | RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) | 345 | RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) |
| 346 | checkprogout("6\n10\n10\n\n") | 346 | checkprogout("6\n10\n10\n\n") |
| 347 | 347 | ||
| 348 | prepfile("a = [[b\nc\nd\ne]]\n=a") | 348 | prepfile("a = [[b\nc\nd\ne]]\na") |
| 349 | RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) | 349 | RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) |
| 350 | checkprogout("b\nc\nd\ne\n\n") | 350 | checkprogout("b\nc\nd\ne\n\n") |
| 351 | 351 | ||
