Sha256: 42f3c9abbc850f7a5ce909b18b8ff59549bcb27aa32c7eb5d46d84e16270484b
Contents?: true
Size: 509 Bytes
Versions: 7
Compression:
Stored size: 509 Bytes
Contents
module Sexpr module Matcher class Alternative include Matcher attr_reader :terms def initialize(terms) @terms = terms end def match?(sexp) terms.any?{|t| t.match?(sexp)} end def eat(sexp) @terms.each do |alt| res = alt.eat(sexp) return res if res end nil end def inspect "(alt #{terms.inspect})" end end # class Alternative end # module Matcher end # module Sexpr
Version data entries
7 entries across 7 versions & 1 rubygems