class RedParse::ListInNode::VarNode
Attributes
endline[RW]
in_def[R]
lvalue[W]
lvar_type[R]
offset[RW]
startline[RW]
Public Class Methods
new(tok)
click to toggle source
Calls superclass method
RedParse::ListInNode::Node::new
# File lib/redparse/node.rb, line 1207 def initialize(tok) super(tok.ident) @lvar_type=tok.lvar_type @offset=tok.offset @endline=@startline=tok.endline @in_def=tok.in_def end
Public Instance Methods
all_current_lvars()
click to toggle source
# File lib/redparse/node.rb, line 1280 def all_current_lvars lvar_type==:current ? [ident] : [] end
dup()
click to toggle source
Calls superclass method
# File lib/redparse/node.rb, line 1285 def dup result=super result.ident=ident.dup if ident return result end
lvalue()
click to toggle source
# File lib/redparse/node.rb, line 1273 def lvalue return @lvalue if defined? @lvalue @lvalue=true end
lvalue_parsetree(o)
click to toggle source
# File lib/redparse/node.rb, line 1267 def lvalue_parsetree(o) [varname2assigntype, ident.to_sym] end
parsetree(o)
click to toggle source
# File lib/redparse/node.rb, line 1222 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;)
click to toggle source
# File lib/redparse/node.rb, line 1293 def unparse o=default_unparse_options; ident end
Also aliased as: lhs_unparse
varname2assigntype()
click to toggle source
# File lib/redparse/node.rb, line 1248 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| ... }
click to toggle source
# File lib/redparse/node.rb, line 1298 def walk #is this needed? yield nil,nil,nil,self end