Sha256: df6b494749b008f730fe2ea4b2475dabc8598609f65fe6416187edb67a4d7df5

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

module Treetop
  class Protometagrammar  
    class OrderedChoiceExpressionBuilder < ParsingExpressionBuilder
      def build
        choice(ordered_choice, :sequence)
      end
    
      def ordered_choice
        two_or_more_delimited(:sequence, seq(optional(:space), "/", optional(:space))) do
          def value(grammar)
            OrderedChoice.new(element_values(grammar))
          end
        
          def element_values(grammar)
            elements.collect { |element| element.value(grammar) }
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
treetop-0.1.0 lib/treetop/protometagrammar/ordered_choice_expression_builder.rb