mutant 0.11.6 → 0.11.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 945d6584e161b704f52d2f1efc3b6a78df03cc0f6b48d52f157bf47720623725
4
- data.tar.gz: 7a507de1188d5d8a89740730d827c89f818dee72b844f3bccfa97264d1c1e266
3
+ metadata.gz: 528f60da9e74733ccadd735e902e4cbb0110c9bda457eb53e9338196ef668f0d
4
+ data.tar.gz: 440f31b09c0645f17aa9a97e1b0ee3849afa21aa1f294c230fbc1b8b3ee38e65
5
5
  SHA512:
6
- metadata.gz: f37bb36a48e29385936390ebd92790051871b6ee9b5fe053c1249815ab4432db1dbe7633e236d5bf40c04a488c1f0288bca9e29b8282f7c8a4bd2bfe0da5ee15
7
- data.tar.gz: 281fc2061663198b9676c1000793104c7bb52fed3f4892b02419bd7a7aaf2a7168f23fb1c7ba0653710900cd7bf2637de99998da37b87cac1ca021a2dd10b0d8
6
+ metadata.gz: bb351a02f90e45871181af56c4e2288373c39aea7f158d10e19562f10a4d5447d2142a1dff49934fef08ec8e59754959aec560e1ebfa970bfa2ed15686f14982
7
+ data.tar.gz: e060943a2504bad9a542d3eb6b927e6ca7cf86a79244d1179386f7074c78e4fbfb1a97890d371d79a7298138610b84c1ec75e04a0cf9cbeb146a176b8657c6bd
@@ -36,13 +36,52 @@ module Mutant
36
36
  class ASTToExpression < Transformer::ASTToExpression
37
37
  include LookupTable
38
38
 
39
+ # rubocop:disable Metrics/BlockLength
40
+ properties = ::Regexp::Syntax
41
+ .version_class("ruby/#{RUBY_VERSION}")
42
+ .features.fetch(:property)
43
+ .flat_map do |property|
44
+ property_specifier = "\\p{#{property}}"
45
+ non_property_specifier = "\\P{#{property}}"
46
+
47
+ begin
48
+ property_regex = /#{property_specifier}/
49
+ non_property_regex = /#{non_property_specifier}/
50
+ # This is probably a regexp_parser bug, ignoring registration of that property
51
+ # See: https://github.com/ammar/regexp_parser/issues/84
52
+ rescue RegexpError
53
+ next
54
+ end
55
+
56
+ [
57
+ [
58
+ :"regexp_#{property}_property",
59
+ [
60
+ :property,
61
+ property.to_sym,
62
+ property_specifier
63
+ ],
64
+ ::Regexp::Parser.parse(property_regex).expressions.first.class
65
+ ],
66
+ [
67
+ :"regexp_#{property}_nonproperty",
68
+ [
69
+ :nonproperty,
70
+ property.to_sym,
71
+ non_property_specifier
72
+ ],
73
+ ::Regexp::Parser.parse(non_property_regex).expressions.first.class
74
+ ]
75
+ ]
76
+ end.compact
77
+ # rubocop:enable Metrics/BlockLength
78
+
39
79
  # rubocop:disable Layout/LineLength
