mirror of
https://github.com/rizinorg/rizin
synced 2026-08-22 20:26:16 -04:00
Remove special handling of & from grammar.js
This commit is contained in:
parent
4ae6e9e4a3
commit
a81e9d53f4
4 changed files with 15868 additions and 16457 deletions
|
|
@ -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(
|
||||
|
|
|
|||
90
shlr/rizin-shell-parser/src/grammar.json
generated
90
shlr/rizin-shell-parser/src/grammar.json
generated
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
32219
shlr/rizin-shell-parser/src/parser.c
generated
32219
shlr/rizin-shell-parser/src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue