0
+ * parse_io(stream, filename=nil, line_number=0)
0
+ * Parses an IO object, returning a native spidermonkey parse tree.
0
static VALUE parse_io(int argc, VALUE *argv, VALUE klass) {
0
VALUE self = allocate(klass);
0
VALUE stream, filename, linenum;
0
-static VALUE /* line */
0
+ * Returns the line number of the node.
0
+static VALUE line(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
return INT2NUM(ctx->node->pn_pos.begin.lineno);
0
-static VALUE /* index */
0
-begin_index(VALUE self) {
0
+ * Returns the column number of the node.
0
+static VALUE begin_index(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
return INT2NUM(ctx->node->pn_pos.begin.index);
0
-static VALUE /* pn_arity */
0
+ * Returns the arity of the node as a symbol.
0
+static VALUE pn_arity(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_type */
0
+ * Returns the type of the node as a symbol.
0
+static VALUE pn_type(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
return INT2NUM(ctx->node->pn_type);
0
-static VALUE /* pn_expr */
0
-data_pn_expr(VALUE self) {
0
+ * Returns the parse node expression as an ImmutableNode.
0
+static VALUE data_pn_expr(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_kid */
0
-data_pn_kid(VALUE self) {
0
+ * Returns the child ImmutableNode.
0
+static VALUE data_pn_kid(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_kid1 */
0
-data_pn_kid1(VALUE self) {
0
+ * Returns the first child ImmutableNode.
0
+static VALUE data_pn_kid1(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_kid2 */
0
-data_pn_kid2(VALUE self) {
0
+ * Returns the second child ImmutableNode.
0
+static VALUE data_pn_kid2(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_kid3 */
0
-data_pn_kid3(VALUE self) {
0
+ * Returns the third child ImmutableNode.
0
+static VALUE data_pn_kid3(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_dval */
0
-data_pn_dval(VALUE self) {
0
+ * Returns the numeric value of the node.
0
+static VALUE data_pn_dval(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_op */
0
-data_pn_op(VALUE self) {
0
+ * Returns the op code for the node as a symbol.
0
+static VALUE data_pn_op(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
return INT2NUM(ctx->node->pn_op);
0
-static VALUE /* pn_left */
0
-data_pn_left(VALUE self) {
0
+ * Returns the left side ImmutableNode.
0
+static VALUE data_pn_left(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
-static VALUE /* pn_extra */
0
-data_pn_extra(VALUE self) {
0
+ * Returns extra informaton about the node as an Integer.
0
+static VALUE data_pn_extra(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
return INT2NUM(ctx->node->pn_extra);
0
-static VALUE /* name */
0
+ * Returns the name of the node.
0
+static VALUE name(VALUE self) {
0
ImmutableNodeContext * ctx;
0
Data_Get_Struct(self, ImmutableNodeContext, ctx);
0
return rb_str_new2(JS_GetStringBytes(ATOM_TO_STRING(ctx->node->pn_atom)));
0
-static VALUE /* regexp */
0
+ * Returns the regexp value as a String.
0
+static VALUE regexp(VALUE self) {
0
ImmutableNodeContext * ctx;
0
return rb_str_new2(JS_GetStringBytes(JSVAL_TO_STRING(result)));
0
-static VALUE /* function_name */
0
-function_name(VALUE self) {
0
+ * Returns the function name as a String.
0
+static VALUE function_name(VALUE self) {
0
ImmutableNodeContext * ctx;
0
-static VALUE /* function_args */
0
-function_args(VALUE self) {
0
+ * Returns the function argument names as an Array of String.
0
+static VALUE function_args(VALUE self) {
0
ImmutableNodeContext * ctx;
0
-static VALUE /* function_body */
0
-function_body(VALUE self) {
0
+ * Returns the function body as an ImmutableNode.
0
+static VALUE function_body(VALUE self) {
0
ImmutableNodeContext * ctx;
0
-static VALUE /* pn_right */
0
-data_pn_right(VALUE self)
0
+ * Returns right side as an ImmutableNode.
0
+static VALUE data_pn_right(VALUE self)
0
ImmutableNodeContext * ctx;
0
-static VALUE /* children */
0
+ * Returns children as an Array of ImmutableNode.
0
+static VALUE children(VALUE self) {
0
ImmutableNodeContext * ctx;
0
void init_Johnson_SpiderMonkey_Immutable_Node(VALUE spidermonkey)
0
+ /* HACK: These comments are *only* to make RDoc happy.
0
+ VALUE johnson = rb_define_module("Johnson");
0
+ VALUE spidermonkey = rb_define_module_under(johnson, "SpiderMonkey");
0
+ /* ImmutableNode class. */
0
cNode = rb_define_class_under(spidermonkey, "ImmutableNode", rb_cObject);
0
rb_define_alloc_func(cNode, allocate);
Comments
No one has commented yet.