Class: Citrus::Require

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

Instance Method Summary collapse

Instance Method Details

#codegen(g) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'lib/citrus/nodes.rb', line 83

def codegen(g)
  file = string.value
  file = File.join(File.dirname($file), file) unless $file.nil?
  error(NotFoundError.new(file)) unless File.exists?(file)
  if node = $parser.parse(File.read(file))
    node.expressions.each { |e| e.codegen(g) }
  else
    error(SyntaxError.new)
  end
end