Class: ActiveFacts::CQL::Parser

Inherits:
CQLParser
  • Object
show all
Includes:
ActiveFacts
Defined in:
lib/activefacts/cql/parser.rb

Overview

Extend the generated parser:

Direct Known Subclasses

Compiler

Defined Under Namespace

Classes: Context, InputProxy

Constant Summary

Constants included from ActiveFacts

VERSION

Instance Method Summary collapse

Methods included from ActiveFacts

extract_hash_args

Instance Method Details

#contextObject



185
186
187
# File 'lib/activefacts/cql/parser.rb', line 185

def context
  @context ||= Context.new(self)
end

#parse(input, options = {}) ⇒ Object



194
195
196
197
# File 'lib/activefacts/cql/parser.rb', line 194

def parse(input, options = {})
  input = InputProxy.new(input, context) unless input.respond_to?(:context)
  super(input, options)
end

#parse_all(input, rule_name = nil, &block) ⇒ Object



199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/activefacts/cql/parser.rb', line 199

def parse_all(input, rule_name = nil, &block)
  self.root = rule_name if rule_name

  @index = 0  # Byte offset to start next parse
  self.consume_all_input = false
  begin
    node = parse(InputProxy.new(input, context), :index => @index)
    return nil unless node
    block.call(node) if block
  end until self.index == @input_length
  true
end

#unit?(s) ⇒ Boolean

Returns:

  • (Boolean)


189
190
191
192
# File 'lib/activefacts/cql/parser.rb', line 189

def unit?(s)
  # puts "Asking whether #{s.inspect} is a unit"
  true
end