class BELParser::Script::Syntax::InvalidRegexPattern

Constants

TARGET_NODE

AST node representing a Pattern.

Public Class Methods

map(ast_node, script_context) click to toggle source
# File lib/bel_parser/script/syntax/invalid_regex_pattern.rb, line 15
def self.map(ast_node, script_context)
  return nil unless ast_node.is_a?(TARGET_NODE)
  pattern = ast_node.string.string_literal
  begin
    Regexp.new(pattern)
    nil
  rescue RegexpError => error
    InvalidRegexPatternError.new(ast_node, pattern, error.to_s)
  end
end