37 lines
681 B
C
37 lines
681 B
C
#include "ctx.h"
|
|
|
|
bool parse_string(struct ivy_parser *parser, struct ivy_token **out)
|
|
{
|
|
struct ivy_token *tok = peek_token(parser);
|
|
if (!tok || tok->t_type != IVY_TOK_STRING) {
|
|
return false;
|
|
}
|
|
|
|
*out = parse_token(parser);
|
|
return true;
|
|
}
|
|
|
|
bool parse_str_start(struct ivy_parser *parser)
|
|
{
|
|
struct ivy_token *tok = peek_token(parser);
|
|
if (tok->t_type != IVY_TOK_STR_START) {
|
|
return false;
|
|
}
|
|
|
|
parse_token(parser);
|
|
ivy_token_destroy(tok);
|
|
return true;
|
|
}
|
|
|
|
bool parse_str_end(struct ivy_parser *parser)
|
|
{
|
|
struct ivy_token *tok = peek_token(parser);
|
|
if (tok->t_type != IVY_TOK_STR_END) {
|
|
return false;
|
|
}
|
|
|
|
parse_token(parser);
|
|
ivy_token_destroy(tok);
|
|
return true;
|
|
}
|