Sha256: c74a2d233e94daf7e7b4a8847d6a06591704ccd762cd0c00892578a50c809437
Contents?: true
Size: 454 Bytes
Versions: 1
Compression:
Stored size: 454 Bytes
Contents
module Sexpr class Sequence include Element attr_reader :terms def initialize(terms) @terms = terms end def match?(sexp) return nil unless sexp.is_a?(Array) eat = eat(sexp) eat && eat.empty? end def eat(sexp) @terms.inject sexp do |rest,rule| rest && rule.eat(rest) end end def inspect "(seq #{terms.inspect})" end end # class Sequence end # module Sexpr
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sexpr-0.2.0 | lib/sexpr/sequence.rb |