Class: Walrat::AndPredicate
- Defined in:
- lib/walrat/and_predicate.rb
Instance Attribute Summary
Attributes inherited from Predicate
Instance Method Summary collapse
Methods inherited from Predicate
#eql?, #initialize, #to_parseable
Methods included from Memoizing
#check_left_recursion, #memoizing_parse
Methods included from ParsletCombining
#&, #>>, #and?, #and_predicate, #choice, #memoizing_parse, #merge, #not!, #not_predicate, #omission, #one_or_more, #optional, #repeat, #repeat_with_default, #repetition, #repetition_with_default, #sequence, #skip, #zero_or_more, #zero_or_one, #|
Constructor Details
This class inherits a constructor from Walrat::Predicate
Instance Method Details
#parse(string, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/walrat/and_predicate.rb', line 27 def parse string, = {} raise ArgumentError if string.nil? catch :ZeroWidthParseSuccess do begin parsed = @parseable.memoizing_parse string, rescue ParseError raise ParseError.new('predicate not satisfied (expected "%s") while parsing "%s"' % [@parseable.to_s, string], :line_end => [:line_start], :column_end => [:column_start]) end end # getting this far means that parsing succeeded throw :AndPredicateSuccess end |