Class: JsRegex::Converter::TypeConverter

Inherits:
Base
  • Object
show all
Defined in:
lib/js_regex/converter/type_converter.rb

Overview

Template class implementation.

Constant Summary collapse

HEX_EXPANSION =
'[0-9A-Fa-f]'
NONHEX_EXPANSION =
'[^0-9A-Fa-f]'
LINEBREAK_EXPANSION =
'(?:\r\n|[\n\v\f\r\u0085\u2028\u2029])'

Class Method Summary collapse

Methods inherited from Base

#convert

Class Method Details

.directly_compatible?(expression) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
# File 'lib/js_regex/converter/type_converter.rb', line 13

def self.directly_compatible?(expression)
  case expression.token
  when :space, :nonspace
    !expression.ascii_classes?
  when :digit, :nondigit, :word, :nonword
    !expression.unicode_classes?
  end
end