Class: Kwartz::PrintStatement

Inherits:
Statement show all
Defined in:
lib/kwartz/node.rb

Overview

represents print statement for String and NativeExpression

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ PrintStatement

Returns a new instance of PrintStatement.



179
180
181
# File 'lib/kwartz/node.rb', line 179

def initialize(args)
  @args = args    # array
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



182
183
184
# File 'lib/kwartz/node.rb', line 182

def args
  @args
end

Instance Method Details

#_inspect(indent = 0) ⇒ Object



185
186
187
188
189
190
# File 'lib/kwartz/node.rb', line 185

def _inspect(indent=0)
  list = @args.collect { |arg|
    arg.is_a?(NativeExpression) ? "<%=#{arg.code}%>" : arg.inspect
  }
  return "print(" + list.join(', ') + ")\n"
end

#accept(translator) ⇒ Object



193
194
195
# File 'lib/kwartz/node.rb', line 193

def accept(translator)
  translator.translate_print_stmt(self)
end