Sha256: 54f6e2795361a7b5aa026507ac8bea1cc70033bbc20e65c5a00f858230d79232

Contents?: true

Size: 1.61 KB

Versions: 7

Compression:

Stored size: 1.61 KB

Contents

module Regexp::Expression
  module Group
    class Base < Regexp::Expression::Subexpression
      def parts
        [text.dup, *expressions, ')']
      end

      def capturing?; false end

      def comment?; false end
    end

    class Passive < Group::Base
      attr_writer :implicit

      def initialize(*)
        @implicit = false
        super
      end

      def parts
        if implicit?
          expressions
        else
          super
        end
      end

      def implicit?
        @implicit
      end
    end

    class Absence < Group::Base; end
    class Atomic  < Group::Base; end
    class Options < Group::Base
      attr_accessor :option_changes

      def initialize_copy(orig)
        self.option_changes = orig.option_changes.dup
        super
      end
    end

    class Capture < Group::Base
      attr_accessor :number, :number_at_level
      alias identifier number

      def capturing?; true end
    end

    class Named < Group::Capture
      attr_reader :name
      alias identifier name

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

      def initialize_copy(orig)
        @name = orig.name.dup
        super
      end
    end

    class Comment < Group::Base
      def parts
        [text.dup]
      end

      def comment?; true end
    end
  end

  module Assertion
    class Base < Regexp::Expression::Group::Base; end

    class Lookahead           < Assertion::Base; end
    class NegativeLookahead   < Assertion::Base; end

    class Lookbehind          < Assertion::Base; end
    class NegativeLookbehind  < Assertion::Base; end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/regexp_parser-2.5.0/lib/regexp_parser/expression/classes/group.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/regexp_parser-2.5.0/lib/regexp_parser/expression/classes/group.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/regexp_parser-2.5.0/lib/regexp_parser/expression/classes/group.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/regexp_parser-2.5.0/lib/regexp_parser/expression/classes/group.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/regexp_parser-2.5.0/lib/regexp_parser/expression/classes/group.rb
regexp_parser-2.5.0 lib/regexp_parser/expression/classes/group.rb
regexp_parser-2.4.0 lib/regexp_parser/expression/classes/group.rb