struct display_command
{
struct matrix_state *state;
- bool dictionary;
- bool status;
}
display;
static struct matrix_cmd *
matrix_parse_display (struct matrix_state *s)
{
- bool dictionary = false;
- bool status = false;
- while (lex_token (s->lexer) == T_ID)
+ while (lex_token (s->lexer) != T_ENDCMD)
{
- if (lex_match_id (s->lexer, "DICTIONARY"))
- dictionary = true;
- else if (lex_match_id (s->lexer, "STATUS"))
- status = true;
- else
+ if (!lex_match_id (s->lexer, "DICTIONARY")
+ && !lex_match_id (s->lexer, "STATUS"))
{
lex_error_expecting (s->lexer, "DICTIONARY", "STATUS");
return NULL;
}
}
- if (!dictionary && !status)
- dictionary = status = true;
struct matrix_cmd *cmd = xmalloc (sizeof *cmd);
- *cmd = (struct matrix_cmd) {
- .type = MCMD_DISPLAY,
- .display = {
- .state = s,
- .dictionary = dictionary,
- .status = status,
- }
- };
+ *cmd = (struct matrix_cmd) { .type = MCMD_DISPLAY, .display = { s } };
return cmd;
}