activefacts 0.8.12 → 0.8.13

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -70,6 +70,7 @@ lib/activefacts/cql/compiler/fact_type.rb
70
70
  lib/activefacts/cql/compiler/join.rb
71
71
  lib/activefacts/cql/compiler/shared.rb
72
72
  lib/activefacts/cql/compiler/value_type.rb
73
+ lib/activefacts/cql/nodes.rb
73
74
  lib/activefacts/cql/parser.rb
74
75
  lib/activefacts/generate/absorption.rb
75
76
  lib/activefacts/generate/cql.rb
@@ -0,0 +1,49 @@
1
+ module ActiveFacts
2
+ module CQL
3
+ class Parser
4
+ class TermNode < Treetop::Runtime::SyntaxNode
5
+ def ast quantifier = nil, function_call = nil, role_name = nil, value_constraint = nil, literal = nil, nested_clauses = nil
6
+ t = x.context[:term]
7
+ gt = x.context[:global_term]
8
+ if t.size > gt.size and t[-gt.size..-1] == gt
9
+ leading_adjective = t[0...-gt.size-1]
10
+ leading_adjective.sub!(/ /, '-') if !tail.elements[0].dbl.empty?
11
+ end
12
+ if t.size > gt.size and t[0...gt.size] == gt
13
+ trailing_adjective = t[gt.size+1..-1]
14
+ trailing_adjective.sub!(/ (\S*)\Z/, '-\1') if !tail.elements[-1].dbl.empty?
15
+ end
16
+ Compiler::VarRef.new(gt, leading_adjective, trailing_adjective, quantifier, function_call, role_name, value_constraint, literal, nested_clauses)
17
+ end
18
+
19
+ def value # Sometimes we just want the full term name
20
+ x.context[:term]
21
+ end
22
+
23
+ def node_type
24
+ :term
25
+ end
26
+ end
27
+
28
+ class TermLANode < TermNode
29
+ def ast quantifier = nil, function_call = nil, role_name = nil, value_constraint = nil, literal = nil, nested_clauses = nil
30
+ ast = term.ast(quantifier, function_call, role_name, value_constraint, literal, nested_clauses)
31
+ ast.leading_adjective = head.text_value
32
+ ast
33
+ end
34
+ end
35
+
36
+ class TermDefinitionNameNode < TermNode
37
+ def value
38
+ t.elements.inject([
39
+ id.value
40
+ ]){|a, e| a << e.id.value}*' '
41
+ end
42
+
43
+ def node_type
44
+ :term
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -5,5 +5,5 @@
5
5
  # Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
6
6
  #
7
7
  module ActiveFacts
8
- VERSION = '0.8.12'
8
+ VERSION = '0.8.13'
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activefacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.12
4
+ version: 0.8.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -188,6 +188,7 @@ files:
188
188
  - lib/activefacts/cql/compiler/join.rb
189
189
  - lib/activefacts/cql/compiler/shared.rb
190
190
  - lib/activefacts/cql/compiler/value_type.rb
191
+ - lib/activefacts/cql/nodes.rb
191
192
  - lib/activefacts/cql/parser.rb
192
193
  - lib/activefacts/generate/absorption.rb
193
194
  - lib/activefacts/generate/cql.rb