mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 11:18:48 +00:00
Change so that assignments may be specified alone - a command isn't
required. GitHub issue 2062.
This commit is contained in:
parent
9169ee0e87
commit
2e39b621c9
34
cmd-parse.y
34
cmd-parse.y
@ -133,7 +133,12 @@ statements : statement '\n'
|
|||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
statement : condition
|
statement : /* empty */
|
||||||
|
{
|
||||||
|
$$ = xmalloc (sizeof *$$);
|
||||||
|
TAILQ_INIT($$);
|
||||||
|
}
|
||||||
|
| condition
|
||||||
{
|
{
|
||||||
struct cmd_parse_state *ps = &parse_state;
|
struct cmd_parse_state *ps = &parse_state;
|
||||||
|
|
||||||
@ -144,11 +149,6 @@ statement : condition
|
|||||||
cmd_parse_free_commands($1);
|
cmd_parse_free_commands($1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| assignment
|
|
||||||
{
|
|
||||||
$$ = xmalloc (sizeof *$$);
|
|
||||||
TAILQ_INIT($$);
|
|
||||||
}
|
|
||||||
| commands
|
| commands
|
||||||
{
|
{
|
||||||
struct cmd_parse_state *ps = &parse_state;
|
struct cmd_parse_state *ps = &parse_state;
|
||||||
@ -194,8 +194,10 @@ expanded : format
|
|||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
|
|
||||||
assignment : /* empty */
|
optional_assignment : /* empty */
|
||||||
| EQUALS
|
| assignment
|
||||||
|
|
||||||
|
assignment : EQUALS
|
||||||
{
|
{
|
||||||
struct cmd_parse_state *ps = &parse_state;
|
struct cmd_parse_state *ps = &parse_state;
|
||||||
int flags = ps->input->flags;
|
int flags = ps->input->flags;
|
||||||
@ -372,7 +374,15 @@ commands : command
|
|||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
command : assignment TOKEN
|
command : assignment
|
||||||
|
{
|
||||||
|
struct cmd_parse_state *ps = &parse_state;
|
||||||
|
|
||||||
|
$$ = xcalloc(1, sizeof *$$);
|
||||||
|
$$->name = NULL;
|
||||||
|
$$->line = ps->input->line;
|
||||||
|
}
|
||||||
|
| optional_assignment TOKEN
|
||||||
{
|
{
|
||||||
struct cmd_parse_state *ps = &parse_state;
|
struct cmd_parse_state *ps = &parse_state;
|
||||||
|
|
||||||
@ -381,7 +391,7 @@ command : assignment TOKEN
|
|||||||
$$->line = ps->input->line;
|
$$->line = ps->input->line;
|
||||||
|
|
||||||
}
|
}
|
||||||
| assignment TOKEN arguments
|
| optional_assignment TOKEN arguments
|
||||||
{
|
{
|
||||||
struct cmd_parse_state *ps = &parse_state;
|
struct cmd_parse_state *ps = &parse_state;
|
||||||
|
|
||||||
@ -631,6 +641,8 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds,
|
|||||||
* command list.
|
* command list.
|
||||||
*/
|
*/
|
||||||
TAILQ_FOREACH_SAFE(cmd, cmds, entry, next) {
|
TAILQ_FOREACH_SAFE(cmd, cmds, entry, next) {
|
||||||
|
if (cmd->name == NULL)
|
||||||
|
continue;
|
||||||
alias = cmd_get_alias(cmd->name);
|
alias = cmd_get_alias(cmd->name);
|
||||||
if (alias == NULL)
|
if (alias == NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -676,6 +688,8 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds,
|
|||||||
*/
|
*/
|
||||||
result = cmd_list_new();
|
result = cmd_list_new();
|
||||||
TAILQ_FOREACH(cmd, cmds, entry) {
|
TAILQ_FOREACH(cmd, cmds, entry) {
|
||||||
|
if (cmd->name == NULL)
|
||||||
|
continue;
|
||||||
log_debug("%s: %u %s", __func__, cmd->line, cmd->name);
|
log_debug("%s: %u %s", __func__, cmd->line, cmd->name);
|
||||||
cmd_log_argv(cmd->argc, cmd->argv, __func__);
|
cmd_log_argv(cmd->argc, cmd->argv, __func__);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user