RNode

From RubySpec

Jump to: navigation, search

An RNode represents a node in the parsed AST of a Ruby script.

RNode has the following fields, in the form of two common fields and three unions

flags
???
nd_file
The name of the file from which this AST was generated
union u1
node
A link to the next node in the chain (?)
id
???
value
???
cfunc
???
tbl
???
union u2
node
A link to the next node in the chain (?)
id
???
argc
argument count
value
an object (??)
union u2
node
A link to the next node in the chain (?)
id
???
state
???
cnt
???
entry
???
value
???
typedef struct RNode {
    unsigned long flags;
    char *nd_file;
    union {
	struct RNode *node;
	ID id;
	VALUE value;
	VALUE (*cfunc)(ANYARGS);
	ID *tbl;
    } u1;
    union {
	struct RNode *node;
	ID id;
	long argc;
	VALUE value;
    } u2;
    union {
	struct RNode *node;
	ID id;
	long state;
	struct global_entry *entry;
	long cnt;
	VALUE value;
    } u3;
} NODE;
Personal tools