19 lines
382 B
C
19 lines
382 B
C
|
|
#include "ctx.h"
|
||
|
|
|
||
|
|
bool peek_word(struct ivy_parser *parser)
|
||
|
|
{
|
||
|
|
struct ivy_token *tok = peek_token(parser);
|
||
|
|
return (!tok || tok->t_type == IVY_TOK_IDENT);
|
||
|
|
}
|
||
|
|
|
||
|
|
bool parse_word(struct ivy_parser *parser, struct ivy_token **out)
|
||
|
|
{
|
||
|
|
struct ivy_token *tok = peek_token(parser);
|
||
|
|
if (!tok || tok->t_type != IVY_TOK_IDENT) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
*out = parse_token(parser);
|
||
|
|
return true;
|
||
|
|
}
|