Class: ActiveFacts::CQL::Parser::TermNode

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/activefacts/cql/nodes.rb

Direct Known Subclasses

TermDefinitionNameNode, TermLANode

Instance Method Summary collapse

Instance Method Details

#ast(quantifier = nil, function_call = nil, role_name = nil, value_constraint = nil, literal = nil, nested_clauses = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/activefacts/cql/nodes.rb', line 5

def ast quantifier = nil, function_call = nil, role_name = nil, value_constraint = nil, literal = nil, nested_clauses = nil
  t = x.context[:term]
  gt = x.context[:global_term]
  if t.size > gt.size and t[-gt.size..-1] == gt
    leading_adjective = t[0...-gt.size-1]
    leading_adjective.sub!(/ /, '-') if !tail.elements[0].dbl.empty?
  end
  if t.size > gt.size and t[0...gt.size] == gt
    trailing_adjective = t[gt.size+1..-1]
    trailing_adjective.sub!(/ (\S*)\Z/, '-\1') if !tail.elements[-1].dbl.empty?
  end
  Compiler::Reference.new(gt, leading_adjective, trailing_adjective, quantifier, function_call, role_name, value_constraint, literal, nested_clauses)
end

#node_typeObject



23
24
25
# File 'lib/activefacts/cql/nodes.rb', line 23

def node_type
  :term
end

#valueObject

Sometimes we just want the full term name



19
20
21
# File 'lib/activefacts/cql/nodes.rb', line 19

def value             # Sometimes we just want the full term name
  x.context[:term]
end