128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/activefacts/cql/parser/FactTypes.rb', line 128
def ast
ft = anonymous_fact_type.ast
if !name.empty?
ft.name = name.term_definition_name.value
pragmas = name.mapping_pragmas.value
pragmas << 'independent' if name.is_where.independent
ft.pragmas = pragmas
elsif !each.empty?
first_reading = ft.clauses[0]
refs = first_reading.refs
raise "Ambiguous 'each' implies mandatory on fact type of arity #{refs.size}" unless refs.size == 2
q = refs[-1].quantifier
if q
q.min = 1 else
refs[-1].quantifier = q = Compiler::Quantifier.new(1, nil)
end
end
ft
end
|