ext/cached/ruby-1.9.1/internal/node/nodeinfo.c in ruby-internal-0.8.0 vs ext/cached/ruby-1.9.1/internal/node/nodeinfo.c in ruby-internal-0.8.1

- old
+ new

@@ -2830,14 +2830,14 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_ALIAS] = rb_cALIAS; rb_iv_set(rb_cALIAS, "__member__", members); rb_iv_set(rb_cALIAS, "__type__", INT2NUM(NODE_ALIAS)); rb_define_singleton_method(rb_cALIAS, "members", node_s_members, 0); - rb_define_method(rb_cALIAS, "second", node_2nd, 0); - rb_ary_push(members, rb_str_new2("second")); rb_define_method(rb_cALIAS, "first", node_1st, 0); rb_ary_push(members, rb_str_new2("first")); + rb_define_method(rb_cALIAS, "second", node_2nd, 0); + rb_ary_push(members, rb_str_new2("second")); } /* Document-class: Node::ALLOCA * A node used for temporary allocation of memory on platforms that do * not support alloca. @@ -2851,16 +2851,10 @@ rb_cNodeSubclass[NODE_ALLOCA] = rb_cALLOCA; rb_iv_set(rb_cALLOCA, "__member__", members); rb_iv_set(rb_cALLOCA, "__type__", INT2NUM(NODE_ALLOCA)); rb_define_singleton_method(rb_cALLOCA, "members", node_s_members, 0); - /* Document-method: cnt - * the number of bytes allocated - */ - rb_define_method(rb_cALLOCA, "cnt", node_cnt, 0); - rb_ary_push(members, rb_str_new2("cnt")); - /* Document-method: cfnc * a pointer to the allocated memory */ rb_define_method(rb_cALLOCA, "cfnc", node_cfnc, 0); rb_ary_push(members, rb_str_new2("cfnc")); @@ -2868,10 +2862,16 @@ /* Document-method: value * a pointer to the previously allocated temporary node */ rb_define_method(rb_cALLOCA, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: cnt + * the number of bytes allocated + */ + rb_define_method(rb_cALLOCA, "cnt", node_cnt, 0); + rb_ary_push(members, rb_str_new2("cnt")); } #endif /* Document-class: Node::AND * Represents a logical 'and' of the form: @@ -2910,28 +2910,28 @@ rb_cNodeSubclass[NODE_ARGS] = rb_cARGS; rb_iv_set(rb_cARGS, "__member__", members); rb_iv_set(rb_cARGS, "__type__", INT2NUM(NODE_ARGS)); rb_define_singleton_method(rb_cARGS, "members", node_s_members, 0); - /* Document-method: cnt - * the number of required arguments + /* Document-method: rest + * an assignment node to assign the rest arg, if it is present */ - rb_define_method(rb_cARGS, "cnt", node_cnt, 0); - rb_ary_push(members, rb_str_new2("cnt")); + rb_define_method(rb_cARGS, "rest", node_rest, 0); + rb_ary_push(members, rb_str_new2("rest")); /* Document-method: opt * a list of assignment nodes to assign default values to the * optional arguments if no argument is specified */ rb_define_method(rb_cARGS, "opt", node_opt, 0); rb_ary_push(members, rb_str_new2("opt")); - /* Document-method: rest - * an assignment node to assign the rest arg, if it is present + /* Document-method: cnt + * the number of required arguments */ - rb_define_method(rb_cARGS, "rest", node_rest, 0); - rb_ary_push(members, rb_str_new2("rest")); + rb_define_method(rb_cARGS, "cnt", node_cnt, 0); + rb_ary_push(members, rb_str_new2("cnt")); } /* Document-class: Node::ARGSCAT * Represents the concatenation of a list of arguments and a splatted * value, e.g.: @@ -2993,18 +2993,18 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_ARRAY] = rb_cARRAY; rb_iv_set(rb_cARRAY, "__member__", members); rb_iv_set(rb_cARRAY, "__type__", INT2NUM(NODE_ARRAY)); rb_define_singleton_method(rb_cARRAY, "members", node_s_members, 0); + rb_define_method(rb_cARRAY, "alen", node_alen, 0); + rb_ary_push(members, rb_str_new2("alen")); /* Document-method: head * the first element of the array */ rb_define_method(rb_cARRAY, "head", node_head, 0); rb_ary_push(members, rb_str_new2("head")); - rb_define_method(rb_cARRAY, "alen", node_alen, 0); - rb_ary_push(members, rb_str_new2("alen")); /* Document-method: next * the tail of the array */ rb_define_method(rb_cARRAY, "next", node_next, 0); @@ -3023,16 +3023,10 @@ rb_cNodeSubclass[NODE_ATTRASGN] = rb_cATTRASGN; rb_iv_set(rb_cATTRASGN, "__member__", members); rb_iv_set(rb_cATTRASGN, "__type__", INT2NUM(NODE_ATTRASGN)); rb_define_singleton_method(rb_cATTRASGN, "members", node_s_members, 0); - /* Document-method: mid - * the id of the attribute, with a trailing '=' sign - */ - rb_define_method(rb_cATTRASGN, "mid", node_mid, 0); - rb_ary_push(members, rb_str_new2("mid")); - /* Document-method: recv * the receiver of the method */ rb_define_method(rb_cATTRASGN, "recv", node_recv, 0); rb_ary_push(members, rb_str_new2("recv")); @@ -3040,10 +3034,16 @@ /* Document-method: args * the arguments to the method */ rb_define_method(rb_cATTRASGN, "args", node_args, 0); rb_ary_push(members, rb_str_new2("args")); + + /* Document-method: mid + * the id of the attribute, with a trailing '=' sign + */ + rb_define_method(rb_cATTRASGN, "mid", node_mid, 0); + rb_ary_push(members, rb_str_new2("mid")); } /* Document-class: Node::ATTRSET * A placeholder for an attribute writer method, which can added to a * class by using attr_writer: @@ -3078,23 +3078,23 @@ rb_cNodeSubclass[NODE_BACK_REF] = rb_cBACK_REF; rb_iv_set(rb_cBACK_REF, "__member__", members); rb_iv_set(rb_cBACK_REF, "__type__", INT2NUM(NODE_BACK_REF)); rb_define_singleton_method(rb_cBACK_REF, "members", node_s_members, 0); - /* Document-method: cnt - * the index into the local variable table where the match data is - * stored - */ - rb_define_method(rb_cBACK_REF, "cnt", node_cnt, 0); - rb_ary_push(members, rb_str_new2("cnt")); - /* Document-method: nth * the integer representation of the character of the variable to * reference, one of '&', '`', '\'', or '+' */ rb_define_method(rb_cBACK_REF, "nth", node_nth, 0); rb_ary_push(members, rb_str_new2("nth")); + + /* Document-method: cnt + * the index into the local variable table where the match data is + * stored + */ + rb_define_method(rb_cBACK_REF, "cnt", node_cnt, 0); + rb_ary_push(members, rb_str_new2("cnt")); } /* Document-class: Node::BEGIN * Represents a begin/end block. * @@ -3178,21 +3178,21 @@ rb_cNodeSubclass[NODE_BLOCK_PASS] = rb_cBLOCK_PASS; rb_iv_set(rb_cBLOCK_PASS, "__member__", members); rb_iv_set(rb_cBLOCK_PASS, "__type__", INT2NUM(NODE_BLOCK_PASS)); rb_define_singleton_method(rb_cBLOCK_PASS, "members", node_s_members, 0); - /* Document-method: iter - * an expression which calls a method - */ - rb_define_method(rb_cBLOCK_PASS, "iter", node_iter, 0); - rb_ary_push(members, rb_str_new2("iter")); - /* Document-method: body * the object to pass as a block */ rb_define_method(rb_cBLOCK_PASS, "body", node_body, 0); rb_ary_push(members, rb_str_new2("body")); + + /* Document-method: iter + * an expression which calls a method + */ + rb_define_method(rb_cBLOCK_PASS, "iter", node_iter, 0); + rb_ary_push(members, rb_str_new2("iter")); } /* Document-class: Node::BMETHOD * A placeholder for a method defined using define_method, e.g.: * define_method(:foo) { @@ -3245,10 +3245,16 @@ rb_cNodeSubclass[NODE_CALL] = rb_cCALL; rb_iv_set(rb_cCALL, "__member__", members); rb_iv_set(rb_cCALL, "__type__", INT2NUM(NODE_CALL)); rb_define_singleton_method(rb_cCALL, "members", node_s_members, 0); + /* Document-method: args + * the arguments to the method + */ + rb_define_method(rb_cCALL, "args", node_args, 0); + rb_ary_push(members, rb_str_new2("args")); + /* Document-method: mid * the method id */ rb_define_method(rb_cCALL, "mid", node_mid, 0); rb_ary_push(members, rb_str_new2("mid")); @@ -3256,16 +3262,10 @@ /* Document-method: recv * the receiver of the method */ rb_define_method(rb_cCALL, "recv", node_recv, 0); rb_ary_push(members, rb_str_new2("recv")); - - /* Document-method: args - * the arguments to the method - */ - rb_define_method(rb_cCALL, "args", node_args, 0); - rb_ary_push(members, rb_str_new2("args")); } /* Document-class: Node::CASE * Represents the value portion of a case/end block, e.g.: * case head @@ -3307,21 +3307,21 @@ rb_cNodeSubclass[NODE_CDECL] = rb_cCDECL; rb_iv_set(rb_cCDECL, "__member__", members); rb_iv_set(rb_cCDECL, "__type__", INT2NUM(NODE_CDECL)); rb_define_singleton_method(rb_cCDECL, "members", node_s_members, 0); - /* Document-method: vid - * the name of the constant to be assigned, all uppercase - */ - rb_define_method(rb_cCDECL, "vid", node_vid, 0); - rb_ary_push(members, rb_str_new2("vid")); - /* Document-method: value * the value to be assigned to the constant */ rb_define_method(rb_cCDECL, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: vid + * the name of the constant to be assigned, all uppercase + */ + rb_define_method(rb_cCDECL, "vid", node_vid, 0); + rb_ary_push(members, rb_str_new2("vid")); } /* Document-class: Node::CFUNC * A placeholder for a function implemented in C. */ @@ -3360,16 +3360,10 @@ rb_cNodeSubclass[NODE_CLASS] = rb_cCLASS; rb_iv_set(rb_cCLASS, "__member__", members); rb_iv_set(rb_cCLASS, "__type__", INT2NUM(NODE_CLASS)); rb_define_singleton_method(rb_cCLASS, "members", node_s_members, 0); - /* Document-method: body - * the body of the class definition - */ - rb_define_method(rb_cCLASS, "body", node_body, 0); - rb_ary_push(members, rb_str_new2("body")); - /* Document-method: super * an expression returning the base class, or false if there is no * base class specified */ rb_define_method(rb_cCLASS, "super", node_super, 0); @@ -3378,10 +3372,16 @@ /* Document-method: cpath * the name of the class to define */ rb_define_method(rb_cCLASS, "cpath", node_cpath, 0); rb_ary_push(members, rb_str_new2("cpath")); + + /* Document-method: body + * the body of the class definition + */ + rb_define_method(rb_cCLASS, "body", node_body, 0); + rb_ary_push(members, rb_str_new2("body")); } /* Document-class: Node::COLON2 * Represents a constant lookup in a particular class. This expression * has the form: @@ -3479,22 +3479,22 @@ rb_cNodeSubclass[NODE_CVASGN] = rb_cCVASGN; rb_iv_set(rb_cCVASGN, "__member__", members); rb_iv_set(rb_cCVASGN, "__type__", INT2NUM(NODE_CVASGN)); rb_define_singleton_method(rb_cCVASGN, "members", node_s_members, 0); - /* Document-method: vid - * the name of the class variable to assign - */ - rb_define_method(rb_cCVASGN, "vid", node_vid, 0); - rb_ary_push(members, rb_str_new2("vid")); - /* Document-method: value * an expression whose result is the new value of the class * variable */ rb_define_method(rb_cCVASGN, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: vid + * the name of the class variable to assign + */ + rb_define_method(rb_cCVASGN, "vid", node_vid, 0); + rb_ary_push(members, rb_str_new2("vid")); } /* Document-class: Node::CVDECL * Represents class variable assignment in a class context. * @@ -3506,22 +3506,22 @@ rb_cNodeSubclass[NODE_CVDECL] = rb_cCVDECL; rb_iv_set(rb_cCVDECL, "__member__", members); rb_iv_set(rb_cCVDECL, "__type__", INT2NUM(NODE_CVDECL)); rb_define_singleton_method(rb_cCVDECL, "members", node_s_members, 0); - /* Document-method: vid - * the name of the class variable to assign - */ - rb_define_method(rb_cCVDECL, "vid", node_vid, 0); - rb_ary_push(members, rb_str_new2("vid")); - /* Document-method: value * an expression whose result is the new value of the class * variable */ rb_define_method(rb_cCVDECL, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: vid + * the name of the class variable to assign + */ + rb_define_method(rb_cCVDECL, "vid", node_vid, 0); + rb_ary_push(members, rb_str_new2("vid")); } /* Document-class: Node::DASGN * Represents dynamic local variable assignment. Dynamic assignment * differs from static assignment in that the slots for static local @@ -3540,21 +3540,21 @@ rb_cNodeSubclass[NODE_DASGN] = rb_cDASGN; rb_iv_set(rb_cDASGN, "__member__", members); rb_iv_set(rb_cDASGN, "__type__", INT2NUM(NODE_DASGN)); rb_define_singleton_method(rb_cDASGN, "members", node_s_members, 0); - /* Document-method: vid - * the name of the local variable - */ - rb_define_method(rb_cDASGN, "vid", node_vid, 0); - rb_ary_push(members, rb_str_new2("vid")); - /* Document-method: value * the value to assign to the local variable */ rb_define_method(rb_cDASGN, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: vid + * the name of the local variable + */ + rb_define_method(rb_cDASGN, "vid", node_vid, 0); + rb_ary_push(members, rb_str_new2("vid")); } /* Document-class: Node::DASGN_CURR * Represents dynamic local variable assignment in the current frame. * See DASGN for a description of how dynamic assignment works. @@ -3565,21 +3565,21 @@ rb_cNodeSubclass[NODE_DASGN_CURR] = rb_cDASGN_CURR; rb_iv_set(rb_cDASGN_CURR, "__member__", members); rb_iv_set(rb_cDASGN_CURR, "__type__", INT2NUM(NODE_DASGN_CURR)); rb_define_singleton_method(rb_cDASGN_CURR, "members", node_s_members, 0); - /* Document-method: vid - * the name of the local variable - */ - rb_define_method(rb_cDASGN_CURR, "vid", node_vid, 0); - rb_ary_push(members, rb_str_new2("vid")); - /* Document-method: value * the value to assign to the local variable */ rb_define_method(rb_cDASGN_CURR, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: vid + * the name of the local variable + */ + rb_define_method(rb_cDASGN_CURR, "vid", node_vid, 0); + rb_ary_push(members, rb_str_new2("vid")); } /* Document-class: Node::DEFINED * Represents an expression using the 'defined?' keyword. The result * is either nil or a string describing the expression. @@ -3611,22 +3611,22 @@ rb_cNodeSubclass[NODE_DEFN] = rb_cDEFN; rb_iv_set(rb_cDEFN, "__member__", members); rb_iv_set(rb_cDEFN, "__type__", INT2NUM(NODE_DEFN)); rb_define_singleton_method(rb_cDEFN, "members", node_s_members, 0); - /* Document-method: mid - * the name of the method* defn the body of the method - */ - rb_define_method(rb_cDEFN, "mid", node_mid, 0); - rb_ary_push(members, rb_str_new2("mid")); - /* Document-method: defn * the body of the method definition */ rb_define_method(rb_cDEFN, "defn", node_defn, 0); rb_ary_push(members, rb_str_new2("defn")); + /* Document-method: mid + * the name of the method* defn the body of the method + */ + rb_define_method(rb_cDEFN, "mid", node_mid, 0); + rb_ary_push(members, rb_str_new2("mid")); + /* Document-method: noex * the flags which should be used to define the method */ rb_define_method(rb_cDEFN, "noex", node_noex, 0); rb_ary_push(members, rb_str_new2("noex")); @@ -3643,24 +3643,24 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_DEFS] = rb_cDEFS; rb_iv_set(rb_cDEFS, "__member__", members); rb_iv_set(rb_cDEFS, "__type__", INT2NUM(NODE_DEFS)); rb_define_singleton_method(rb_cDEFS, "members", node_s_members, 0); - - /* Document-method: mid - * the name of the method* defn the body of the method - */ - rb_define_method(rb_cDEFS, "mid", node_mid, 0); - rb_ary_push(members, rb_str_new2("mid")); rb_define_method(rb_cDEFS, "defn", node_defn, 0); rb_ary_push(members, rb_str_new2("defn")); /* Document-method: recv * the object to whose singleton class the new method is to be added */ rb_define_method(rb_cDEFS, "recv", node_recv, 0); rb_ary_push(members, rb_str_new2("recv")); + + /* Document-method: mid + * the name of the method* defn the body of the method + */ + rb_define_method(rb_cDEFS, "mid", node_mid, 0); + rb_ary_push(members, rb_str_new2("mid")); } /* Document-class: Node::DOT2 * Represents a range created with the form: * beg..end @@ -3672,23 +3672,23 @@ rb_cNodeSubclass[NODE_DOT2] = rb_cDOT2; rb_iv_set(rb_cDOT2, "__member__", members); rb_iv_set(rb_cDOT2, "__type__", INT2NUM(NODE_DOT2)); rb_define_singleton_method(rb_cDOT2, "members", node_s_members, 0); + /* Document-method: beg + * the beginning of the range + */ + rb_define_method(rb_cDOT2, "beg", node_beg, 0); + rb_ary_push(members, rb_str_new2("beg")); + /* Document-method: end * the end of the range */ rb_define_method(rb_cDOT2, "end", node_end, 0); rb_ary_push(members, rb_str_new2("end")); rb_define_method(rb_cDOT2, "state", node_state, 0); rb_ary_push(members, rb_str_new2("state")); - - /* Document-method: beg - * the beginning of the range - */ - rb_define_method(rb_cDOT2, "beg", node_beg, 0); - rb_ary_push(members, rb_str_new2("beg")); } /* Document-class: Node::DOT3 * Represents a range created with the form: * beg...end @@ -3700,23 +3700,23 @@ rb_cNodeSubclass[NODE_DOT3] = rb_cDOT3; rb_iv_set(rb_cDOT3, "__member__", members); rb_iv_set(rb_cDOT3, "__type__", INT2NUM(NODE_DOT3)); rb_define_singleton_method(rb_cDOT3, "members", node_s_members, 0); + /* Document-method: beg + * the beginning of the range + */ + rb_define_method(rb_cDOT3, "beg", node_beg, 0); + rb_ary_push(members, rb_str_new2("beg")); + /* Document-method: end * the end of the range */ rb_define_method(rb_cDOT3, "end", node_end, 0); rb_ary_push(members, rb_str_new2("end")); rb_define_method(rb_cDOT3, "state", node_state, 0); rb_ary_push(members, rb_str_new2("state")); - - /* Document-method: beg - * the beginning of the range - */ - rb_define_method(rb_cDOT3, "beg", node_beg, 0); - rb_ary_push(members, rb_str_new2("beg")); } /* Document-class: Node::DREGX * Represents a regular expresion with interpolation. The node is * evaluated by duplicating the regex stored in the 'lit' element, then @@ -3737,10 +3737,16 @@ * a string */ rb_define_method(rb_cDREGX, "lit", node_lit, 0); rb_ary_push(members, rb_str_new2("lit")); + /* Document-method: next + * a list of expressions to be appended onto the string + */ + rb_define_method(rb_cDREGX, "next", node_next, 0); + rb_ary_push(members, rb_str_new2("next")); + /* Document-method: cflag * a bitfield containing the options used in the regular * expression. Valid values include: * * RE_OPTION_IGNORECASE * * RE_OPTION_EXTENDED @@ -3753,16 +3759,10 @@ * * RE_OPTIMIZE_NO_BM * * RE_OPTIMIZE_BMATCH */ rb_define_method(rb_cDREGX, "cflag", node_cflag, 0); rb_ary_push(members, rb_str_new2("cflag")); - - /* Document-method: next - * a list of expressions to be appended onto the string - */ - rb_define_method(rb_cDREGX, "next", node_next, 0); - rb_ary_push(members, rb_str_new2("next")); } /* Document-class: Node::DREGX_ONCE * Represents a regular expression with interpolation with the 'once' * flag set. The regular expression is only interpolated the first @@ -3780,22 +3780,22 @@ * a string */ rb_define_method(rb_cDREGX_ONCE, "lit", node_lit, 0); rb_ary_push(members, rb_str_new2("lit")); + /* Document-method: next + * a list of expressions to be appended onto the string + */ + rb_define_method(rb_cDREGX_ONCE, "next", node_next, 0); + rb_ary_push(members, rb_str_new2("next")); + /* Document-method: cflag * a bitfield containing the options used in the regular * expression. See DREGX for a list of valid values. */ rb_define_method(rb_cDREGX_ONCE, "cflag", node_cflag, 0); rb_ary_push(members, rb_str_new2("cflag")); - - /* Document-method: next - * a list of expressions to be appended onto the string - */ - rb_define_method(rb_cDREGX_ONCE, "next", node_next, 0); - rb_ary_push(members, rb_str_new2("next")); } /* Document-class: Node::DSTR * Represents a string object with interpolation. The node is * evaluated by duplicating the string stored in the 'lit' element, @@ -3983,21 +3983,21 @@ rb_cNodeSubclass[NODE_FCALL] = rb_cFCALL; rb_iv_set(rb_cFCALL, "__member__", members); rb_iv_set(rb_cFCALL, "__type__", INT2NUM(NODE_FCALL)); rb_define_singleton_method(rb_cFCALL, "members", node_s_members, 0); - /* Document-method: mid - * the method id - */ - rb_define_method(rb_cFCALL, "mid", node_mid, 0); - rb_ary_push(members, rb_str_new2("mid")); - /* Document-method: args * the arguments to the method */ rb_define_method(rb_cFCALL, "args", node_args, 0); rb_ary_push(members, rb_str_new2("args")); + + /* Document-method: mid + * the method id + */ + rb_define_method(rb_cFCALL, "mid", node_mid, 0); + rb_ary_push(members, rb_str_new2("mid")); } /* Document-class: Node::FLIP2 * Represents part of an awk-like flip-flop expression of the form: * if beg..end then @@ -4017,21 +4017,21 @@ * to use in the flip-flop expression (usually 2 for $_) */ rb_define_method(rb_cFLIP2, "cnt", node_cnt, 0); rb_ary_push(members, rb_str_new2("cnt")); - /* Document-method: end - * the end of the range - */ - rb_define_method(rb_cFLIP2, "end", node_end, 0); - rb_ary_push(members, rb_str_new2("end")); - /* Document-method: beg * the beginning of the range */ rb_define_method(rb_cFLIP2, "beg", node_beg, 0); rb_ary_push(members, rb_str_new2("beg")); + + /* Document-method: end + * the end of the range + */ + rb_define_method(rb_cFLIP2, "end", node_end, 0); + rb_ary_push(members, rb_str_new2("end")); } /* Document-class: Node::FLIP3 * Represents part of a sed-like flip-flop expression of the form: * if beg..end then @@ -4051,21 +4051,21 @@ * to use in the flip-flop expression (usually 2 for $_) */ rb_define_method(rb_cFLIP3, "cnt", node_cnt, 0); rb_ary_push(members, rb_str_new2("cnt")); - /* Document-method: end - * the end of the range - */ - rb_define_method(rb_cFLIP3, "end", node_end, 0); - rb_ary_push(members, rb_str_new2("end")); - /* Document-method: beg * the beginning of the range */ rb_define_method(rb_cFLIP3, "beg", node_beg, 0); rb_ary_push(members, rb_str_new2("beg")); + + /* Document-method: end + * the end of the range + */ + rb_define_method(rb_cFLIP3, "end", node_end, 0); + rb_ary_push(members, rb_str_new2("end")); } /* Document-class: Node::FOR * Represents a loop constructed with the 'for' keyword, e.g.: * for var in iter do @@ -4086,22 +4086,22 @@ rb_cNodeSubclass[NODE_FOR] = rb_cFOR; rb_iv_set(rb_cFOR, "__member__", members); rb_iv_set(rb_cFOR, "__type__", INT2NUM(NODE_FOR)); rb_define_singleton_method(rb_cFOR, "members", node_s_members, 0); - /* Document-method: iter - * the sequence over which to iterate - */ - rb_define_method(rb_cFOR, "iter", node_iter, 0); - rb_ary_push(members, rb_str_new2("iter")); - /* Document-method: body * the body of the loop */ rb_define_method(rb_cFOR, "body", node_body, 0); rb_ary_push(members, rb_str_new2("body")); + /* Document-method: iter + * the sequence over which to iterate + */ + rb_define_method(rb_cFOR, "iter", node_iter, 0); + rb_ary_push(members, rb_str_new2("iter")); + /* Document-method: var * an assignment node which assigns the next value in the sequence * to a variable, which may or may not be local. May also be a * multiple assignment. */ @@ -4118,23 +4118,23 @@ rb_cNodeSubclass[NODE_GASGN] = rb_cGASGN; rb_iv_set(rb_cGASGN, "__member__", members); rb_iv_set(rb_cGASGN, "__type__", INT2NUM(NODE_GASGN)); rb_define_singleton_method(rb_cGASGN, "members", node_s_members, 0); + /* Document-method: value + * an expression whose result is the new value of the global variable + */ + rb_define_method(rb_cGASGN, "value", node_value, 0); + rb_ary_push(members, rb_str_new2("value")); + /* Document-method: vid * the name of the global variable, with a leading '$' character. */ rb_define_method(rb_cGASGN, "vid", node_vid, 0); rb_ary_push(members, rb_str_new2("vid")); rb_define_method(rb_cGASGN, "entry", node_entry, 0); rb_ary_push(members, rb_str_new2("entry")); - - /* Document-method: value - * an expression whose result is the new value of the global variable - */ - rb_define_method(rb_cGASGN, "value", node_value, 0); - rb_ary_push(members, rb_str_new2("value")); } /* Document-class: Node::GVAR * Represents global variable retrieval. */ @@ -4183,21 +4183,21 @@ rb_cNodeSubclass[NODE_IASGN] = rb_cIASGN; rb_iv_set(rb_cIASGN, "__member__", members); rb_iv_set(rb_cIASGN, "__type__", INT2NUM(NODE_IASGN)); rb_define_singleton_method(rb_cIASGN, "members", node_s_members, 0); - /* Document-method: vid - * the name of the instance variable, with a leading '@' sign - */ - rb_define_method(rb_cIASGN, "vid", node_vid, 0); - rb_ary_push(members, rb_str_new2("vid")); - /* Document-method: value * the value to assign to the instance variable */ rb_define_method(rb_cIASGN, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: vid + * the name of the instance variable, with a leading '@' sign + */ + rb_define_method(rb_cIASGN, "vid", node_vid, 0); + rb_ary_push(members, rb_str_new2("vid")); } /* Document-class: Node::IF * Represents a conditional of the form: * if cond then @@ -4216,32 +4216,33 @@ * the expression evaluated, or nil if there was no expression * present. * * A conditional block using elsif has another IF node as the else * expression. + * */ { VALUE rb_cIF = rb_define_class_under(rb_cNode, "IF", rb_cNode); members = rb_ary_new(); rb_cNodeSubclass[NODE_IF] = rb_cIF; rb_iv_set(rb_cIF, "__member__", members); rb_iv_set(rb_cIF, "__type__", INT2NUM(NODE_IF)); rb_define_singleton_method(rb_cIF, "members", node_s_members, 0); + /* Document-method: cond + * the condition to evaluate + */ + rb_define_method(rb_cIF, "cond", node_cond, 0); + rb_ary_push(members, rb_str_new2("cond")); + /* Document-method: body * the expression to evaluate if the expression is true, or false * if the expression is empty */ rb_define_method(rb_cIF, "body", node_body, 0); rb_ary_push(members, rb_str_new2("body")); - /* Document-method: cond - * the condition to evaluate - */ - rb_define_method(rb_cIF, "cond", node_cond, 0); - rb_ary_push(members, rb_str_new2("cond")); - /* Document-method: else * the expression to evaluate if the expression is false, or false * if the expression is empty */ rb_define_method(rb_cIF, "else", node_else, 0); @@ -4257,16 +4258,10 @@ rb_cNodeSubclass[NODE_IFUNC] = rb_cIFUNC; rb_iv_set(rb_cIFUNC, "__member__", members); rb_iv_set(rb_cIFUNC, "__type__", INT2NUM(NODE_IFUNC)); rb_define_singleton_method(rb_cIFUNC, "members", node_s_members, 0); - /* Document-method: state - * always 0 - */ - rb_define_method(rb_cIFUNC, "state", node_state, 0); - rb_ary_push(members, rb_str_new2("state")); - /* Document-method: cfnc * a pointer to the C function to which to yield */ rb_define_method(rb_cIFUNC, "cfnc", node_cfnc, 0); rb_ary_push(members, rb_str_new2("cfnc")); @@ -4275,10 +4270,16 @@ * the user-specified data to be passed as the second argument to * cfnc */ rb_define_method(rb_cIFUNC, "tval", node_tval, 0); rb_ary_push(members, rb_str_new2("tval")); + + /* Document-method: state + * always 0 + */ + rb_define_method(rb_cIFUNC, "state", node_state, 0); + rb_ary_push(members, rb_str_new2("state")); } /* Document-class: Node::ITER * Represents an iteration loop, e.g.: * iter do |*args| @@ -4298,23 +4299,23 @@ rb_cNodeSubclass[NODE_ITER] = rb_cITER; rb_iv_set(rb_cITER, "__member__", members); rb_iv_set(rb_cITER, "__type__", INT2NUM(NODE_ITER)); rb_define_singleton_method(rb_cITER, "members", node_s_members, 0); + /* Document-method: body + * the body of the loop + */ + rb_define_method(rb_cITER, "body", node_body, 0); + rb_ary_push(members, rb_str_new2("body")); + /* Document-method: iter * an expression which calls the desired iteration method, usually * recv.each */ rb_define_method(rb_cITER, "iter", node_iter, 0); rb_ary_push(members, rb_str_new2("iter")); - /* Document-method: body - * the body of the loop - */ - rb_define_method(rb_cITER, "body", node_body, 0); - rb_ary_push(members, rb_str_new2("body")); - /* Document-method: var * an assignment node which assigns the next value in the sequence * to a variable, which may or may not be local. May also be a * multiple assignment. */ @@ -4351,24 +4352,24 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_LASGN] = rb_cLASGN; rb_iv_set(rb_cLASGN, "__member__", members); rb_iv_set(rb_cLASGN, "__type__", INT2NUM(NODE_LASGN)); rb_define_singleton_method(rb_cLASGN, "members", node_s_members, 0); - rb_define_method(rb_cLASGN, "cnt", node_cnt, 0); - rb_ary_push(members, rb_str_new2("cnt")); - /* Document-method: vid - * the name of the local variable - */ - rb_define_method(rb_cLASGN, "vid", node_vid, 0); - rb_ary_push(members, rb_str_new2("vid")); - /* Document-method: value * the value to assign to the local variable */ rb_define_method(rb_cLASGN, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: vid + * the name of the local variable + */ + rb_define_method(rb_cLASGN, "vid", node_vid, 0); + rb_ary_push(members, rb_str_new2("vid")); + rb_define_method(rb_cLASGN, "cnt", node_cnt, 0); + rb_ary_push(members, rb_str_new2("cnt")); } /* Document-class: Node::LIT * Represents a literal object. The result of the expression is the * object contained in this node. @@ -4396,18 +4397,18 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_LVAR] = rb_cLVAR; rb_iv_set(rb_cLVAR, "__member__", members); rb_iv_set(rb_cLVAR, "__type__", INT2NUM(NODE_LVAR)); rb_define_singleton_method(rb_cLVAR, "members", node_s_members, 0); - rb_define_method(rb_cLVAR, "cnt", node_cnt, 0); - rb_ary_push(members, rb_str_new2("cnt")); /* Document-method: vid * the name of the local variable to retrieve. */ rb_define_method(rb_cLVAR, "vid", node_vid, 0); rb_ary_push(members, rb_str_new2("vid")); + rb_define_method(rb_cLVAR, "cnt", node_cnt, 0); + rb_ary_push(members, rb_str_new2("cnt")); } /* Document-class: Node::MASGN * Represents multiple assignment. */ @@ -4417,22 +4418,22 @@ rb_cNodeSubclass[NODE_MASGN] = rb_cMASGN; rb_iv_set(rb_cMASGN, "__member__", members); rb_iv_set(rb_cMASGN, "__type__", INT2NUM(NODE_MASGN)); rb_define_singleton_method(rb_cMASGN, "members", node_s_members, 0); - /* Document-method: head - * TODO - */ - rb_define_method(rb_cMASGN, "head", node_head, 0); - rb_ary_push(members, rb_str_new2("head")); - /* Document-method: args * TODO */ rb_define_method(rb_cMASGN, "args", node_args, 0); rb_ary_push(members, rb_str_new2("args")); + /* Document-method: head + * TODO + */ + rb_define_method(rb_cMASGN, "head", node_head, 0); + rb_ary_push(members, rb_str_new2("head")); + /* Document-method: value * TODO */ rb_define_method(rb_cMASGN, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); @@ -4582,21 +4583,21 @@ rb_cNodeSubclass[NODE_MODULE] = rb_cMODULE; rb_iv_set(rb_cMODULE, "__member__", members); rb_iv_set(rb_cMODULE, "__type__", INT2NUM(NODE_MODULE)); rb_define_singleton_method(rb_cMODULE, "members", node_s_members, 0); - /* Document-method: body - * the body of the module definition - */ - rb_define_method(rb_cMODULE, "body", node_body, 0); - rb_ary_push(members, rb_str_new2("body")); - /* Document-method: cpath * the name of the module to define */ rb_define_method(rb_cMODULE, "cpath", node_cpath, 0); rb_ary_push(members, rb_str_new2("cpath")); + + /* Document-method: body + * the body of the module definition + */ + rb_define_method(rb_cMODULE, "body", node_body, 0); + rb_ary_push(members, rb_str_new2("body")); } /* Document-class: Node::NEXT * Represents the 'next' keyword. * Causes control to be transferred to the end of the loop, causing the @@ -4634,21 +4635,21 @@ rb_cNodeSubclass[NODE_NTH_REF] = rb_cNTH_REF; rb_iv_set(rb_cNTH_REF, "__member__", members); rb_iv_set(rb_cNTH_REF, "__type__", INT2NUM(NODE_NTH_REF)); rb_define_singleton_method(rb_cNTH_REF, "members", node_s_members, 0); - /* Document-method: cnt - * the index into the local variable table where the match data is stored - */ - rb_define_method(rb_cNTH_REF, "cnt", node_cnt, 0); - rb_ary_push(members, rb_str_new2("cnt")); - /* Document-method: nth * the index of the match data item to retrieve */ rb_define_method(rb_cNTH_REF, "nth", node_nth, 0); rb_ary_push(members, rb_str_new2("nth")); + + /* Document-method: cnt + * the index into the local variable table where the match data is stored + */ + rb_define_method(rb_cNTH_REF, "cnt", node_cnt, 0); + rb_ary_push(members, rb_str_new2("cnt")); } /* Document-class: Node::OPT_N * Represents the top-level loop when the -n or -p options are used * with the interpreter. @@ -4697,10 +4698,16 @@ rb_cNodeSubclass[NODE_OP_ASGN1] = rb_cOP_ASGN1; rb_iv_set(rb_cOP_ASGN1, "__member__", members); rb_iv_set(rb_cOP_ASGN1, "__type__", INT2NUM(NODE_OP_ASGN1)); rb_define_singleton_method(rb_cOP_ASGN1, "members", node_s_members, 0); + /* Document-method: args + * the arguments to the assigment + */ + rb_define_method(rb_cOP_ASGN1, "args", node_args, 0); + rb_ary_push(members, rb_str_new2("args")); + /* Document-method: mid * 0, 1, or the name a method to call to calculate the value of the * rhs */ rb_define_method(rb_cOP_ASGN1, "mid", node_mid, 0); @@ -4709,16 +4716,10 @@ /* Document-method: recv * the receiver of the assignment */ rb_define_method(rb_cOP_ASGN1, "recv", node_recv, 0); rb_ary_push(members, rb_str_new2("recv")); - - /* Document-method: args - * the arguments to the assigment - */ - rb_define_method(rb_cOP_ASGN1, "args", node_args, 0); - rb_ary_push(members, rb_str_new2("args")); } /* Document-class: Node::OP_ASGN2 * Represents attribute assignment of the form: * recv.attr op value @@ -4770,18 +4771,10 @@ rb_cNodeSubclass[NODE_OP_ASGN2_ARG] = rb_cOP_ASGN2_ARG; rb_iv_set(rb_cOP_ASGN2_ARG, "__member__", members); rb_iv_set(rb_cOP_ASGN2_ARG, "__type__", INT2NUM(NODE_OP_ASGN2_ARG)); rb_define_singleton_method(rb_cOP_ASGN2_ARG, "members", node_s_members, 0); - /* Document-method: mid - * The operation to apply to the attribute before setting it. May - * be 0 (false) to indicate "logical or" or 1 (nil) to indicate - * "logical and". - */ - rb_define_method(rb_cOP_ASGN2_ARG, "mid", node_mid, 0); - rb_ary_push(members, rb_str_new2("mid")); - /* Document-method: vid * The method to call on the receiver to retrieve the attribute */ rb_define_method(rb_cOP_ASGN2_ARG, "vid", node_vid, 0); rb_ary_push(members, rb_str_new2("vid")); @@ -4789,10 +4782,18 @@ /* Document-method: aid * The method to call on the receiver to set the attribute */ rb_define_method(rb_cOP_ASGN2_ARG, "aid", node_aid, 0); rb_ary_push(members, rb_str_new2("aid")); + + /* Document-method: mid + * The operation to apply to the attribute before setting it. May + * be 0 (false) to indicate "logical or" or 1 (nil) to indicate + * "logical and". + */ + rb_define_method(rb_cOP_ASGN2_ARG, "mid", node_mid, 0); + rb_ary_push(members, rb_str_new2("mid")); } /* Document-class: Node::OP_ASGN_AND * Represents an expression of the form: * recv &&= value @@ -4837,16 +4838,10 @@ rb_cNodeSubclass[NODE_OP_ASGN_OR] = rb_cOP_ASGN_OR; rb_iv_set(rb_cOP_ASGN_OR, "__member__", members); rb_iv_set(rb_cOP_ASGN_OR, "__type__", INT2NUM(NODE_OP_ASGN_OR)); rb_define_singleton_method(rb_cOP_ASGN_OR, "members", node_s_members, 0); - /* Document-method: recv - * the receiver of the assignment - */ - rb_define_method(rb_cOP_ASGN_OR, "recv", node_recv, 0); - rb_ary_push(members, rb_str_new2("recv")); - /* Document-method: aid * if this indicator is nonzero, ruby will check to see if the * provided expression is defined, otherwise it will assume that * the provided expression is defined. */ @@ -4856,10 +4851,16 @@ /* Document-method: value * the right hand side of the assignment */ rb_define_method(rb_cOP_ASGN_OR, "value", node_value, 0); rb_ary_push(members, rb_str_new2("value")); + + /* Document-method: recv + * the receiver of the assignment + */ + rb_define_method(rb_cOP_ASGN_OR, "recv", node_recv, 0); + rb_ary_push(members, rb_str_new2("recv")); } /* Document-class: Node::OR * Represents a logical 'or' of the form: * first || second @@ -5097,24 +5098,24 @@ rb_cNodeSubclass[NODE_SCOPE] = rb_cSCOPE; rb_iv_set(rb_cSCOPE, "__member__", members); rb_iv_set(rb_cSCOPE, "__type__", INT2NUM(NODE_SCOPE)); rb_define_singleton_method(rb_cSCOPE, "members", node_s_members, 0); - /* Document-method: rval - * holds information about which class(es) to search for constants - * in this scope - */ - rb_define_method(rb_cSCOPE, "rval", node_rval, 0); - rb_ary_push(members, rb_str_new2("rval")); - /* Document-method: tbl * the names of the local variables* next the first expression in * the scope */ rb_define_method(rb_cSCOPE, "tbl", node_tbl, 0); rb_ary_push(members, rb_str_new2("tbl")); + /* Document-method: rval + * holds information about which class(es) to search for constants + * in this scope + */ + rb_define_method(rb_cSCOPE, "rval", node_rval, 0); + rb_ary_push(members, rb_str_new2("rval")); + /* Document-method: next * the body of the lexical scope */ rb_define_method(rb_cSCOPE, "next", node_next, 0); rb_ary_push(members, rb_str_new2("next")); @@ -5257,12 +5258,10 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_UNTIL] = rb_cUNTIL; rb_iv_set(rb_cUNTIL, "__member__", members); rb_iv_set(rb_cUNTIL, "__type__", INT2NUM(NODE_UNTIL)); rb_define_singleton_method(rb_cUNTIL, "members", node_s_members, 0); - rb_define_method(rb_cUNTIL, "state", node_state, 0); - rb_ary_push(members, rb_str_new2("state")); /* Document-method: body * the body of the loop */ rb_define_method(rb_cUNTIL, "body", node_body, 0); @@ -5271,10 +5270,12 @@ /* Document-method: cond * a condition to terminate the loop when it becomes true */ rb_define_method(rb_cUNTIL, "cond", node_cond, 0); rb_ary_push(members, rb_str_new2("cond")); + rb_define_method(rb_cUNTIL, "state", node_state, 0); + rb_ary_push(members, rb_str_new2("state")); } /* Document-class: Node::VALIAS * Represents an alias expression of the form: * alias 1st 2nd @@ -5286,14 +5287,14 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_VALIAS] = rb_cVALIAS; rb_iv_set(rb_cVALIAS, "__member__", members); rb_iv_set(rb_cVALIAS, "__type__", INT2NUM(NODE_VALIAS)); rb_define_singleton_method(rb_cVALIAS, "members", node_s_members, 0); - rb_define_method(rb_cVALIAS, "second", node_2nd, 0); - rb_ary_push(members, rb_str_new2("second")); rb_define_method(rb_cVALIAS, "first", node_1st, 0); rb_ary_push(members, rb_str_new2("first")); + rb_define_method(rb_cVALIAS, "second", node_2nd, 0); + rb_ary_push(members, rb_str_new2("second")); } /* Document-class: Node::VCALL * Represents a local variable or a method call without an explicit * receiver, to be determined at run-time. @@ -5381,12 +5382,10 @@ members = rb_ary_new(); rb_cNodeSubclass[NODE_WHILE] = rb_cWHILE; rb_iv_set(rb_cWHILE, "__member__", members); rb_iv_set(rb_cWHILE, "__type__", INT2NUM(NODE_WHILE)); rb_define_singleton_method(rb_cWHILE, "members", node_s_members, 0); - rb_define_method(rb_cWHILE, "state", node_state, 0); - rb_ary_push(members, rb_str_new2("state")); /* Document-method: body * the body of the loop */ rb_define_method(rb_cWHILE, "body", node_body, 0); @@ -5395,9 +5394,11 @@ /* Document-method: cond * a condition to terminate the loop when it becomes false */ rb_define_method(rb_cWHILE, "cond", node_cond, 0); rb_ary_push(members, rb_str_new2("cond")); + rb_define_method(rb_cWHILE, "state", node_state, 0); + rb_ary_push(members, rb_str_new2("state")); } /* Document-class: Node::XSTR * Represents a string object inside backticks, e.g.: * `lit`