Skip to content
Snippets Groups Projects
epsilon.c 499 B
Newer Older
Dan Hirsch's avatar
Dan Hirsch committed
#include "parser_internal.h"

static HParseResult* parse_epsilon(void* env, HParseState* state) {
  (void)env;
  HParseResult* res = a_new(HParseResult, 1);
  res->ast = NULL;
  res->arena = state->arena;
  return res;
}

static const HParserVtable epsilon_vt = {
  .parse = parse_epsilon,
};

Dan Hirsch's avatar
Dan Hirsch committed
static const HParser epsilon_p = {
  .vtable = &epsilon_vt,
  .env = NULL
};

Dan Hirsch's avatar
Dan Hirsch committed
const HParser* h_epsilon_p() {
Dan Hirsch's avatar
Dan Hirsch committed
  return &epsilon_p;
Dan Hirsch's avatar
Dan Hirsch committed
}
const HParser* h_epsilon_p__m(HAllocator* mm__) {
  return &epsilon_p;
}