Fix nested commands in interactive mode triggering prompt2 (issue #19)
Save and restore cmd_mode across interpolation parsing so that
luaX_readcommandcont resumes in the correct mode after a nested
backtick command inside ${...}.
This commit is contained in:
2
llex.c
2
llex.c
@@ -512,6 +512,7 @@ static int read_command_body (LexState *ls, SemInfo *seminfo) {
|
||||
/* store fragment so far */
|
||||
seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
|
||||
luaZ_bufflen(ls->buff));
|
||||
ls->saved_cmd_mode = ls->cmd_mode; /* save for readcommandcont */
|
||||
return interactive ? TK_INTERACTIVE_INTERP : TK_COMMAND_INTERP;
|
||||
}
|
||||
else {
|
||||
@@ -571,6 +572,7 @@ static int read_command (LexState *ls, SemInfo *seminfo) {
|
||||
** consumed the '}' that closes an interpolated ${expr}.
|
||||
*/
|
||||
int luaX_readcommandcont (LexState *ls) {
|
||||
ls->cmd_mode = ls->saved_cmd_mode; /* restore mode from before interpolation */
|
||||
int tk = read_command_body(ls, &ls->t.seminfo);
|
||||
ls->t.token = tk;
|
||||
return tk;
|
||||
|
||||
Reference in New Issue
Block a user