feat(parser): and_or_rule in progress

This commit is contained in:
Matteo Flebus 2026-01-22 19:57:49 +01:00
parent 5faa179b63
commit 82f35cfa08
4 changed files with 57 additions and 2 deletions

View file

@ -98,6 +98,14 @@ static void set_token_keyword(struct token *tok, char *begin, ssize_t size)
{
tok->type = TOKEN_ELIF;
}
else if (strncmp(begin, "&&", size) == 0)
{
tok->type = TOKEN_AND;
}
else if (strncmp(begin, "||", size) == 0)
{
tok->type = TOKEN_OR;
}
// no keywords found.
if (tok->type == TOKEN_NULL)

View file

@ -56,7 +56,9 @@ enum token_type
TOKEN_THEN,
TOKEN_ELSE,
TOKEN_FI,
TOKEN_ELIF
TOKEN_ELIF,
TOKEN_AND,
TOKEN_OR
};
struct token