Skip to content

Instantly share code, notes, and snippets.

@JacobNinja
Created October 10, 2012 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JacobNinja/3868668 to your computer and use it in GitHub Desktop.
Save JacobNinja/3868668 to your computer and use it in GitHub Desktop.
Parsing the parser
p SexpBuilder.parse File.read(__FILE__) if $0 == __FILE__
# => [s(:call, nil, :require, s(:str, "sexp_processor")), s(:call, nil, :require, s(:str, "ripper")), s(:call, nil, :require, s(:call, s(:const, :File), :expand_path, s(:str, "./../nodes/all"), s(:str, "(string)"))), s(:class, :SexpBuilder, s(:colon2, s(:const, :Ripper), :SexpBuilderPP), s(:defs, s(:self), :parse, s(:args, :code, :filename, s(:block, s(:lasgn, :filename, s(:str, "(string)")))), s(:lasgn, :ast, [:super, [s(:lvar, :code), s(:lvar, :filename)]]), s(:call, s(:lvar, :ast), :[], s(:lit, 1))), s(:cdecl, :KEYWORDS, s(:array, s(:str, "true"), s(:str, "false"), s(:str, "self"), s(:str, "nil"))), s(:cdecl, :BINARY, s(:hash, s(:lit, :"&&"), s(:colon2, s(:const, :Nodes), :BooleanAnd), s(:lit, :and), s(:colon2, s(:const, :Nodes), :LogicalAnd), s(:lit, :"||"), s(:colon2, s(:const, :Nodes), :BooleanOr), s(:lit, :or), s(:colon2, s(:const, :Nodes), :LogicalOr), s(:lit, :"||="), s(:colon2, s(:const, :Nodes), :OptionalAssignment))), s(:cdecl, :MAGIC_VARIABLES, s(:hash, s(:str, "__FILE__"), s(:lit, :filename))), s(:defn, :on_assign, s(:args, :"*nodes"), s(:lasgn, :var_name, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :var_value, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:if, s(:call, s(:lvar, :var_name), :is_a?, s(:colon2, s(:const, :Nodes), :Constant)), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :ConstantAssignment), :new, s(:lvar, :var_name), s(:lvar, :var_value)), :to_sexp), [:elsif, s(:call, s(:lvar, :var_name), :is_a?, s(:colon2, s(:const, :Nodes), :ArefField)), [s(:call, s(:call, s(:colon2, s(:const, :Nodes), :AttributeAssignment), :new, s(:call, s(:lvar, :var_name), :receiver), s(:lit, :[]=), s(:call, s(:lvar, :var_name), :index), s(:lvar, :var_value)), :to_sexp)], [:elsif, s(:call, s(:lvar, :var_name), :is_a?, s(:colon2, s(:const, :Nodes), :Field)), [s(:call, s(:call, s(:colon2, s(:const, :Nodes), :AttributeAssignment), :new, s(:call, s(:lvar, :var_name), :receiver), s(:dstr, "", s(:evstr, s(:call, s(:lvar, :var_name), :name)), s(:str, "=")), s(:nil), s(:lvar, :var_value)), :to_sexp)], [:elsif, s(:call, s(:lvar, :var_name), :is_a?, s(:colon2, s(:const, :Nodes), :InstanceVariable)), [s(:call, s(:call, s(:colon2, s(:const, :Nodes), :InstanceVariableAssignment), :new, s(:lvar, :var_name), s(:lvar, :var_value)), :to_sexp)], [:elsif, s(:call, s(:lvar, :var_name), :is_a?, s(:colon2, s(:const, :Nodes), :ClassVariable)), [s(:call, s(:call, s(:colon2, s(:const, :Nodes), :ClassVariableAssignment), :new, s(:lvar, :var_name), s(:lvar, :var_value)), :to_sexp)], nil]]]])), s(:defn, :on_massign, s(:args, :"*nodes"), s(:lasgn, :vars, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :values, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :params, s(:call, s(:colon2, s(:const, :Nodes), :AssignmentParameters), :extract_from_params, s(:lvar, :vars))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :MultipleAssignment), :new, s(:lvar, :params), s(:lvar, :values)), :to_sexp)), s(:defn, :on_opassign, s(:args, :"*nodes"), s(:lasgn, :ident, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :operation, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :args, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:lasgn, :binary_operation, s(:call, s(:const, :BINARY), :[], s(:call, s(:lvar, :operation), :to_sym))), s(:if, s(:lvar, :binary_operation), s(:call, s(:lvar, :binary_operation), :new, s(:lvar, :ident), s(:lvar, :args)), nil)), s(:defn, :on_class, s(:args, :"*nodes"), s(:lasgn, :class_name_node, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :class_name, s(:call, s(:lvar, :class_name_node), :ident)), s(:lasgn, :parent, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Class), :new, s(:lvar, :class_name), s(:lvar, :parent), s(:lvar, :body)), :to_sexp)), s(:defn, :on_fcall, s(:args, :"*nodes"), s(:lasgn, :method_name, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :method_name_ident, s(:if, s(:call, s(:lvar, :method_name), :is_a?, s(:colon2, s(:const, :Nodes), :Constant)), s(:call, s(:lvar, :method_name), :ident), s(:lvar, :method_name))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Call), :new, s(:nil), s(:lvar, :method_name_ident)), :to_sexp)), s(:defn, :on_call, s(:args, :"*nodes"), s(:lasgn, :receiver, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :call_type, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :method_name, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Call), :new, s(:lvar, :receiver), s(:lvar, :method_name)), :to_sexp)), s(:defn, :on_vcall, s(:args, :"*nodes"), s(:lasgn, :method_name, s(:call, s(:lvar, :nodes), :first)), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Call), :new, s(:nil), s(:lvar, :method_name)), :to_sexp)), s(:defn, :on_command_call, s(:args, :"*nodes"), s(:lasgn, :receiver, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :call_type, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :method_name, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:lasgn, :args, s(:call, s(:lvar, :nodes), :[], s(:lit, 3))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Call), :new, s(:lvar, :receiver), s(:lvar, :method_name), s(:lvar, :args)), :to_sexp)), s(:defn, :on_command, s(:args, :"*nodes"), s(:lasgn, :method_name, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :args, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Call), :new, s(:nil), s(:lvar, :method_name), s(:lvar, :args)), :to_sexp)), s(:defn, :on_binary, s(:args, :"*nodes"), s(:masgn, s(:array, s(:lasgn, :receiver), s(:lasgn, :operation), s(:lasgn, :args)), s(:to_ary, s(:lvar, :nodes))), s(:lasgn, :method_name, s(:call, s(:colon2, s(:const, :Nodes), :Ident), :new, s(:call, s(:lvar, :operation), :to_s), s(:call, s(:lvar, :receiver), :line))), s(:lasgn, :binary_operation, s(:call, s(:const, :BINARY), :[], s(:lvar, :operation))), s(:if, s(:lvar, :binary_operation), s(:call, s(:call, s(:lvar, :binary_operation), :new, s(:lvar, :receiver), s(:lvar, :args)), :to_sexp), nil)), s(:defn, :on_def, s(:args, :"*nodes"), s(:lasgn, :params, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :method_name, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:lasgn, :args, s(:call, s(:colon2, s(:const, :Nodes), :Arguments), :new, s(:lvar, :params))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Function), :new, s(:lvar, :method_name), s(:call, s(:lvar, :args), :to_sexp), s(:lvar, :body)), :to_sexp)), s(:defn, :on_defs, s(:args, :"*nodes"), s(:lasgn, :receiver, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :method_name, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:lasgn, :params, s(:call, s(:lvar, :nodes), :[], s(:lit, 3))), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 4))), s(:lasgn, :args, s(:call, s(:colon2, s(:const, :Nodes), :Arguments), :new, s(:lvar, :params))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :ClassFunction), :new, s(:call, s(:lvar, :receiver), :to_sexp), s(:lvar, :method_name), s(:call, s(:lvar, :args), :to_sexp), s(:lvar, :body)), :to_sexp)), s(:defn, :on_paren, s(:args, :"*nodes"), s(:lasgn, :node, s(:call, s(:lvar, :nodes), :first)), s(:while, s(:and, s(:call, s(:lvar, :node), :is_a?, #<Nodes::Constant:0x00000102bba7a8 @ident="Array">), s(:call, s(:call, s(:lvar, :node), :length), :==, s(:lit, 1))), s(:lasgn, :node, s(:call, s(:lvar, :node), :first)), true), s(:lvar, :node)), s(:defn, :on_bodystmt, s(:args, :"*nodes"), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :rescue_node, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :BodyStmt), :new, s(:lvar, :body), s(:lvar, :rescue_node)), :to_sexp)), s(:defn, :on_method_add_arg, s(:args, :"*nodes"), s(:lasgn, :call_ast, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :call_nodes, s(:call, nil, :Array, s(:call, s(:lvar, :nodes), :[], s(:lit, 1)))), s(:call, s(:lvar, :call_ast), :push, :args_add_star, [], s(:lvar, :call_nodes)), s(:lvar, :call_ast)), s(:defn, :on_rescue, s(:args, :"*nodes"), s(:lasgn, :exception_types, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :ident, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :body, s(:call, s(:call, s(:colon2, s(:const, :Nodes), :BodyStmt), :new, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), :to_sexp)), s(:call, s(:colon2, s(:const, :Nodes), :Rescue), :new, s(:lvar, :ident), s(:lvar, :body), s(:lvar, :exception_types))), s(:defn, :on_rescue_mod, s(:args, :"*nodes"), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :args, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Rescue), :new, s(:nil), s(:array, s(:lvar, :args))), :to_sexp, s(:array, s(:lvar, :body)))), s(:defn, :on_method_add_block, s(:args, :"*nodes"), s(:lasgn, :call_ast, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :body, s(:call, s(:colon2, s(:const, :Nodes), :BodyStmt), :new, s(:call, s(:lvar, :nodes), :[], s(:lit, 1)))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Block), :new, s(:lvar, :call_ast), s(:lvar, :body)), :to_sexp)), s(:defn, :on_block_var, s(:args, :"*nodes"), s(:lasgn, :block_params, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :splat, s(:if, s(:call, s(:call, s(:lvar, :block_params), :rest), :empty?), s(:nil), s(:call, s(:lvar, :block_params), :rest))), s(:lasgn, :assignment_params, s(:call, s(:colon2, s(:const, :Nodes), :AssignmentParameters), :new, s(:call, s(:lvar, :block_params), :positional), s(:lvar, :splat))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :BlockVariables), :new, s(:lvar, :assignment_params)), :to_sexp)), s(:defn, :on_brace_block, s(:args, :"*nodes"), s(:lasgn, :block_var, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:array, s(:lvar, :block_var), s(:call, s(:lvar, :body), :[], s(:lit, 0)))), s(:defn, :on_do_block, s(:args, :"*nodes"), s(:call, nil, :on_brace_block, :args_add_star, [], s(:lvar, :nodes))), s(:defn, :on_begin, s(:args, :"*nodes"), s(:call, s(:call, s(:lvar, :nodes), :[], s(:lit, 0)), :[], s(:lit, 0))), s(:defn, :on_arg_paren, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_args_add_block, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_mlhs_add_star, s(:args, :"*nodes"), s(:lasgn, :positional, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :splat, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:array, s(:lvar, :positional), s(:lvar, :splat))), s(:defn, :on_mrhs_new_from_args, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_mlhs_paren, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_params, s(:args, :"*nodes"), s(:lasgn, :positional_args, s(:call, nil, :Array, s(:call, s(:lvar, :nodes), :first))), s(:lasgn, :default_args, s(:call, nil, :Array, s(:call, s(:lvar, :nodes), :[], s(:lit, 1)))), s(:lasgn, :rest_args, s(:call, s(:call, nil, :Array, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), :drop, s(:lit, 1))), s(:call, s(:colon2, s(:const, :Nodes), :Parameters), :new, s(:lvar, :positional_args), s(:lvar, :default_args), s(:lvar, :rest_args), s(:call, nil, :lineno))), s(:defn, :on_int, s(:args, :"*nodes"), s(:lasgn, :value, s(:call, s(:call, s(:lvar, :nodes), :first), :to_i)), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Literal), :new, s(:lvar, :value)), :to_sexp)), s(:defn, :on_var_ref, s(:args, :"*nodes"), s(:lasgn, :var, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :magic_variable, s(:call, s(:const, :MAGIC_VARIABLES), :[], s(:lvar, :var))), s(:if, s(:lvar, :magic_variable), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :StringContent), :new, s(:call, nil, :send, s(:lvar, :magic_variable)), s(:call, s(:lvar, :var), :ident)), :to_sexp), [:elsif, s(:call, s(:lvar, :var), :is_a?, #<Nodes::Constant:0x00000102b90070 @ident="String">), [s(:call, s(:call, s(:colon2, s(:const, :Nodes), :LocalVar), :new, s(:lvar, :var)), :to_sexp)], nil])), s(:defn, :on_ivar, s(:args, :name), s(:call, s(:colon2, s(:const, :Nodes), :InstanceVariable), :new, s(:call, s(:colon2, s(:const, :Nodes), :Ident), :new, s(:lvar, :name), s(:call, nil, :lineno)))), s(:defn, :on_cvar, s(:args, :name), s(:call, s(:colon2, s(:const, :Nodes), :ClassVariable), :new, s(:call, s(:colon2, s(:const, :Nodes), :Ident), :new, s(:lvar, :name), s(:call, nil, :lineno)))), s(:defn, :on_const_ref, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_const_path_ref, s(:args, :"*nodes"), s(:lasgn, :first_const, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :second_const, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, nil, :s, s(:lit, :colon2), s(:call, s(:lvar, :first_const), :to_sexp), s(:call, s(:call, s(:lvar, :second_const), :ident), :to_sym))), s(:defn, :on_top_const_ref, s(:args, :constant), s(:call, nil, :s, s(:lit, :colon3), s(:call, s(:call, s(:lvar, :constant), :ident), :to_sym))), s(:defn, :on_gvar, s(:args, :"*nodes"), s(:lasgn, :global_var, s(:call, s(:lvar, :nodes), :first)), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :GlobalVariable), :new, s(:lvar, :global_var)), :to_sexp)), s(:defn, :on_var_field, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_field, s(:args, :"*nodes"), s(:lasgn, :receiver, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :access_type, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :field_name, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:call, s(:colon2, s(:const, :Nodes), :Field), :new, s(:lvar, :receiver), s(:lvar, :field_name))), s(:defn, :on_const, s(:args, :"*nodes"), s(:lasgn, :ident, s(:call, s(:colon2, s(:const, :Nodes), :Ident), :new, s(:call, s(:lvar, :nodes), :first), s(:call, nil, :lineno))), s(:call, s(:colon2, s(:const, :Nodes), :Constant), :new, s(:lvar, :ident))), s(:defn, :on_ident, s(:args, :"*nodes"), s(:call, s(:colon2, s(:const, :Nodes), :Ident), :new, s(:call, s(:lvar, :nodes), :first), s(:call, nil, :lineno))), s(:defn, :on_op, s(:args, :"*nodes"), s(:call, s(:colon2, s(:const, :Nodes), :Ident), :new, s(:call, s(:lvar, :nodes), :first), s(:call, nil, :lineno))), s(:defn, :on_string_content, s(:args, :"*nodes"), s(:lvar, :nodes)), s(:defn, :on_string_literal, s(:args, :"*nodes"), s(:lasgn, :string_content_nodes, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:if, s(:iter, s(:call, s(:lvar, :string_content_nodes), :any?), s(:lasgn, :node), s(:call, s(:lvar, :node), :is_a?, s(:colon2, s(:const, :Nodes), :StringEvaluation))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :DynamicString), :new, s(:lvar, :string_content_nodes)), :to_sexp), s(:call, s(:lvar, :string_content_node), :to_sexp))), s(:defn, :on_tstring_content, s(:args, :"*nodes"), s(:lasgn, :string, s(:call, s(:lvar, :nodes), :first)), s(:call, s(:colon2, s(:const, :Nodes), :StringContent), :new, s(:lvar, :string), s(:call, nil, :lineno))), s(:defn, :on_string_embexpr, s(:args, :"*nodes"), s(:lasgn, :string_asts, s(:call, s(:lvar, :nodes), :first)), s(:call, s(:colon2, s(:const, :Nodes), :StringEvaluation), :new, s(:lvar, :string_asts))), s(:defn, :on_hash, s(:args, :assoc_list), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Hash), :new, s(:lvar, :assoc_list)), :to_sexp)), s(:defn, :on_assoclist_from_args, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_assoc_new, s(:args, :"*nodes"), s(:lvar, :nodes)), s(:defn, :on_bare_assoc_hash, s(:args, :"*nodes"), s(:call, nil, :on_hash, :args_add_star, [], s(:lvar, :nodes))), s(:defn, :on_label, s(:args, :label), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Literal), :new, s(:call, s(:call, s(:lvar, :label), :chomp, s(:str, ":")), :to_sym)), :to_sexp)), s(:defn, :on_array, s(:args, :"*nodes"), s(:lasgn, :array_items, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Array), :new, s(:lvar, :array_items)), :to_sexp)), s(:defn, :on_aref, s(:args, :"*nodes"), s(:lasgn, :receiver, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :args, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :method_name, s(:call, s(:colon2, s(:const, :Nodes), :Ident), :new, s(:str, "[]"), s(:call, nil, :lineno))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Call), :new, s(:lvar, :receiver), s(:lvar, :method_name), s(:lvar, :args)), :to_sexp)), s(:defn, :on_aref_field, s(:args, :"*nodes"), s(:lasgn, :receiver, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :index, s(:call, s(:call, s(:lvar, :nodes), :[], s(:lit, 1)), :[], s(:lit, 0))), s(:call, s(:colon2, s(:const, :Nodes), :ArefField), :new, s(:lvar, :receiver), s(:lvar, :index))), s(:defn, :on_symbol, s(:args, :"*nodes"), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Literal), :new, s(:call, s(:call, s(:lvar, :nodes), :first), :to_sym)), :to_sexp)), s(:defn, :on_symbol_literal, s(:args, :"*nodes"), s(:call, s(:lvar, :nodes), :first)), s(:defn, :on_for, s(:args, :"*nodes"), s(:lasgn, :ident, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :collection, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:lasgn, :params, s(:call, s(:colon2, s(:const, :Nodes), :AssignmentParameters), :new, s(:lvar, :ident))), s(:lasgn, :assignments, s(:if, s(:call, s(:call, s(:call, nil, :Array, s(:lvar, :ident)), :count), :>, s(:lit, 1)), s(:call, s(:colon2, s(:const, :Nodes), :MultipleAssignment), :new, s(:lvar, :params)), s(:call, s(:colon2, s(:const, :Nodes), :Lasgn), :new, s(:lvar, :ident)))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :For), :new, s(:lvar, :collection), s(:call, s(:lvar, :assignments), :to_sexp), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :BodyStmt), :new, s(:lvar, :body)), :to_sexp)), :to_sexp)), s(:defn, :on_while, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :body, s(:call, s(:call, s(:lvar, :nodes), :[], s(:lit, 1)), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :While), :new, s(:lvar, :condition), s(:lvar, :body)), :to_sexp)), s(:defn, :on_while_mod, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :While), :new, s(:lvar, :condition), s(:lvar, :body)), :to_sexp)), s(:defn, :on_until, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :body, s(:call, s(:call, s(:lvar, :nodes), :[], s(:lit, 1)), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Until), :new, s(:lvar, :condition), s(:lvar, :body)), :to_sexp)), s(:defn, :on_until_mod, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :body, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Until), :new, s(:lvar, :condition), s(:lvar, :body)), :to_sexp)), s(:defn, :on_kw, s(:args, :"*nodes"), s(:lasgn, :keyword, s(:call, s(:lvar, :nodes), :first)), s(:if, s(:call, s(:const, :KEYWORDS), :include?, s(:lvar, :keyword)), s(:call, nil, :s, s(:call, s(:lvar, :keyword), :to_sym)), nil)), s(:defn, :on_if, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :then_ast, s(:call, s(:call, s(:lvar, :nodes), :[], s(:lit, 1)), :[], s(:lit, 0))), s(:lasgn, :else_ast, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :If), :new, s(:lvar, :condition), s(:lvar, :then_ast), s(:lvar, :else_ast)), :to_sexp)), s(:defn, :on_if_mod, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :then_ast, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :If), :new, s(:lvar, :condition), s(:lvar, :then_ast), s(:nil)), :to_sexp)), s(:defn, :on_ifop, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :first)), s(:lasgn, :then_ast, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:lasgn, :else_ast, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :If), :new, s(:lvar, :condition), s(:lvar, :then_ast), s(:lvar, :else_ast)), :to_sexp)), s(:defn, :on_unless, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :then_ast, s(:call, s(:lvar, :nodes), :[], s(:lit, 2))), s(:lasgn, :else_ast, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :If), :new, s(:lvar, :condition), s(:lvar, :then_ast), s(:call, s(:lvar, :else_ast), :first)), :to_sexp)), s(:defn, :on_unless_mod, s(:args, :"*nodes"), s(:lasgn, :condition, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :then_ast, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :If), :new, s(:lvar, :condition), s(:nil), s(:lvar, :then_ast)), :to_sexp)), s(:defn, :on_else, s(:args, :"*nodes"), s(:call, s(:call, s(:lvar, :nodes), :[], s(:lit, 0)), :[], s(:lit, 1))), s(:defn, :on_dot2, s(:args, :"*nodes"), s(:lasgn, :begin_value, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :end_value, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Range), :new, s(:lvar, :begin_value), s(:lvar, :end_value)), :to_sexp)), s(:defn, :on_dot3, s(:args, :"*nodes"), s(:lasgn, :begin_value, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:lasgn, :end_value, s(:call, s(:lvar, :nodes), :[], s(:lit, 1))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :Range), :new, s(:lvar, :begin_value), s(:lvar, :end_value), s(:false)), :to_sexp)), s(:defn, :on_regexp_literal, s(:args, :"*nodes"), s(:lasgn, :regexp_content_nodes, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:if, s(:iter, s(:call, s(:lvar, :regexp_content_nodes), :any?), s(:lasgn, :node), s(:call, s(:lvar, :node), :is_a?, s(:colon2, s(:const, :Nodes), :StringEvaluation))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :DynamicRegexp), :new, s(:lvar, :regexp_content_nodes)), :to_sexp), nil)), s(:defn, :on_dyna_symbol, s(:args, :"*nodes"), s(:lasgn, :symbol_content_nodes, s(:call, s(:lvar, :nodes), :[], s(:lit, 0))), s(:if, s(:iter, s(:call, s(:lvar, :symbol_content_nodes), :any?), s(:lasgn, :node), s(:call, s(:lvar, :node), :is_a?, s(:colon2, s(:const, :Nodes), :StringEvaluation))), s(:call, s(:call, s(:colon2, s(:const, :Nodes), :DynamicSymbol), :new, s(:lvar, :symbol_content_nodes)), :to_sexp), nil))), s(:if, s(:call, s(:gvar, :$0), :==, s(:str, "(string)")), s(:call, nil, :p, s(:call, s(:const, :SexpBuilder), :parse, s(:call, s(:const, :File), :read, s(:str, "(string)")))), nil)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment