diff options
| author | 2024-09-25 13:53:03 -0400 | |
|---|---|---|
| committer | 2024-09-25 13:53:03 -0400 | |
| commit | ccf40472f78a22ccc19e85b5c4d746f06d02926a (patch) | |
| tree | 6ad739846659740e4c6bd0a1d41470b76548dcc5 /src | |
| parent | Update README.md (diff) | |
added || chaining operator
Diffstat (limited to 'src')
| -rw-r--r-- | src/lush.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -934,8 +934,6 @@ char **lush_split_commands(char *line) { while (isspace((unsigned char)*start)) start++; - // Check if entering or leaving a quoted string - // Check for operators int op_len = operator_length(start); if (op_len > 0) { @@ -1111,6 +1109,15 @@ int lush_execute_chain(lua_State *L, char ***commands, int num_commands) { commands++; } + if (last_result == 0 && i > 0) { + commands--; + if (is_operator(commands[0][0]) == OP_OR) { + commands += 3; + continue; + } + commands++; + } + // Handle other operations if (commands[1] != NULL) { int op_type = is_operator(commands[1][0]); |
