Sha256: 3def15cf06ac7563a60dceba9e0fde8abe0af919bd6809bc7785fe57ab94a152

Contents?: true

Size: 511 Bytes

Versions: 13

Compression:

Stored size: 511 Bytes

Contents

# The test parser regards any word starting with an upper-case letter as a pre-existing term
require 'activefacts/cql/Language/English'
class TestParser < ActiveFacts::CQL::Parser
  include ActiveFacts::CQL::English
  def context
    @context ||= Context.new(self)
  end     

  class Context < ActiveFacts::CQL::Parser::Context
    # Capitalised words that are otherwise undefined are treated as terms:
    def system_term(t)
      (first = t[0,1] and first.upcase == first) ? {t=>t} : false
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
activefacts-1.6.0 spec/helpers/test_parser.rb
activefacts-1.5.3 spec/helpers/test_parser.rb
activefacts-1.5.2 spec/helpers/test_parser.rb
activefacts-1.5.1 spec/helpers/test_parser.rb
activefacts-1.5.0 spec/helpers/test_parser.rb
activefacts-1.3.0 spec/helpers/test_parser.rb
activefacts-1.2.1 spec/helpers/test_parser.rb
activefacts-1.2.0 spec/helpers/test_parser.rb
activefacts-1.1.0 spec/helpers/test_parser.rb
activefacts-1.0.2 spec/helpers/test_parser.rb
activefacts-1.0.1 spec/helpers/test_parser.rb
activefacts-1.0.0 spec/helpers/test_parser.rb
activefacts-0.8.18 spec/helpers/test_parser.rb