Sha256: 8ba99863d0cc588e73a24587a5f33ac5fa8d30bf4776c73f90670d43c5fcbf66

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

# Define the base module and the simplest of tokens.
module Regexp::Syntax
  module Token
    Map = {}

    module Literal
      All = %i[literal]
      Type = :literal
    end

    module FreeSpace
      All  = %i[comment whitespace]
      Type = :free_space
    end

    Map[FreeSpace::Type] = FreeSpace::All
    Map[Literal::Type]   = Literal::All
  end
end


# Load all the token files, they will populate the Map constant.
require_relative 'token/anchor'
require_relative 'token/assertion'
require_relative 'token/backreference'
require_relative 'token/posix_class'
require_relative 'token/character_set'
require_relative 'token/character_type'
require_relative 'token/conditional'
require_relative 'token/escape'
require_relative 'token/group'
require_relative 'token/keep'
require_relative 'token/meta'
require_relative 'token/quantifier'
require_relative 'token/unicode_property'


# After loading all the tokens the map is full. Extract all tokens and types
# into the All and Types constants.
module Regexp::Syntax
  module Token
    All   = Map.values.flatten.uniq.sort.freeze
    Types = Map.keys.freeze
  end
end

Version data entries

8 entries across 7 versions & 6 rubygems

Version Path
tailscale_middleware-0.0.3 vendor/cache/ruby/3.4.0/gems/regexp_parser-2.10.0/lib/regexp_parser/syntax/token.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/regexp_parser-2.9.2/lib/regexp_parser/syntax/token.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/lib/regexp_parser/syntax/token.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.2/lib/regexp_parser/syntax/token.rb
regexp_parser-2.10.0 lib/regexp_parser/syntax/token.rb
regexp_parser-2.9.3 lib/regexp_parser/syntax/token.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/regexp_parser-2.9.2/lib/regexp_parser/syntax/token.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/lib/regexp_parser/syntax/token.rb