Skip to content

Commit

Permalink
Merge pull request #90 from koic/use_require_relative
Browse files Browse the repository at this point in the history
Use `require_relative` in the Regexp::Parser codebase
  • Loading branch information
jaynetics authored May 11, 2024
2 parents 8766c03 + 2aef678 commit 0ec8b3e
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 61 deletions.
12 changes: 6 additions & 6 deletions lib/regexp_parser.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'regexp_parser/version'
require 'regexp_parser/token'
require 'regexp_parser/scanner'
require 'regexp_parser/syntax'
require 'regexp_parser/lexer'
require 'regexp_parser/parser'
require_relative 'regexp_parser/version'
require_relative 'regexp_parser/token'
require_relative 'regexp_parser/scanner'
require_relative 'regexp_parser/syntax'
require_relative 'regexp_parser/lexer'
require_relative 'regexp_parser/parser'
68 changes: 34 additions & 34 deletions lib/regexp_parser/expression.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
require 'regexp_parser/error'
require_relative 'error'

require 'regexp_parser/expression/shared'
require 'regexp_parser/expression/base'
require 'regexp_parser/expression/quantifier'
require 'regexp_parser/expression/subexpression'
require 'regexp_parser/expression/sequence'
require 'regexp_parser/expression/sequence_operation'
require_relative 'expression/shared'
require_relative 'expression/base'
require_relative 'expression/quantifier'
require_relative 'expression/subexpression'
require_relative 'expression/sequence'
require_relative 'expression/sequence_operation'

require 'regexp_parser/expression/classes/alternation'
require 'regexp_parser/expression/classes/anchor'
require 'regexp_parser/expression/classes/backreference'
require 'regexp_parser/expression/classes/character_set'
require 'regexp_parser/expression/classes/character_set/intersection'
require 'regexp_parser/expression/classes/character_set/range'
require 'regexp_parser/expression/classes/character_type'
require 'regexp_parser/expression/classes/conditional'
require 'regexp_parser/expression/classes/escape_sequence'
require 'regexp_parser/expression/classes/free_space'
require 'regexp_parser/expression/classes/group'
require 'regexp_parser/expression/classes/keep'
require 'regexp_parser/expression/classes/literal'
require 'regexp_parser/expression/classes/posix_class'
require 'regexp_parser/expression/classes/root'
require 'regexp_parser/expression/classes/unicode_property'
require_relative 'expression/classes/alternation'
require_relative 'expression/classes/anchor'
require_relative 'expression/classes/backreference'
require_relative 'expression/classes/character_set'
require_relative 'expression/classes/character_set/intersection'
require_relative 'expression/classes/character_set/range'
require_relative 'expression/classes/character_type'
require_relative 'expression/classes/conditional'
require_relative 'expression/classes/escape_sequence'
require_relative 'expression/classes/free_space'
require_relative 'expression/classes/group'
require_relative 'expression/classes/keep'
require_relative 'expression/classes/literal'
require_relative 'expression/classes/posix_class'
require_relative 'expression/classes/root'
require_relative 'expression/classes/unicode_property'

require 'regexp_parser/expression/methods/construct'
require 'regexp_parser/expression/methods/human_name'
require 'regexp_parser/expression/methods/match'
require 'regexp_parser/expression/methods/match_length'
require 'regexp_parser/expression/methods/negative'
require 'regexp_parser/expression/methods/options'
require 'regexp_parser/expression/methods/parts'
require 'regexp_parser/expression/methods/printing'
require 'regexp_parser/expression/methods/strfregexp'
require 'regexp_parser/expression/methods/tests'
require 'regexp_parser/expression/methods/traverse'
require_relative 'expression/methods/construct'
require_relative 'expression/methods/human_name'
require_relative 'expression/methods/match'
require_relative 'expression/methods/match_length'
require_relative 'expression/methods/negative'
require_relative 'expression/methods/options'
require_relative 'expression/methods/parts'
require_relative 'expression/methods/printing'
require_relative 'expression/methods/strfregexp'
require_relative 'expression/methods/tests'
require_relative 'expression/methods/traverse'
4 changes: 2 additions & 2 deletions lib/regexp_parser/parser.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'regexp_parser/error'
require 'regexp_parser/expression'
require_relative 'error'
require_relative 'expression'

class Regexp::Parser
include Regexp::Expression
Expand Down
2 changes: 1 addition & 1 deletion lib/regexp_parser/scanner/errors/scanner_error.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'regexp_parser/error'
require_relative '../../../regexp_parser/error'

class Regexp::Scanner
# General scanner error (catch all)
Expand Down
6 changes: 3 additions & 3 deletions lib/regexp_parser/scanner/scanner.rl
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,9 @@
*|;
}%%

require 'regexp_parser/scanner/errors/scanner_error'
require 'regexp_parser/scanner/errors/premature_end_error'
require 'regexp_parser/scanner/errors/validation_error'
require_relative 'scanner/errors/scanner_error'
require_relative 'scanner/errors/premature_end_error'
require_relative 'scanner/errors/validation_error'

class Regexp::Scanner
# Scans the given regular expression text, or Regexp object and collects the
Expand Down
2 changes: 1 addition & 1 deletion lib/regexp_parser/syntax.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'regexp_parser/error'
require_relative 'error'

module Regexp::Syntax
class SyntaxError < Regexp::Parser::Error; end
Expand Down
26 changes: 13 additions & 13 deletions lib/regexp_parser/syntax/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ module FreeSpace


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


# After loading all the tokens the map is full. Extract all tokens and types
Expand Down
2 changes: 1 addition & 1 deletion lib/regexp_parser/syntax/versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#
# Aliases for the latest patch version are provided as 'ruby/n.n',
# e.g. 'ruby/1.9' refers to Ruby v1.9.3.
Dir[File.expand_path('../versions/*.rb', __FILE__)].sort.each { |f| require f }
Dir[File.expand_path('../versions/*.rb', __FILE__)].sort.each { |f| require_relative f }

Regexp::Syntax::CURRENT = Regexp::Syntax.for("ruby/#{RUBY_VERSION}")

0 comments on commit 0ec8b3e

Please sign in to comment.