Class: NScript::ParentheticalNode

Inherits:
Node
  • Object
show all
Defined in:
lib/nscript/parser/nodes.rb

Constant Summary

Constants inherited from Node

Node::TAB

Instance Method Summary collapse

Methods inherited from Node

#children, children, #compile, #compile_closure, #contains?, #idt, statement, #statement?, statement_only, #statement_only?, top_sensitive, #top_sensitive?, #unwrap, #write

Constructor Details

#initialize(expressions, line = nil) ⇒ ParentheticalNode

Returns a new instance of ParentheticalNode.



839
840
841
842
# File 'lib/nscript/parser/nodes.rb', line 839

def initialize(expressions, line=nil)
  @expressions = expressions.unwrap
  @line = line
end

Instance Method Details

#compile_node(o) ⇒ Object



844
845
846
847
848
# File 'lib/nscript/parser/nodes.rb', line 844

def compile_node(o)
  compiled = @expressions.compile(o)
  compiled = compiled[0...-1] if compiled[-1..-1] == ';'
  write("(#{compiled})")
end