runtime: lex: fix incorrect state-transition when scanning func keyword
This commit is contained in:
@@ -188,10 +188,11 @@ enum bshell_status command_pump_token(struct bshell_lex_ctx *ctx)
|
||||
|
||||
const struct bshell_lex_state_link links[] = {
|
||||
LINK_PUSH(BSHELL_SYM_DQUOTE, BSHELL_LEX_STATE_STRING, 0),
|
||||
LINK_PUSH(
|
||||
LINK_PUSH_WITH_TERM(
|
||||
BSHELL_SYM_LEFT_PAREN,
|
||||
BSHELL_LEX_STATE_STATEMENT,
|
||||
STATEMENT_F_DISABLE_KEYWORDS),
|
||||
STATEMENT_F_DISABLE_KEYWORDS,
|
||||
BSHELL_SYM_RIGHT_PAREN),
|
||||
LINK_PUSH(BSHELL_SYM_DOLLAR_LEFT_PAREN, BSHELL_LEX_STATE_STATEMENT, 0),
|
||||
LINK_POP(BSHELL_SYM_RIGHT_PAREN),
|
||||
LINK_POP(BSHELL_SYM_RIGHT_BRACE),
|
||||
|
||||
@@ -142,7 +142,8 @@ static enum bshell_status statement_pump_token(struct bshell_lex_ctx *ctx)
|
||||
}
|
||||
|
||||
if (newline) {
|
||||
struct bshell_lex_token *tok = bshell_lex_token_create(BSHELL_TOK_LINEFEED);
|
||||
struct bshell_lex_token *tok
|
||||
= bshell_lex_token_create(BSHELL_TOK_LINEFEED);
|
||||
enqueue_token(ctx, tok);
|
||||
handle_lex_state_transition(ctx, BSHELL_TOK_LINEFEED);
|
||||
return BSHELL_SUCCESS;
|
||||
@@ -203,7 +204,11 @@ static const struct bshell_lex_state_link links[] = {
|
||||
BSHELL_SYM_RIGHT_PAREN),
|
||||
|
||||
/* command tokens */
|
||||
LINK_CHANGE(BSHELL_KW_FUNC, BSHELL_LEX_STATE_COMMAND),
|
||||
LINK_PUSH_WITH_TERM(
|
||||
BSHELL_KW_FUNC,
|
||||
BSHELL_LEX_STATE_COMMAND,
|
||||
0,
|
||||
BSHELL_SYM_RIGHT_BRACE),
|
||||
LINK_CHANGE(BSHELL_SYM_AMPERSAND, BSHELL_LEX_STATE_COMMAND),
|
||||
LINK_CHANGE(BSHELL_TOK_WORD, BSHELL_LEX_STATE_COMMAND),
|
||||
LINK_END,
|
||||
|
||||
Reference in New Issue
Block a user