Class: RedParse::NotMatchNode

Inherits:
OpNode show all
Defined in:
lib/redparse/node.rb,
lib/redparse/node.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

Methods inherited from OpNode

#to_lisp, #unparse

Methods inherited from RawOpNode

create, #image, #raw_unparse

Methods inherited from ValueNode

#lvalue

Methods inherited from Node

#+, #+@, #==, [], #[]=, #add_parent_links!, #begin_parsetree, create, #data, #deep_copy, #delete_extraneous_ivars!, #delete_linenums!, #depthwalk, #depthwalk_nodes, #error?, #evalable_inspect, #fixup_multiple_assignments!, #fixup_rescue_assignments!, #image, #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, #to_parsetree, #to_parsetree_and_warnings, #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

#identity_name

Constructor Details

#initialize(left, op, right = nil) ⇒ NotMatchNode

Returns a new instance of NotMatchNode.



1372
1373
1374
1375
# File 'lib/redparse/node.rb', line 1372

def initialize(left,op,right=nil)
  op,right=nil,op unless right
  replace [left,right]
end

Instance Method Details

#opObject



1389
# File 'lib/redparse/node.rb', line 1389

def op; "!~"; end

#parsetree(o) ⇒ Object



1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
# File 'lib/redparse/node.rb', line 1377

def parsetree(o)
  if StringNode===left and left.char=="/"
    [:not, [:match2, left.parsetree(o), right.parsetree(o)]]
  elsif StringNode===right and right.char=="/"
    [:not, [:match3, right.parsetree(o), left.parsetree(o)]]
  else
    result=opnode_parsetree(o)
    result[2]="=#{op[1..1]}".to_sym
    result=[:not, result]
  end
end