21 lines
524 B
C
21 lines
524 B
C
#include <compiler/fzl_parser.h>
|
|
#include <compiler/internals/parser.h>
|
|
#include <stdio.h>
|
|
|
|
// `while` and `for` loops
|
|
fzl_node_t *pa_loop(fzl_parser_t *parser)
|
|
{
|
|
if (!peek(parser))
|
|
return NULL;
|
|
|
|
if (is(parser, FZL_TOKTYPE_FOR))
|
|
return pa_for(parser);
|
|
else if (is(parser, FZL_TOKTYPE_WHILE))
|
|
return pa_while(parser);
|
|
|
|
snprintf(plast_err, sizeof(plast_err),
|
|
"'%s': unknown type of loop at %ld:%ld", last_known_tok->filename,
|
|
last_known_tok->ln, last_known_tok->cn);
|
|
return NULL;
|
|
}
|