Class: RedParse::ArrayLiteralNode
- Defined in:
- lib/redparse/node.rb,
lib/redparse/ripper.rb,
lib/redparse/ReduceWithsFor_RedParse_1_9.rb,
lib/redparse/ReduceWithsFor_RedParse_1_8.rb
Constant Summary
Constants included from FlattenedIvars
FlattenedIvars::EXCLUDED_IVARS
Instance Attribute Summary
Attributes inherited from Node
#endline, #errors, #offset, #parent, #startline
Attributes included from Stackable::Meta
#boolean_identity_params, #identity_params
Instance Method Summary collapse
- #image ⇒ Object
-
#initialize(lbrack, contents, rbrack) ⇒ ArrayLiteralNode
constructor
A new instance of ArrayLiteralNode.
- #parsetree(o) ⇒ Object
- #reducer_ident ⇒ Object
- #rip(p) ⇒ Object
- #unparse(o = default_unparse_options) ⇒ Object
Methods inherited from ValueNode
Methods inherited from Node
#+, #+@, #==, [], #[]=, #add_parent_links!, #args_rip, #begin_parsetree, #classic_inspect, create, #data, #deep_copy, #delete_extraneous_ivars!, #delete_linenums!, #depthwalk, #depthwalk_nodes, #error?, #evalable_inspect, #fixup_multiple_assignments!, #fixup_rescue_assignments!, #force_stmt_list_rip, #initialize_ivars, inline_symbols, #inspect, #lhs_unparse, #linerange, #lvalue, #lvars_defined_in, #merge_replacement_session, namelist, #negate, #original_brackets_assign, param_names, #parsetrees, #pretty_print, #prohibit_fixup, #replace_ivars_and_self, #replace_value, #rescue_parsetree, #rfind, #rfind_all, #rgrep, #rip_and_rescues, #rip_explode!, #short_inspect, #stmts_rip, #to_parsetree, #to_parsetree_and_warnings, #to_ruby, #to_s, #unary, #walk, #xform_tree!
Methods included from Stackable::Meta
#build_exemplars, #enumerate_exemplars, #identity_param
Methods included from FlattenedIvars
#flattened_ivars, #flattened_ivars_equal?
Methods included from Stackable
Constructor Details
#initialize(lbrack, contents, rbrack) ⇒ ArrayLiteralNode
Returns a new instance of ArrayLiteralNode.
4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 |
# File 'lib/redparse/node.rb', line 4235 def initialize(lbrack,contents,rbrack) @offset=lbrack.offset contents or return super() if CommaOpNode===contents h,arrowrange=contents.extract_unbraced_hash contents[arrowrange]=[h] if arrowrange super( *contents ) elsif ArrowOpNode===contents h=HashLiteralNode.new(nil,contents,nil) h.startline=contents.startline h.endline=contents.endline super HashLiteralNode.new(nil,contents,nil) else super contents end end |
Instance Method Details
#image ⇒ Object
4252 |
# File 'lib/redparse/node.rb', line 4252 def image; "([])" end |
#parsetree(o) ⇒ Object
4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 |
# File 'lib/redparse/node.rb', line 4258 def parsetree(o) size.zero? and return [:zarray] normals,star=param_list_parse(self,o) result=normals.unshift :array if star if size==1 result=star else result=[:argscat, result, star.last] end end result end |
#reducer_ident ⇒ Object
17420 17421 17422 |
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17420 def reducer_ident :ArrayLiteralNode end |
#rip(p) ⇒ Object
380 381 382 |
# File 'lib/redparse/ripper.rb', line 380 def rip p p.on_array(args_rip(self,p)) end |
#unparse(o = default_unparse_options) ⇒ Object
4254 4255 4256 |
# File 'lib/redparse/node.rb', line 4254 def unparse o= "["+map{|item| unparse_nl(item,o,'')+item.unparse_maybe_parens(o)}.join(', ')+"]" end |