lib/nydp/compiler.rb in nydp-0.0.5 vs lib/nydp/compiler.rb in nydp-0.0.6
- old
+ new
@@ -6,9 +6,15 @@
module Nydp
class Compiler
extend Helper
def self.compile expression, bindings
+ compile_expr expression, bindings
+ rescue Exception => e
+ raise "failed to compile expression #{expression.inspect},\nerror was #{e.message}"
+ end
+
+ def self.compile_expr expression, bindings
if expression.is_a? Nydp::Symbol
SymbolLookup.build expression, bindings
elsif literal? expression
Literal.build expression, bindings
elsif expression.is_a? Nydp::Pair