#include "ruby/ruby.h"
#include "eventids1.h"

struct ripper_parser_ids ripper_parser_ids;

void
ripper_init_eventids1(void)
{
#define set_id1(name) RIPPER_ID(name) = rb_intern_const("on_"#name)
    set_id1(BEGIN);
    set_id1(END);
    set_id1(alias);
    set_id1(alias_error);
    set_id1(aref);
    set_id1(aref_field);
    set_id1(arg_ambiguous);
    set_id1(arg_paren);
    set_id1(args_add);
    set_id1(args_add_block);
    set_id1(args_add_star);
    set_id1(args_forward);
    set_id1(args_new);
    set_id1(array);
    set_id1(aryptn);
    set_id1(assign);
    set_id1(assign_error);
    set_id1(assoc_new);
    set_id1(assoc_splat);
    set_id1(assoclist_from_args);
    set_id1(bare_assoc_hash);
    set_id1(begin);
    set_id1(binary);
    set_id1(block_var);
    set_id1(blockarg);
    set_id1(bodystmt);
    set_id1(brace_block);
    set_id1(break);
    set_id1(call);
    set_id1(case);
    set_id1(class);
    set_id1(class_name_error);
    set_id1(command);
    set_id1(command_call);
    set_id1(const_path_field);
    set_id1(const_path_ref);
    set_id1(const_ref);
    set_id1(def);
    set_id1(defined);
    set_id1(defs);
    set_id1(do_block);
    set_id1(dot2);
    set_id1(dot3);
    set_id1(dyna_symbol);
    set_id1(else);
    set_id1(elsif);
    set_id1(ensure);
    set_id1(excessed_comma);
    set_id1(fcall);
    set_id1(field);
    set_id1(fndptn);
    set_id1(for);
    set_id1(hash);
    set_id1(heredoc_dedent);
    set_id1(hshptn);
    set_id1(if);
    set_id1(if_mod);
    set_id1(ifop);
    set_id1(in);
    set_id1(kwrest_param);
    set_id1(lambda);
    set_id1(magic_comment);
    set_id1(massign);
    set_id1(method_add_arg);
    set_id1(method_add_block);
    set_id1(mlhs_add);
    set_id1(mlhs_add_post);
    set_id1(mlhs_add_star);
    set_id1(mlhs_new);
    set_id1(mlhs_paren);
    set_id1(module);
    set_id1(mrhs_add);
    set_id1(mrhs_add_star);
    set_id1(mrhs_new);
    set_id1(mrhs_new_from_args);
    set_id1(next);
    set_id1(nokw_param);
    set_id1(opassign);
    set_id1(operator_ambiguous);
    set_id1(param_error);
    set_id1(params);
    set_id1(paren);
    set_id1(parse_error);
    set_id1(program);
    set_id1(qsymbols_add);
    set_id1(qsymbols_new);
    set_id1(qwords_add);
    set_id1(qwords_new);
    set_id1(redo);
    set_id1(regexp_add);
    set_id1(regexp_literal);
    set_id1(regexp_new);
    set_id1(rescue);
    set_id1(rescue_mod);
    set_id1(rest_param);
    set_id1(retry);
    set_id1(return);
    set_id1(return0);
    set_id1(sclass);
    set_id1(stmts_add);
    set_id1(stmts_new);
    set_id1(string_add);
    set_id1(string_concat);
    set_id1(string_content);
    set_id1(string_dvar);
    set_id1(string_embexpr);
    set_id1(string_literal);
    set_id1(super);
    set_id1(symbol);
    set_id1(symbol_literal);
    set_id1(symbols_add);
    set_id1(symbols_new);
    set_id1(top_const_field);
    set_id1(top_const_ref);
    set_id1(unary);
    set_id1(undef);
    set_id1(unless);
    set_id1(unless_mod);
    set_id1(until);
    set_id1(until_mod);
    set_id1(var_alias);
    set_id1(var_field);
    set_id1(var_ref);
    set_id1(vcall);
    set_id1(void_stmt);
    set_id1(when);
    set_id1(while);
    set_id1(while_mod);
    set_id1(word_add);
    set_id1(word_new);
    set_id1(words_add);
    set_id1(words_new);
    set_id1(xstring_add);
    set_id1(xstring_literal);
    set_id1(xstring_new);
    set_id1(yield);
    set_id1(yield0);
    set_id1(zsuper);
}

#define intern_sym(name) ID2SYM(rb_intern_const(name))

void
ripper_init_eventids1_table(VALUE self)
{
    VALUE h = rb_hash_new();
    rb_define_const(self, "PARSER_EVENT_TABLE", h);
    rb_hash_aset(h, intern_sym("BEGIN"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("END"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("alias"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("alias_error"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("aref"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("aref_field"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("arg_ambiguous"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("arg_paren"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("args_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("args_add_block"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("args_add_star"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("args_forward"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("args_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("array"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("aryptn"), INT2FIX(4));
    rb_hash_aset(h, intern_sym("assign"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("assign_error"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("assoc_new"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("assoc_splat"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("assoclist_from_args"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("bare_assoc_hash"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("begin"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("binary"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("block_var"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("blockarg"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("bodystmt"), INT2FIX(4));
    rb_hash_aset(h, intern_sym("brace_block"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("break"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("call"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("case"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("class"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("class_name_error"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("command"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("command_call"), INT2FIX(4));
    rb_hash_aset(h, intern_sym("const_path_field"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("const_path_ref"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("const_ref"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("def"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("defined"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("defs"), INT2FIX(5));
    rb_hash_aset(h, intern_sym("do_block"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("dot2"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("dot3"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("dyna_symbol"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("else"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("elsif"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("ensure"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("excessed_comma"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("fcall"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("field"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("fndptn"), INT2FIX(4));
    rb_hash_aset(h, intern_sym("for"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("hash"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("heredoc_dedent"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("hshptn"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("if"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("if_mod"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("ifop"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("in"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("kwrest_param"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("lambda"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("magic_comment"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("massign"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("method_add_arg"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("method_add_block"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("mlhs_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("mlhs_add_post"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("mlhs_add_star"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("mlhs_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("mlhs_paren"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("module"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("mrhs_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("mrhs_add_star"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("mrhs_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("mrhs_new_from_args"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("next"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("nokw_param"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("opassign"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("operator_ambiguous"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("param_error"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("params"), INT2FIX(7));
    rb_hash_aset(h, intern_sym("paren"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("parse_error"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("program"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("qsymbols_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("qsymbols_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("qwords_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("qwords_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("redo"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("regexp_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("regexp_literal"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("regexp_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("rescue"), INT2FIX(4));
    rb_hash_aset(h, intern_sym("rescue_mod"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("rest_param"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("retry"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("return"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("return0"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("sclass"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("stmts_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("stmts_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("string_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("string_concat"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("string_content"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("string_dvar"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("string_embexpr"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("string_literal"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("super"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("symbol"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("symbol_literal"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("symbols_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("symbols_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("top_const_field"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("top_const_ref"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("unary"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("undef"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("unless"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("unless_mod"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("until"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("until_mod"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("var_alias"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("var_field"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("var_ref"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("vcall"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("void_stmt"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("when"), INT2FIX(3));
    rb_hash_aset(h, intern_sym("while"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("while_mod"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("word_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("word_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("words_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("words_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("xstring_add"), INT2FIX(2));
    rb_hash_aset(h, intern_sym("xstring_literal"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("xstring_new"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("yield"), INT2FIX(1));
    rb_hash_aset(h, intern_sym("yield0"), INT2FIX(0));
    rb_hash_aset(h, intern_sym("zsuper"), INT2FIX(0));
}
