Add regexp support for /\h/

This commit is contained in:
John Backus 2016-08-14 13:53:58 -07:00
parent 870c7159b6
commit d2300f686d
No known key found for this signature in database
GPG key ID: 9A91898D0B0B2FBE
2 changed files with 6 additions and 0 deletions

View file

@ -70,6 +70,7 @@ module Mutant
[:regexp_script_hiragana_property, [:property, :script_hiragana, '\p{Hiragana}'], ::Regexp::Expression::UnicodeProperty::Script], [:regexp_script_hiragana_property, [:property, :script_hiragana, '\p{Hiragana}'], ::Regexp::Expression::UnicodeProperty::Script],
[:regexp_script_katakana_property, [:property, :script_katakana, '\p{Katakana}'], ::Regexp::Expression::UnicodeProperty::Script], [:regexp_script_katakana_property, [:property, :script_katakana, '\p{Katakana}'], ::Regexp::Expression::UnicodeProperty::Script],
[:regexp_letter_any_property, [:property, :letter_any, '\p{L}'], ::Regexp::Expression::UnicodeProperty::Letter::Any], [:regexp_letter_any_property, [:property, :letter_any, '\p{L}'], ::Regexp::Expression::UnicodeProperty::Letter::Any],
[:regexp_hex_type, [:type, :hex, '\h'], ::Regexp::Expression::CharacterType::Hex],
[:regexp_digit_type, [:type, :digit, '\d'], ::Regexp::Expression::CharacterType::Digit], [:regexp_digit_type, [:type, :digit, '\d'], ::Regexp::Expression::CharacterType::Digit],
[:regexp_space_type, [:type, :space, '\s'], ::Regexp::Expression::CharacterType::Space], [:regexp_space_type, [:type, :space, '\s'], ::Regexp::Expression::CharacterType::Space],
[:regexp_word_type, [:type, :word, '\w'], ::Regexp::Expression::CharacterType::Word], [:regexp_word_type, [:type, :word, '\w'], ::Regexp::Expression::CharacterType::Word],

View file

@ -611,6 +611,11 @@ RegexpSpec.expect_mapping(/\w/, :regexp_word_type) do
s(:regexp_word_type)) s(:regexp_word_type))
end end
RegexpSpec.expect_mapping(/\h/, :regexp_hex_type) do
s(:regexp_root_expression,
s(:regexp_hex_type))
end
RegexpSpec.expect_mapping(/\*/, :regexp_zero_or_more_escape) do RegexpSpec.expect_mapping(/\*/, :regexp_zero_or_more_escape) do
s(:regexp_root_expression, s(:regexp_root_expression,
s(:regexp_zero_or_more_escape)) s(:regexp_zero_or_more_escape))