Sha256: fd35c8bbaa5dc4c34d4685e38852e5c1f319655d8917aefe7379818022dfbe3a

Contents?: true

Size: 946 Bytes

Versions: 14

Compression:

Stored size: 946 Bytes

Contents

module Furnace::AST
  class MatcherDSL
    SpecialAny         = MatcherSpecial.new(:any)
    SpecialSkip        = MatcherSpecial.new(:skip)
    SpecialEach        = MatcherSpecial.define(:each)
    SpecialEither      = MatcherSpecial.define(:either)
    SpecialEitherMulti = MatcherSpecial.define(:either_multi)
    SpecialMaybe       = MatcherSpecial.define(:maybe)

    def any
      SpecialAny
    end

    def skip
      SpecialSkip
    end

    def each
      SpecialEach
    end

    def either
      SpecialEither
    end

    def either_multi
      SpecialEitherMulti
    end

    def maybe
      SpecialMaybe
    end

    def map(name)
      ->(hash) { MatcherSpecial.new(:map, [name, hash]) }
    end

    def capture(name)
      MatcherSpecial.new(:capture, name)
    end

    def capture_rest(name)
      MatcherSpecial.new(:capture_rest, name)
    end

    def backref(name)
      MatcherSpecial.new(:backref, name)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
furnace-0.3.0.beta1 lib/furnace/ast/matcher/dsl.rb
furnace-0.2.6 lib/furnace/ast/matcher/dsl.rb
furnace-0.2.5 lib/furnace/ast/matcher/dsl.rb
furnace-0.2.4 lib/furnace/ast/matcher/dsl.rb
furnace-0.2.3 lib/furnace/ast/matcher/dsl.rb
furnace-0.2.2 lib/furnace/ast/matcher/dsl.rb
furnace-0.2.1 lib/furnace/ast/matcher/dsl.rb
furnace-0.2.0 lib/furnace/ast/matcher/dsl.rb
furnace-0.1.2 lib/furnace/ast/matcher/dsl.rb
furnace-0.1.1 lib/furnace/ast/matcher/dsl.rb
furnace-0.1.0 lib/furnace/ast/matcher/dsl.rb
furnace-0.0.8 lib/furnace/ast/matcher/dsl.rb
furnace-0.0.7 lib/furnace/ast/matcher/dsl.rb
furnace-0.0.6 lib/furnace/ast/matcher/dsl.rb