Class: RedParse::VarNameToken
- Inherits:
-
Object
- Object
- RedParse::VarNameToken
show all
- Includes:
- FlattenedIvars
- Defined in:
- lib/redparse/node.rb
Overview
none of this should be necessary now
Constant Summary
FlattenedIvars::EXCLUDED_IVARS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#flattened_ivars, #flattened_ivars_equal?
Instance Attribute Details
#endline ⇒ Object
Returns the value of attribute endline.
326
327
328
|
# File 'lib/redparse/node.rb', line 326
def endline
@endline
end
|
#lvalue ⇒ Object
Returns the value of attribute lvalue.
317
318
319
320
|
# File 'lib/redparse/node.rb', line 317
def lvalue
return @lvalue if defined? @lvalue
@lvalue=true
end
|
Instance Method Details
#all_current_lvars ⇒ Object
322
323
324
|
# File 'lib/redparse/node.rb', line 322
def all_current_lvars
lvar_type==:current ? [ident] : []
end
|
339
340
341
|
# File 'lib/redparse/node.rb', line 339
def
huh
end
|
#dup ⇒ Object
328
329
330
331
332
|
# File 'lib/redparse/node.rb', line 328
def dup
result=super
result.ident=@ident.dup
return result
end
|
#lvalue_parsetree(o) ⇒ Object
313
314
315
|
# File 'lib/redparse/node.rb', line 313
def lvalue_parsetree(o)
[varname2assigntype, ident.to_sym]
end
|
#parsetree(o) ⇒ Object
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
# File 'lib/redparse/node.rb', line 268
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
else fail
end
end
return [type,ident.to_sym]
end
|
#unparse(o = default_unparse_options) ⇒ Object
Also known as:
lhs_unparse
336
|
# File 'lib/redparse/node.rb', line 336
def unparse o=default_unparse_options; ident end
|
#varname2assigntype ⇒ Object
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/redparse/node.rb', line 294
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
343
344
345
|
# File 'lib/redparse/node.rb', line 343
def walk
yield nil,nil,nil,self
end
|