20node_gc_mark(
void *
ptr)
27node_memsize(
const void *
ptr)
57 obj = rb_ast_node_alloc(rb_cNode);
87 return rb_ast_parse_str(
str);
97 return ast_parse_done(
ast);
103 return rb_ast_parse_file(
path);
118 return ast_parse_done(
ast);
135rb_ast_parse_array(
VALUE array)
141 return ast_parse_done(
ast);
147node_find(
VALUE self,
const int node_id)
156 ary = node_children(data->
ast, data->
node);
162 VALUE result = node_find(child, node_id);
163 if (
RTEST(result))
return result;
177 CONST_ID(script_lines,
"SCRIPT_LINES__");
194 iseq = vm_proc_iseq(body);
208 if (!
NIL_P(lines = script_lines(
path))) {
209 node = rb_ast_parse_array(lines);
218 return node_find(
node, node_id);
245#define NEW_CHILD(ast, node) node ? ast_new_internal(ast, node) : Qnil
257 for (
i=0;
i<
n;
i++) {
272 }
while (
node->nd_next &&
300 if (!
id)
return Qnil;
315 return rb_ary_new_from_node_args(
ast, 3,
node->nd_cond,
node->nd_body,
node->nd_else);
317 return rb_ary_new_from_node_args(
ast, 3,
node->nd_cond,
node->nd_body,
node->nd_else);
319 return rb_ary_new_from_node_args(
ast, 2,
node->nd_head,
node->nd_body);
321 return rb_ary_new_from_node_args(
ast, 2,
node->nd_head,
node->nd_body);
323 return rb_ary_new_from_node_args(
ast, 2,
node->nd_head,
node->nd_body);
325 return rb_ary_new_from_node_args(
ast, 3,
node->nd_head,
node->nd_body,
node->nd_next);
327 return rb_ary_new_from_node_args(
ast, 3,
node->nd_head,
node->nd_body,
node->nd_next);
336 return rb_ary_new_from_node_args(
ast, 2,
node->nd_iter,
node->nd_body);
338 return rb_ary_new_from_node_args(
ast, 1,
node->nd_var);
345 return rb_ary_new_from_node_args(
ast, 1,
node->nd_stts);
347 return rb_ary_new_from_node_args(
ast, 0);
349 return rb_ary_new_from_node_args(
ast, 0);
351 return rb_ary_new_from_node_args(
ast, 1,
node->nd_body);
353 return rb_ary_new_from_node_args(
ast, 3,
node->nd_head,
node->nd_resq,
node->nd_else);
355 return rb_ary_new_from_node_args(
ast, 3,
node->nd_args,
node->nd_body,
node->nd_head);
357 return rb_ary_new_from_node_args(
ast, 2,
node->nd_head,
node->nd_ensr);
376 return rb_ary_new_from_node_args(
ast, 3,
node->nd_value,
node->nd_head,
node->nd_args);
437 return rb_ary_new_from_node_args(
ast, 1,
node->nd_args);
439 return rb_ary_new_from_node_args(
ast, 0);
446 return rb_ary_new_from_node_args(
ast, 0);
448 return rb_ary_new_from_node_args(
ast, 1,
node->nd_head);
450 return rb_ary_new_from_node_args(
ast, 1,
node->nd_head);
471 return rb_ary_new_from_node_args(
ast, 3,
node->nd_recv,
node->nd_value,
node->nd_args);
473 return rb_ary_new_from_node_args(
ast, 2,
node->nd_recv,
node->nd_value);
475 return rb_ary_new_from_node_args(
ast, 2,
node->nd_recv,
node->nd_value);
484 return rb_ary_new_from_node_args(
ast, 1,
node->nd_body);
497 return rb_ary_new_from_node_args(
ast, 1,
node->nd_body);
499 return rb_ary_new_from_node_args(
ast, 2,
node->nd_head,
node->nd_body);
501 return rb_ary_new_from_node_args(
ast, 2,
node->nd_head,
node->nd_body);
503 return rb_ary_new_from_node_args(
ast, 1,
node->nd_head);
505 return rb_ary_new_from_node_args(
ast, 2,
node->nd_head,
node->nd_body);
511 return rb_ary_new_from_node_args(
ast, 2,
node->nd_1st,
node->nd_2nd);
515 return rb_ary_new_from_node_args(
ast, 1,
node->nd_undef);
517 return rb_ary_new_from_node_args(
ast, 3,
node->nd_cpath,
node->nd_super,
node->nd_body);
519 return rb_ary_new_from_node_args(
ast, 2,
node->nd_cpath,
node->nd_body);
521 return rb_ary_new_from_node_args(
ast, 2,
node->nd_recv,
node->nd_body);
534 return rb_ary_new_from_node_args(
ast, 2,
node->nd_beg,
node->nd_end);
536 return rb_ary_new_from_node_args(
ast, 0);
538 return rb_ary_new_from_node_args(
ast, 0);
540 return rb_ary_new_from_node_args(
ast, 0);
542 return rb_ary_new_from_node_args(
ast, 0);
544 return rb_ary_new_from_node_args(
ast, 0);
546 return rb_ary_new_from_node_args(
ast, 1,
node->nd_head);
548 return rb_ary_new_from_node_args(
ast, 1,
node->nd_body);
552 return rb_ary_new_from_node_args(
ast, 1,
node->nd_body);
554 return rb_ary_new_from_node_args(
ast, 2,
node->nd_body,
node->nd_next);
556 return rb_ary_new_from_node_args(
ast, 2,
node->nd_body,
node->nd_next);
559 return rb_ary_new_from_node_args(
ast, 2,
node->nd_1st,
node->nd_2nd);
582 ID *tbl = node->nd_tbl;
583 int i,
size = tbl ? (
int)*tbl++ : 0;
625 return node_children(data->
ast, data->
node);
677 node_type_to_str(data->
node),
#define NEW_CHILD(ast, node)
rb_encoding * rb_utf8_encoding(void)
rb_encoding * rb_enc_get(VALUE obj)
VALUE rb_enc_from_encoding(rb_encoding *encoding)
#define rb_enc_asciicompat(enc)
char str[HTML_ESCAPE_MAX_LEN+1]
VALUE rb_define_class_under(VALUE, const char *, VALUE)
Defines a class under the namespace of outer.
VALUE rb_define_module_under(VALUE, const char *)
VALUE rb_cObject
Object class.
void rb_raise(VALUE exc, const char *fmt,...)
void rb_exc_raise(VALUE mesg)
Raises an exception in the current thread.
void rb_bug(const char *fmt,...)
VALUE rb_obj_class(VALUE)
Equivalent to Object#class in Ruby.
VALUE type(ANYARGS)
ANYARGS-ed function type.
rb_iseq_location_t location
struct rb_iseq_constant_body * body
#define DECIMAL_SIZE_OF_BITS(n)