class Yadriggy::StringInterpolation

String interpolation.

Attributes

contents[R]

@return [Array<ASTnode>] the strings and the embedded expressions.

Public Class Methods

new(sexp) click to toggle source
# File lib/yadriggy/ast.rb, line 472
def initialize(sexp)
  s = has_tag?(sexp[1], :string_content)
  elements = s[1..s.length]
  @contents = elements.map do |e|
    case e[0]
    when :string_embexpr
      Exprs.make(e[1])
    when :@tstring_content
      StringLiteral.new(e)
    else
      raise "unknown string contents #{e[0]}"
    end
  end
  add_children(@contents)
end
tag() click to toggle source
# File lib/yadriggy/ast.rb, line 470
def self.tag() :string_literal 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 491
def accept(evaluator)
  evaluator.string_interpolation(self)
end