40
80
  TABLE = Table.create(
81
+ *properties,
41
82
  [:regexp_alnum_posixclass, [:posixclass, :alnum, '[:alnum:]'], ::Regexp::Expression::PosixClass],
42
83
  [:regexp_alpha_posixclass, [:posixclass, :alpha, '[:alpha:]'], ::Regexp::Expression::PosixClass],
43
- [:regexp_alpha_property, [:property, :alpha, '\p{Alpha}'], ::Regexp::Expression::UnicodeProperty::Alpha],
44
84
  [:regexp_alternation_escape, [:escape, :alternation, '\|'], ::Regexp::Expression::EscapeSequence::Literal],
45
- [:regexp_arabic_property, [:property, :arabic, '\p{Arabic}'], ::Regexp::Expression::UnicodeProperty::Script],
46
85
  [:regexp_ascii_posixclass, [:posixclass, :ascii, '[:ascii:]'], ::Regexp::Expression::PosixClass],
47
86
  [:regexp_backspace_escape, [:escape, :backspace, '\b'], ::Regexp::Expression::EscapeSequence::Backspace],
48
87
  [:regexp_bell_escape, [:escape, :bell, '\a'], ::Regexp::Expression::EscapeSequence::Literal],
@@ -65,16 +104,10 @@ module Mutant
65
104
  [:regexp_graph_posixclass, [:posixclass, :graph, '[:graph:]'], ::Regexp::Expression::PosixClass],
66
105
  [:regexp_group_close_escape, [:escape, :group_close, '\)'], ::Regexp::Expression::EscapeSequence::Literal],
67
106
  [:regexp_group_open_escape, [:escape, :group_open, '\('], ::Regexp::Expression::EscapeSequence::Literal],
68
- [:regexp_han_property, [:property, :han, '\p{Han}'], ::Regexp::Expression::UnicodeProperty::Script],
69
- [:regexp_hangul_property, [:property, :hangul, '\p{Hangul}'], ::Regexp::Expression::UnicodeProperty::Script],
70
107
  [:regexp_hex_type, [:type, :hex, '\h'], ::Regexp::Expression::CharacterType::Hex],
71
- [:regexp_hiragana_property, [:property, :hiragana, '\p{Hiragana}'], ::Regexp::Expression::UnicodeProperty::Script],
72
108
  [:regexp_interval_close_escape, [:escape, :interval_close, '\}'], ::Regexp::Expression::EscapeSequence::Literal],
73
109
  [:regexp_interval_open_escape, [:escape, :interval_open, '\{'], ::Regexp::Expression::EscapeSequence::Literal],
74
- [:regexp_katakana_property, [:property, :katakana, '\p{Katakana}'], ::Regexp::Expression::UnicodeProperty::Script],
75
- [:regexp_letter_property, [:property, :letter, '\p{L}'], ::Regexp::Expression::UnicodeProperty::Letter::Any],
76
110
  [:regexp_linebreak_type, [:type, :linebreak, '\R'], ::Regexp::Expression::CharacterType::Linebreak],
77
- [:regexp_latin_property, [:property, :latin, '\p{Latin}'], ::Regexp::Expression::UnicodeProperty::Script],
78
111
  [:regexp_lower_posixclass, [:posixclass, :lower, '[:lower:]'], ::Regexp::Expression::PosixClass],
79
112
  [:regexp_mark_keep, [:keep, :mark, '\K'], ::Regexp::Expression::Keep::Mark],
80
113
  [:regexp_match_start_anchor, [:anchor, :match_start, '\\G'], ::Regexp::Expression::Anchor::MatchStart],
@@ -86,10 +119,8 @@ module Mutant
86
119
  [:regexp_nonword_type, [:type, :nonword, '\W'], ::Regexp::Expression::CharacterType::NonWord],
87
120
  [:regexp_one_or_more_escape, [:escape, :one_or_more, '\+'], ::Regexp::Expression::EscapeSequence::Literal],
88
121
  [:regexp_print_nonposixclass, [:nonposixclass, :print, '[:^print:]'], ::Regexp::Expression::PosixClass],
89
- [:regexp_print_nonproperty, [:nonproperty, :print, '\P{Print}'], ::Regexp::Expression::UnicodeProperty::Print],
90
122
  [:regexp_print_posixclass, [:posixclass, :print, '[:print:]'], ::Regexp::Expression::PosixClass],
91
123
  [:regexp_print_posixclass, [:posixclass, :print, '[:print:]'], ::Regexp::Expression::PosixClass],
92
- [:regexp_print_property, [:property, :print, '\p{Print}'], ::Regexp::Expression::UnicodeProperty::Print],
93
124
  [:regexp_punct_posixclass, [:posixclass, :punct, '[:punct:]'], ::Regexp::Expression::PosixClass],
94
125
  [:regexp_set_close_escape, [:escape, :set_close, '\]'], ::Regexp::Expression::EscapeSequence::Literal],
95
126
  [:regexp_set_open_escape, [:escape, :set_open, '\['], ::Regexp::Expression::EscapeSequence::Literal],