1 #ifndef RBS_GRAMMAR_INTERNAL_H
2 #define RBS_GRAMMAR_INTERNAL_H
8 #include "shotgun/lib/shotgun.h"
13 #include "shotgun/lib/var_table.h"
16 EXPR_BEG
, /* ignore newline, +/- is a sign. */
17 EXPR_END
, /* newline significant, +/- is a operator. */
18 EXPR_ARG
, /* newline significant, +/- is a operator. */
19 EXPR_CMDARG
, /* newline significant, +/- is a operator. */
20 EXPR_ENDARG
, /* newline significant, +/- is a operator. */
21 EXPR_MID
, /* newline significant, +/- is a operator. */
22 EXPR_FNAME
, /* ignore newline, no reserved words. */
23 EXPR_DOT
, /* right after `.' or `::', no reserved words. */
24 EXPR_CLASS
, /* immediate after `class', no here document. */
28 typedef unsigned LONG_LONG stack_type
;
30 typedef unsigned long stack_type
;
33 #include "shotgun/lib/grammar_node.h"
35 typedef struct rb_parse_state
{
50 /* Mirror'ing the 1.8 parser, There are 2 input methods,
51 from IO and directly from a string. */
53 /* this function reads a line from lex_io and stores it in
59 /* If this is set, we use the io method. */
61 /* Otherwise, we use this. */
70 enum lex_state lex_state
;
72 stack_type cond_stack
;
73 stack_type cmdarg_stack
;
75 void *lval
; /* the parser's yylval */
88 int pool_size
, current_pool
;
90 char *memory_last_addr
;
98 #define PARSE_STATE ((rb_parse_state*)parse_state)
99 #define PARSE_VAR(var) (PARSE_STATE->var)
100 #define ruby_debug_lines PARSE_VAR(debug_lines)
101 #define heredoc_end PARSE_VAR(heredoc_end)
102 #define command_start PARSE_VAR(command_start)
103 #define lex_strterm PARSE_VAR(lex_strterm)
104 #define class_nest PARSE_VAR(class_nest)
105 #define in_single PARSE_VAR(in_single)
106 #define in_def PARSE_VAR(in_def)
107 #define compile_for_eval PARSE_VAR(compile_for_eval)
108 #define cur_mid PARSE_VAR(cur_mid)
110 #define tokenbuf PARSE_VAR(token_buffer)
111 #define tokidx PARSE_VAR(tokidx)
112 #define toksiz PARSE_VAR(toksiz)
114 #endif /* __GRAMMER_INTERNAL_H__ */