Implement prefix-based interactive commands via ! (issue #14)
Add !command syntax that runs commands with inherited terminal (no
capture). The lexer treats ! as a statement-starting token, reading
to end-of-line with the same interpolation/escape/pipe support as
backtick commands. The C function sets _ = {code=N, stdout="", stderr=""}.
This commit is contained in:
6
llex.h
6
llex.h
@@ -42,7 +42,9 @@ enum RESERVED {
|
||||
TK_FLT, TK_INT, TK_NAME, TK_STRING,
|
||||
TK_COMMAND,
|
||||
TK_COMMAND_INTERP,
|
||||
TK_ENVVAR
|
||||
TK_ENVVAR,
|
||||
TK_INTERACTIVE,
|
||||
TK_INTERACTIVE_INTERP
|
||||
};
|
||||
|
||||
/* number of reserved words */
|
||||
@@ -80,7 +82,7 @@ typedef struct LexState {
|
||||
TString *envn; /* environment variable name */
|
||||
TString *brkn; /* "break" name (used as a label) */
|
||||
TString *glbn; /* "global" name (when not a reserved word) */
|
||||
lu_byte in_command; /* nonzero when continuing a backtick string after ${} */
|
||||
lu_byte cmd_mode; /* 0=normal, 1=backtick command, 2=interactive command */
|
||||
} LexState;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user