Remove special handling of & from grammar.js

This commit is contained in:
Riccardo Schirone 2020-11-19 09:14:59 +01:00 committed by Riccardo Schirone
parent 4ae6e9e4a3
commit a81e9d53f4
4 changed files with 15868 additions and 16457 deletions

View file

@ -264,17 +264,6 @@ module.exports = grammar({
tmp_hex_command: $ => prec.right(1, seq($._simple_command, '@x:', $.arg)),
// basic commands
// FIXME: this is not required anymore, just consider it as regular cmd_identifier
_task_command: $ => prec.left(1, choice(
seq(
field('command', alias(choice('&', '&t'), $.cmd_identifier)),
field('args', optional($.args)),
),
seq(
field('command', alias(/&[A-Za-z=\-+*&0-9]*/, $.cmd_identifier)),
field('args', optional($.args)),
),
)),
number_command: $ => choice(
$._dec_number,
'0',
@ -297,7 +286,6 @@ module.exports = grammar({
$._env_command,
$._pf_arged_command,
$._last_command,
$._task_command,
),
_simple_arged_command: $ => prec.left(1, seq(

View file

@ -1467,92 +1467,6 @@
]
}
},
"_task_command": {
"type": "PREC_LEFT",
"value": 1,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "command",
"content": {
"type": "ALIAS",
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "&"
},
{
"type": "STRING",
"value": "&t"
}
]
},
"named": true,
"value": "cmd_identifier"
}
},
{
"type": "FIELD",
"name": "args",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "args"
},
{
"type": "BLANK"
}
]
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "command",
"content": {
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "&[A-Za-z=\\-+*&0-9]*"
},
"named": true,
"value": "cmd_identifier"
}
},
{
"type": "FIELD",
"name": "args",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "args"
},
{
"type": "BLANK"
}
]
}
}
]
}
]
}
},
"number_command": {
"type": "CHOICE",
"members": [
@ -1664,10 +1578,6 @@
{
"type": "SYMBOL",
"name": "_last_command"
},
{
"type": "SYMBOL",
"name": "_task_command"
}
]
},

File diff suppressed because it is too large Load diff

View file

@ -55,14 +55,14 @@ static bool is_interpret_cmd(const char *s) {
static bool is_special_start(const int32_t ch) {
return ch == '*' || ch == '(' || ch == '@' || ch == '|' || ch == '>' ||
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 == '#' || ch == '\\' ||
ch == '-' || ch == '<' || is_special_start (ch);
ch == '-' || ch == '<' || ch == '&' || is_special_start (ch);
}
static bool is_mid_command(const char *res, int len, const int32_t ch) {