lib/activefacts/cql/compiler/expression.rb in activefacts-1.1.0 vs lib/activefacts/cql/compiler/expression.rb in activefacts-1.2.0
- old
+ new
@@ -135,14 +135,10 @@
end
end
@fact_type
end
- def is_existential_type
- false
- end
-
def is_equality_comparison
false
end
def operator
@@ -177,11 +173,11 @@
@binding.refs << self
@binding
end
def result_type_name(context)
- "compare#{operator}(#{[@e1,@e2].map{|e| e.player.name}*', '}))"
+ "COMPARE#{operator}<#{[@e1,@e2].map{|e| e.player.name}*' WITH '})>"
end
def is_equality_comparison
@operator == '='
end
@@ -208,21 +204,21 @@
=end
def inspect; to_s; end
def to_s
- "compare#{
+ "COMPARE#{
operator
}(#{
case @certainty
when nil; 'maybe '
when false; 'negated '
# else 'definitely '
end
}#{
e1.to_s
- } #{
+ } WITH #{
e2.to_s
}#{
@qualifiers.empty? ? '' : ', ['+@qualifiers*', '+']'
})"
end
@@ -253,11 +249,11 @@
@player
end
end
def result_type_name(context)
- "sum(#{ @terms.map{|f| f.player.name}*', ' })"
+ "SUM_OF<#{ @terms.map{|f| f.player.name}*', ' }>"
end
=begin
def result_value_type(context, name)
# REVISIT: If there are units involved, check compatibility
@@ -267,11 +263,11 @@
=end
def inspect; to_s; end
def to_s
- 'sum(' + @terms.map{|term| "#{term.to_s}" } * ' ' + ')'
+ 'SUM(' + @terms.map{|term| "#{term.to_s}" } * ' PLUS ' + ')'
end
end
class Product < Operation
attr_accessor :factors
@@ -297,11 +293,11 @@
@player = @factors[0].player
end
end
def result_type_name(context)
- "product(#{ @factors.map{|f| f.player.name}*', ' })"
+ "PRODUCT_OF<#{ @factors.map{|f| f.player.name}*' ' }>"
end
=begin
def result_value_type(context, name)
vt = super
@@ -311,11 +307,11 @@
=end
def inspect; to_s; end
def to_s
- 'product(' + @factors.map{|factor| "#{factor.to_s}" } * ' ' + ')'
+ 'PRODUCT(' + @factors.map{|factor| "#{factor.to_s}" } * ' TIMES ' + ')'
end
end
class Reciprocal < Operation
attr_accessor :divisor
@@ -348,11 +344,11 @@
=end
def inspect; to_s; end
def to_s
- "reciprocal(#{factor.to_s})"
+ "RECIPROCAL(#{factor.to_s})"
end
end
class Negate
attr_accessor :term
@@ -379,10 +375,10 @@
=end
def inspect; to_s; end
def to_s
- "negate(#{term.to_s})"
+ "NEGATIVE(#{term.to_s})"
end
end
class Literal
attr_accessor :literal, :unit, :role, :role_ref, :clause