Sha256: 7476cdb411b3380acf76ea1e7348a73ee5e72ee8d6c5a197a72d089bf7bc58db

Contents?: true

Size: 708 Bytes

Versions: 8

Compression:

Stored size: 708 Bytes

Contents

lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'test/unit'
require 'citrus'

class Test::Unit::TestCase
  include Citrus

  TestGrammar = Grammar.new do
    rule :alpha do
      /[a-zA-Z]/
    end

    rule :num do
      ext(/[0-9]/) { to_i }
    end

    rule :alphanum do
      any(:alpha, :num)
    end
  end

  Double = Grammar.new do
    include TestGrammar

    root :double

    rule :double do
      one_or_more(:num)
    end
  end

  Words = Grammar.new do
    include TestGrammar

    root :words

    rule :word do
      one_or_more(:alpha)
    end

    rule :words do
      [ :word, zero_or_more([ ' ', :word ]) ]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
citrus-2.5.0 test/helper.rb
citrus-2.4.1 test/helper.rb
citrus-2.4.0 test/helper.rb
citrus-2.3.7 test/helper.rb
citrus-2.3.6 test/helper.rb
citrus-2.3.5 test/helper.rb
citrus-2.3.4 test/helper.rb
citrus-2.3.3 test/helper.rb