1 #ifndef INTERNAL_RUBY_PARSE_H
2 #define INTERNAL_RUBY_PARSE_H
5 #include "internal/bignum.h"
6 #include "internal/compilers.h"
7 #include "internal/complex.h"
8 #include "internal/parse.h"
9 #include "internal/rational.h"
10 #include "rubyparser.h"
13 struct lex_pointer_string
{
18 RUBY_SYMBOL_EXPORT_BEGIN
19 #ifdef UNIVERSAL_PARSER
20 const rb_parser_config_t
*rb_ruby_parser_config(void);
21 rb_parser_t
*rb_parser_params_new(void);
23 VALUE
rb_parser_set_context(VALUE
, const struct rb_iseq_struct
*, int);
24 VALUE
rb_parser_new(void);
25 VALUE
rb_parser_compile_string_path(VALUE vparser
, VALUE fname
, VALUE src
, int line
);
26 VALUE
rb_str_new_parser_string(rb_parser_string_t
*str
);
27 VALUE
rb_str_new_mutable_parser_string(rb_parser_string_t
*str
);
28 VALUE
rb_parser_lex_get_str(struct lex_pointer_string
*ptr_str
);
30 VALUE
rb_node_str_string_val(const NODE
*);
31 VALUE
rb_node_sym_string_val(const NODE
*);
32 VALUE
rb_node_dstr_string_val(const NODE
*);
33 VALUE
rb_node_regx_string_val(const NODE
*);
34 VALUE
rb_node_dregx_string_val(const NODE
*);
35 VALUE
rb_node_line_lineno_val(const NODE
*);
36 VALUE
rb_node_file_path_val(const NODE
*);
37 VALUE
rb_node_encoding_val(const NODE
*);
39 VALUE
rb_node_integer_literal_val(const NODE
*);
40 VALUE
rb_node_float_literal_val(const NODE
*);
41 VALUE
rb_node_rational_literal_val(const NODE
*);
42 VALUE
rb_node_imaginary_literal_val(const NODE
*);
43 RUBY_SYMBOL_EXPORT_END
45 VALUE
rb_parser_end_seen_p(VALUE
);
46 VALUE
rb_parser_encoding(VALUE
);
47 VALUE
rb_parser_set_yydebug(VALUE
, VALUE
);
48 VALUE
rb_parser_build_script_lines_from(rb_parser_ary_t
*script_lines
);
49 void rb_parser_set_options(VALUE
, int, int, int, int);
50 VALUE
rb_parser_load_file(VALUE parser
, VALUE name
);
51 void rb_parser_set_script_lines(VALUE vparser
);
52 void rb_parser_error_tolerant(VALUE vparser
);
53 void rb_parser_keep_tokens(VALUE vparser
);
55 VALUE
rb_parser_compile_string(VALUE
, const char*, VALUE
, int);
56 VALUE
rb_parser_compile_file_path(VALUE vparser
, VALUE fname
, VALUE input
, int line
);
57 VALUE
rb_parser_compile_generic(VALUE vparser
, rb_parser_lex_gets_func
*lex_gets
, VALUE fname
, VALUE input
, int line
);
58 VALUE
rb_parser_compile_array(VALUE vparser
, VALUE fname
, VALUE array
, int start
);
61 EXPR_BEG_bit
, /* ignore newline, +/- is a sign. */
62 EXPR_END_bit
, /* newline significant, +/- is an operator. */
63 EXPR_ENDARG_bit
, /* ditto, and unbound braces. */
64 EXPR_ENDFN_bit
, /* ditto, and unbound braces. */
65 EXPR_ARG_bit
, /* newline significant, +/- is an operator. */
66 EXPR_CMDARG_bit
, /* newline significant, +/- is an operator. */
67 EXPR_MID_bit
, /* newline significant, +/- is an operator. */
68 EXPR_FNAME_bit
, /* ignore newline, no reserved words. */
69 EXPR_DOT_bit
, /* right after `.', `&.' or `::', no reserved words. */
70 EXPR_CLASS_bit
, /* immediate after `class', no here document. */
71 EXPR_LABEL_bit
, /* flag bit, label is allowed. */
72 EXPR_LABELED_bit
, /* flag bit, just after a label. */
73 EXPR_FITEM_bit
, /* symbol literal as FNAME. */
76 /* examine combinations */
78 #define DEF_EXPR(n) EXPR_##n = (1 << EXPR_##n##_bit)
92 EXPR_VALUE
= EXPR_BEG
,
93 EXPR_BEG_ANY
= (EXPR_BEG
| EXPR_MID
| EXPR_CLASS
),
94 EXPR_ARG_ANY
= (EXPR_ARG
| EXPR_CMDARG
),
95 EXPR_END_ANY
= (EXPR_END
| EXPR_ENDARG
| EXPR_ENDFN
),
99 VALUE
rb_ruby_ast_new(const NODE
*const root
, rb_parser_ary_t
*script_lines
);
100 rb_ast_t
*rb_ruby_ast_data_get(VALUE vast
);
102 #endif /* INTERNAL_RUBY_PARSE_H */