/* ** mruby/compile.h - mruby parser ** ** See Copyright Notice in mruby.h */ #ifndef MRUBY_COMPILE_H #define MRUBY_COMPILE_H 1 #if defined(__cplusplus) extern "C" { #endif #include "mruby.h" #include /* load context */ typedef struct mrbc_context { mrb_sym *syms; int slen; char *filename; short lineno; mrb_bool capture_errors:1; mrb_bool dump_result:1; mrb_bool no_exec:1; } mrbc_context; mrbc_context* mrbc_context_new(mrb_state *mrb); void mrbc_context_free(mrb_state *mrb, mrbc_context *cxt); const char *mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s); /* AST node structure */ typedef struct mrb_ast_node { struct mrb_ast_node *car, *cdr; short lineno; } mrb_ast_node; /* lexer states */ enum mrb_lex_state_enum { EXPR_BEG, /* ignore newline, +/- is a sign. */ EXPR_END, /* newline significant, +/- is an operator. */ EXPR_ENDARG, /* ditto, and unbound braces. */ EXPR_ENDFN, /* ditto, and unbound braces. */ EXPR_ARG, /* newline significant, +/- is an operator. */ EXPR_CMDARG, /* newline significant, +/- is an operator. */ EXPR_MID, /* newline significant, +/- is an operator. */ EXPR_FNAME, /* ignore newline, no reserved words. */ EXPR_DOT, /* right after `.' or `::', no reserved words. */ EXPR_CLASS, /* immediate after `class', no here document. */ EXPR_VALUE, /* alike EXPR_BEG but label is disallowed. */ EXPR_MAX_STATE }; /* saved error message */ struct mrb_parser_message { int lineno; int column; char* message; }; /* heredoc parse type */ enum heredoc_type { heredoc_type_norm, /* <