Sha256: 0d320e71165e71244c0c0db72f8f2ab825f0ee618af3ff176e2739579dbd9479
Contents?: true
Size: 693 Bytes
Versions: 1
Compression:
Stored size: 693 Bytes
Contents
module Treetop class OrderedChoice < NodePropagatingParsingExpression attr_reader :alternatives def initialize(alternatives) @alternatives = alternatives end def to_s parenthesize((alternatives.collect {|alt| alt.to_s}).join(" / ")) end def parse_at(input, start_index, parser) failures = [] for alt in alternatives result = alt.parse_at(input, start_index, parser) if result.success? result.update_nested_failures(collect_nested_failures(failures)) return result else failures << result end end return failure_at(start_index, failures) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
treetop-0.1.0 | lib/treetop/grammar/parsing_expressions/ordered_choice.rb |