Sha256: e54d57ee873345267e184f8abca7a07d5467c7bc6147366746bb22775206400b

Contents?: true

Size: 1022 Bytes

Versions: 115

Compression:

Stored size: 1022 Bytes

Contents

module Regexp::Expression
  # A sequence of expressions. Differs from a Subexpressions by how it handles
  # quantifiers, as it applies them to its last element instead of itself as
  # a whole subexpression.
  #
  # Used as the base class for the Alternation alternatives, Conditional
  # branches, and CharacterSet::Intersection intersected sequences.
  class Sequence < Regexp::Expression::Subexpression
    class << self
      def add_to(exp, params = {}, active_opts = {})
        sequence = construct(
          level:             exp.level,
          set_level:         exp.set_level,
          conditional_level: params[:conditional_level] || exp.conditional_level,
          ts:                params[:ts],
        )
        sequence.options = active_opts
        exp.expressions << sequence
        sequence
      end
    end

    def ts
      (head = expressions.first) ? head.ts : @ts
    end

    def quantify(token, *args)
      extract_quantifier_target(token.text).quantify(token, *args)
    end
  end
end

Version data entries

115 entries across 114 versions & 18 rubygems

Version Path
siteimprove_api_client-1.0.1 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.10.0/lib/regexp_parser/expression/sequence.rb
tailscale_middleware-0.0.3 vendor/cache/ruby/3.4.0/gems/regexp_parser-2.10.0/lib/regexp_parser/expression/sequence.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/lib/regexp_parser/expression/sequence.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/regexp_parser-2.9.2/lib/regexp_parser/expression/sequence.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.2/lib/regexp_parser/expression/sequence.rb
regexp_parser-2.10.0 lib/regexp_parser/expression/sequence.rb
regexp_parser-2.9.3 lib/regexp_parser/expression/sequence.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.2/lib/regexp_parser/expression/sequence.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/lib/regexp_parser/expression/sequence.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.8.2/lib/regexp_parser/expression/sequence.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.4 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.3 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.2 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.1 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb
study_line-0.2.0 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.0/lib/regexp_parser/expression/sequence.rb