Skip to content

Commit

Permalink
Whitelist regexp_parser warning and bump regexp_parser to 0.4.9
Browse files Browse the repository at this point in the history
* Add regexp_xgrapheme_type
  • Loading branch information
zaidan committed Jan 23, 2018
1 parent 766edf7 commit b95aa9c
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 25 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PATH
parallel (~> 1.3)
parser (>= 2.3.1.4, < 2.5)
procto (~> 0.0.2)
regexp_parser (~> 0.4.4)
regexp_parser (~> 0.4.9)
unparser (~> 0.2.5)
mutant-rspec (0.8.14)
mutant (~> 0.8.14)
Expand Down Expand Up @@ -92,7 +92,7 @@ GEM
equalizer (~> 0.0.9)
ice_nine (~> 0.11.0)
procto (~> 0.0.2)
parallel (1.11.2)
parallel (1.12.1)
parser (2.4.0.0)
ast (~> 2.2)
path_expander (1.0.2)
Expand All @@ -105,7 +105,7 @@ GEM
codeclimate-engine-rb (~> 0.4.0)
parser (>= 2.4.0.0, < 2.5)
rainbow (~> 2.0)
regexp_parser (0.4.4)
regexp_parser (0.4.9)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
Expand Down Expand Up @@ -166,4 +166,4 @@ DEPENDENCIES
mutant!

BUNDLED WITH
1.15.1
1.15.4
1 change: 1 addition & 0 deletions lib/mutant/ast/regexp/transformer/direct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class ASTToExpression < Transformer::ASTToExpression
[:regexp_digit_type, [:type, :digit, '\d'], ::Regexp::Expression::CharacterType::Digit],
[:regexp_space_type, [:type, :space, '\s'], ::Regexp::Expression::CharacterType::Space],
[:regexp_word_type, [:type, :word, '\w'], ::Regexp::Expression::CharacterType::Word],
[:regexp_xgrapheme_type, [:type, :xgrapheme, '\X'], ::Regexp::Expression::CharacterType::ExtendedGrapheme],
[:regexp_hex_type, [:type, :hex, '\h'], ::Regexp::Expression::CharacterType::Hex],
[:regexp_nonhex_type, [:type, :nonhex, '\H'], ::Regexp::Expression::CharacterType::NonHex],
[:regexp_nondigit_type, [:type, :nondigit, '\D'], ::Regexp::Expression::CharacterType::NonDigit],
Expand Down
1 change: 1 addition & 0 deletions lib/mutant/ast/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ module Types
regexp_whitespace_free_space
regexp_word_boundary_anchor
regexp_word_type
regexp_xgrapheme_type
regexp_zero_or_more_escape
regexp_zero_or_one_escape
])
Expand Down
1 change: 1 addition & 0 deletions lib/mutant/mutator/node/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Generic < self
regexp_space_type
regexp_word_boundary_anchor
regexp_word_type
regexp_xgrapheme_type
]

# These nodes still need a dedicated mutator,
Expand Down
3 changes: 2 additions & 1 deletion lib/mutant/mutator/node/regexp/character_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class CharacterType < Node
regexp_hex_type: :regexp_nonhex_type,
regexp_space_type: :regexp_nonspace_type,
regexp_word_boundary_anchor: :regexp_nonword_boundary_anchor,
regexp_word_type: :regexp_nonword_type
regexp_word_type: :regexp_nonword_type,
regexp_xgrapheme_type: :regexp_space_type
}

MAP = IceNine.deep_freeze(map.merge(map.invert))
Expand Down
3 changes: 2 additions & 1 deletion meta/regexp/character_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[:regexp_hex_type, '/\h/'] => [:regexp_nonhex_type, '/\H/'],
[:regexp_space_type, '/\s/'] => [:regexp_nonspace_type, '/\S/'],
[:regexp_word_boundary_anchor, '/\b/'] => [:regexp_nonword_boundary_anchor, '/\B/'],
[:regexp_word_type, '/\w/'] => [:regexp_nonword_type, '/\W/']
[:regexp_word_type, '/\w/'] => [:regexp_nonword_type, '/\W/'],
[:regexp_xgrapheme_type, '/\X/'] => [:regexp_space_type, '/\s/']
}

mutations = mutations.merge(mutations.invert)
Expand Down
2 changes: 1 addition & 1 deletion mutant.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency('equalizer', '~> 0.0.9')
gem.add_runtime_dependency('anima', '~> 0.3.0')
gem.add_runtime_dependency('concord', '~> 0.1.5')
gem.add_runtime_dependency('regexp_parser', '~> 0.4.4')
gem.add_runtime_dependency('regexp_parser', '~> 0.4.9')

gem.add_development_dependency('devtools', '~> 0.1.12')
gem.add_development_dependency('bundler', '~> 1.10')
Expand Down
2 changes: 2 additions & 0 deletions spec/support/warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
- 'lib/parallel.rb:227: warning: shadowing outer local variable - args'
- 'lib/parser/lexer.rb:10922: warning: assigned but unused variable - testEof'
- 'lib/regexp_parser/scanner.rb:1675: warning: assigned but unused variable - testEof'
- 'lib/regexp_parser/scanner.rb:1692: warning: assigned but unused variable - testEof'
- 'lib/regexp_parser/scanner.rb:1689: warning: assigned but unused variable - testEof'
26 changes: 8 additions & 18 deletions spec/unit/mutant/ast/regexp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,7 @@ def self.expect_mapping(regexp, type, &block)
)/, :regexp_comment_free_space) do
s(:regexp_root_expression,
s(:regexp_options_group, {
m: false,
i: false,
x: true,
d: false,
a: false,
u: false
x: true
},
s(:regexp_whitespace_free_space, ' '),
s(:regexp_comment_free_space, "# comment\n")))
Expand Down Expand Up @@ -354,6 +349,11 @@ def self.expect_mapping(regexp, type, &block)
s(:regexp_nonhex_type))
end

RegexpSpec.expect_mapping(/\X/, :regexp_xgrapheme_type) do
s(:regexp_root_expression,
s(:regexp_xgrapheme_type))
end

RegexpSpec.expect_mapping(/\}/, :regexp_interval_close_escape) do
s(:regexp_root_expression,
s(:regexp_interval_close_escape))
Expand Down Expand Up @@ -480,12 +480,7 @@ def self.expect_mapping(regexp, type, &block)
s(:regexp_greedy_one_or_more, 1, -1,
s(:regexp_options_group,
{
m: false,
i: true,
x: false,
d: false,
a: false,
u: false
i: true
},
s(:regexp_literal_literal, 'a'))))
end
Expand All @@ -494,12 +489,7 @@ def self.expect_mapping(regexp, type, &block)
s(:regexp_root_expression,
s(:regexp_options_group,
{
m: false,
i: false,
x: true,
d: false,
a: false,
u: false
x: true
},
s(:regexp_whitespace_free_space, " \n ")))
end
Expand Down

0 comments on commit b95aa9c

Please sign in to comment.