Class: IV::Phonic::AST::Identifier

Inherits:
Literal show all
Defined in:
lib/iv/phonic/ast.rb

Instance Method Summary collapse

Methods inherited from Expression

as

Methods inherited from Node

#begin_position, #end_position, #program, #source

Constructor Details

#initialize(parent, expr) ⇒ Identifier

Returns a new instance of Identifier.



369
370
371
372
373
# File 'lib/iv/phonic/ast.rb', line 369

def initialize parent, expr
  super parent, expr
  @value = expr[:value]
  @kind = expr[:kind]
end

Instance Method Details

#to_source(lv) ⇒ Object



375
376
377
378
379
380
381
# File 'lib/iv/phonic/ast.rb', line 375

def to_source lv
  if @kind == :STRING || @kind == :NUMBER
    source.slice(begin_position, end_position)
  else
    @value
  end
end