Sha256: e8418689e53a8bd64d3d24a781751c2a102d2c614ffced6eaab7975bfe87587c

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

module Regexp::Expression
  module Backreference
    class Base < Regexp::Expression::Base; end

    class Number < Backreference::Base
      attr_reader :number

      def initialize(token, options = {})
        @number = token.text[token.token.equal?(:number) ? 1..-1 : 3..-2].to_i
        super
      end
    end

    class Name < Backreference::Base
      attr_reader :name

      def initialize(token, options = {})
        @name = token.text[3..-2]
        super
      end
    end

    class NumberCall         < Backreference::Number; end
    class NumberRelative     < Backreference::Number; end
    class NumberCallRelative < Backreference::Number; end
    class NameCall < Backreference::Name; end

    class NumberRecursionLevel < Backreference::Base
      attr_reader :number, :recursion_level

      def initialize(token, options = {})
        @number, @recursion_level = token.text[3..-2].split(/(?=[+-])/).map(&:to_i)
        super
      end
    end

    class NameRecursionLevel < Backreference::Base
      attr_reader :name, :recursion_level

      def initialize(token, options = {})
        @name, recursion_level = token.text[3..-2].split(/(?=[+-])/)
        @recursion_level = recursion_level.to_i
        super
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
tdiary-5.0.13 vendor/bundle/gems/regexp_parser-1.3.0/lib/regexp_parser/expression/classes/backref.rb
regexp_parser-1.4.0 lib/regexp_parser/expression/classes/backref.rb
tdiary-5.0.12.1 vendor/bundle/gems/regexp_parser-1.3.0/lib/regexp_parser/expression/classes/backref.rb
tdiary-5.0.11 vendor/bundle/gems/regexp_parser-1.3.0/lib/regexp_parser/expression/classes/backref.rb
regexp_parser-1.3.0 lib/regexp_parser/expression/classes/backref.rb
regexp_parser-1.2.0 lib/regexp_parser/expression/classes/backref.rb
regexp_parser-1.1.0 lib/regexp_parser/expression/classes/backref.rb
regexp_parser-1.0.0 lib/regexp_parser/expression/classes/backref.rb