Class: NScript::LiteralNode
Constant Summary collapse
- STATEMENTS =
['break', 'continue']
Constants inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
- #compile_node(o) ⇒ Object
-
#initialize(value) ⇒ LiteralNode
constructor
A new instance of LiteralNode.
- #statement? ⇒ Boolean (also: #statement_only?)
Methods inherited from Node
#children, children, #compile, #compile_closure, #contains?, #idt, statement, statement_only, top_sensitive, #top_sensitive?, #unwrap, #write
Constructor Details
#initialize(value) ⇒ LiteralNode
Returns a new instance of LiteralNode.
155 156 157 |
# File 'lib/nscript/parser/nodes.rb', line 155 def initialize(value) @value = value end |
Class Method Details
Instance Method Details
#compile_node(o) ⇒ Object
164 165 166 167 168 |
# File 'lib/nscript/parser/nodes.rb', line 164 def compile_node(o) indent = statement? ? idt : '' ending = statement? ? ';' : '' "#{indent}#{@value}#{ending}" end |
#statement? ⇒ Boolean Also known as: statement_only?
159 160 161 |
# File 'lib/nscript/parser/nodes.rb', line 159 def statement? STATEMENTS.include?(@value.to_s) end |