19 lines
384 B
C
19 lines
384 B
C
|
|
#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;
|
||
|
|
}
|