lang: replace stack-based parser with a recursive parser
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include "ctx.h"
|
||||
|
||||
bool peek_label(struct ivy_parser *parser)
|
||||
{
|
||||
struct ivy_token *tok = peek_token(parser);
|
||||
return (!tok || tok->t_type == IVY_TOK_LABEL);
|
||||
}
|
||||
|
||||
bool parse_label(struct ivy_parser *parser, struct ivy_token **out)
|
||||
{
|
||||
struct ivy_token *tok = peek_token(parser);
|
||||
if (!tok || tok->t_type != IVY_TOK_LABEL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*out = parse_token(parser);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user