Class: RedParse::VarNameToken

Inherits:
Object
  • Object
show all
Includes:
FlattenedIvars
Defined in:
lib/redparse/node.rb

Overview

none of this should be necessary now

Constant Summary

Constants included from FlattenedIvars

FlattenedIvars::EXCLUDED_IVARS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FlattenedIvars

#flattened_ivars, #flattened_ivars_equal?

Instance Attribute Details

#endlineObject

Returns the value of attribute endline.



328
329
330
# File 'lib/redparse/node.rb', line 328

def endline
  @endline
end

#lvalueObject

Returns the value of attribute lvalue.



328
329
330
# File 'lib/redparse/node.rb', line 328

def lvalue
  @lvalue
end

Instance Method Details

#all_current_lvarsObject



324
325
326
# File 'lib/redparse/node.rb', line 324

def all_current_lvars
  lvar_type==:current ? [ident] : []
end

#delete_extraneous_ivars!Object



341
342
343
# File 'lib/redparse/node.rb', line 341

def delete_extraneous_ivars!
  huh
end

#dupObject



330
331
332
333
334
# File 'lib/redparse/node.rb', line 330

def dup
  result=super
  result.ident=@ident.dup
  return result
end

#lvalue_parsetree(o) ⇒ Object



315
316
317
# File 'lib/redparse/node.rb', line 315

def lvalue_parsetree(o)
  [varname2assigntype, ident.to_sym]
end

#old_unused_lvalueObject

i think this is the correct way, but its overridded below



319
320
321
322
# File 'lib/redparse/node.rb', line 319

def old_unused_lvalue #i think this is the correct way, but its overridded below
  return @lvalue if defined? @lvalue
  @lvalue=true
end

#parsetree(o) ⇒ Object



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/redparse/node.rb', line 270

def parsetree(o)
  type=case ident[0]
   when ?$ 
     case ident[1]
     when ?1..?9; return [:nth_ref,ident[1..-1].to_i]
     when ?&,?+,?`,?'; return [:back_ref,ident[1].chr.to_sym] #`
     else :gvar
     end
   when ?@ 
     if ident[1]==?@
       :cvar
     else
       :ivar
     end
   when ?A..?Z; :const
   else 
     case lvar_type
     when :local; :lvar
     when :block; :dvar
     when :current; :dvar#_curr
     else fail
     end
   end
   return [type,ident.to_sym]
end

#unparse(o = default_unparse_options) ⇒ Object Also known as: lhs_unparse



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

def unparse o=default_unparse_options; ident end

#varname2assigntypeObject



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/redparse/node.rb', line 296

def varname2assigntype
    case ident[0]
    when ?$; :gasgn
    when ?@;
      if ident[1]!=?@;  :iasgn
      elsif in_def;     :cvasgn
      else              :cvdecl
      end
    when ?A..?Z; :cdecl
    else 
      case lvar_type
      when :local; :lasgn
      when :block; :dasgn
      when :current; :dasgn_curr
      else fail
      end
    end
end

#walk {|nil, nil, nil, _self| ... } ⇒ Object

Yields:

  • (nil, nil, nil, _self)

Yield Parameters:



345
346
347
# File 'lib/redparse/node.rb', line 345

def walk
  yield nil,nil,nil,self
end