Add support for additional cmd_identifiers ##newshell (#17696)

This commit is contained in:
Riccardo Schirone 2020-09-23 14:01:24 +02:00 committed by GitHub
parent 78e30b3ac7
commit ac6bdc1e7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 4 deletions

View File

@ -264,3 +264,25 @@ Pointer type commands with substitution
(arg (cmd_substitution_arg
(arged_command (cmd_identifier)
(args (arg (arg_identifier))))))))))
========
editor -
========
-
---
(commands
(arged_command (cmd_identifier)))
=========
\ command
=========
\
---
(commands
(arged_command (cmd_identifier)))

View File

@ -46,14 +46,14 @@ static bool is_comment(const char *s) {
}
static bool is_special_start(const int32_t ch) {
return ch == '*' || ch == '(' || ch == '*' || ch == '@' || ch == '|' ||
ch == '.' || ch == '|' || ch == '%' || ch == '~' || ch == '&' ||
ch == '>';
return ch == '*' || ch == '(' || ch == '@' || ch == '|' || ch == '>' ||
ch == '.' || ch == '|' || ch == '%' || ch == '~' || ch == '&';
}
static bool is_start_of_command(const int32_t ch) {
return isalpha (ch) || ch == '$' || ch == '?' || ch == ':' || ch == '+' ||
ch == '=' || ch == '/' || ch == '_' || ch == '#' || is_special_start (ch);
ch == '=' || ch == '/' || ch == '_' || ch == '#' || ch == '\\' ||
ch == '-' || is_special_start (ch);
}
static bool is_mid_command(const char *res, int len, const int32_t ch) {