feat(lexer): elif token type
This commit is contained in:
parent
254a50177f
commit
bc7f8f3e8c
2 changed files with 6 additions and 1 deletions
|
|
@ -82,6 +82,10 @@ static void set_token_keyword(struct token *tok, char *begin, ssize_t size)
|
||||||
{
|
{
|
||||||
tok->type = TOKEN_ELSE;
|
tok->type = TOKEN_ELSE;
|
||||||
}
|
}
|
||||||
|
else if (strncmp(begin, "elif", size) == 0)
|
||||||
|
{
|
||||||
|
tok->type = TOKEN_ELIF;
|
||||||
|
}
|
||||||
|
|
||||||
tok->data = calloc(size + 1, sizeof(char));
|
tok->data = calloc(size + 1, sizeof(char));
|
||||||
if (tok->data == NULL)
|
if (tok->data == NULL)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ enum token_type
|
||||||
TOKEN_IF,
|
TOKEN_IF,
|
||||||
TOKEN_THEN,
|
TOKEN_THEN,
|
||||||
TOKEN_ELSE,
|
TOKEN_ELSE,
|
||||||
TOKEN_FI
|
TOKEN_FI,
|
||||||
|
TOKEN_ELIF
|
||||||
};
|
};
|
||||||
|
|
||||||
struct token
|
struct token
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue