Class: Kwartz::NativeStatement

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

Overview

represents statement in target language code

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, kind = nil) ⇒ NativeStatement

Returns a new instance of NativeStatement.



112
113
114
115
# File 'lib/kwartz/node.rb', line 112

def initialize(code, kind=nil)
  @code = code
  @kind = kind
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



116
117
118
# File 'lib/kwartz/node.rb', line 116

def code
  @code
end

#kindObject (readonly)

Returns the value of attribute kind.



116
117
118
# File 'lib/kwartz/node.rb', line 116

def kind
  @kind
end

#no_newlineObject

Returns the value of attribute no_newline.



117
118
119
# File 'lib/kwartz/node.rb', line 117

def no_newline
  @no_newline
end

Class Method Details

.new_without_newline(code, kind = nil) ⇒ Object



120
121
122
123
124
# File 'lib/kwartz/node.rb', line 120

def self.new_without_newline(code, kind=nil)
  stmt = self.new(code, kind)
  stmt.no_newline = true
  return stmt
end

Instance Method Details

#_inspect(indent = 0) ⇒ Object



127
128
129
# File 'lib/kwartz/node.rb', line 127

def _inspect(indent=0)
  return "<%#{@code}%>\n"
end

#accept(translator) ⇒ Object



132
133
134
# File 'lib/kwartz/node.rb', line 132

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