class Yadriggy::SymbolLiteral
Symbol.
Attributes
column[R]
@return [Integer] the column.
line_no[R]
@return [Integer] the line number.
name[R]
@return [String] the symbol name.
For example, if the object represents `:sym`, then `"sym"` (without a colon) is returned.
Public Class Methods
new(sexp)
click to toggle source
# File lib/yadriggy/ast.rb, line 327 def initialize(sexp) if sexp[0] == :dyna_symbol sexp2 = if sexp[1][0] == :string_content sexp[1][1] else sexp[1][0] end init(has_tag?(sexp2, :@tstring_content)) elsif sexp[0] == :symbol_literal init(has_tag?(sexp[1], :symbol)[1]) else init(has_tag?(sexp, :symbol)[1]) end end
Public Instance Methods
accept(evaluator)
click to toggle source
A method for Visitor pattern. @param [Eval] evaluator the visitor of Visitor pattern. @return [void]
# File lib/yadriggy/ast.rb, line 350 def accept(evaluator) evaluator.symbol(self) end
const_value()
click to toggle source
# File lib/yadriggy/ast_value.rb, line 297 def const_value() value end
to_sym()
click to toggle source
@return [Symbol] a symbol the literal represents.
# File lib/yadriggy/ast.rb, line 343 def to_sym name.to_sym end
value()
click to toggle source
Gets the symbol represented by this node.
# File lib/yadriggy/ast_value.rb, line 293 def value() name.to_sym end
Private Instance Methods
init(sexp)
click to toggle source
# File lib/yadriggy/ast.rb, line 355 def init(sexp) @name = sexp[1] @line_no = sexp[2][0].to_i @column = sexp[2][1].to_i end