Class: BELParser::Script::Syntax::InvalidRegexPatternError

Inherits:
Language::Syntax::SyntaxError show all
Defined in:
lib/bel_parser/script/syntax/invalid_regex_pattern.rb

Overview

InvalidRegexPattern indicates that a pattern represented an invalid regular expression.

Instance Attribute Summary collapse

Attributes inherited from Language::Syntax::SyntaxResult

#expression_node, #specification

Instance Method Summary collapse

Methods inherited from Language::Syntax::SyntaxError

#failure?, #success?, #to_s

Methods inherited from Language::Syntax::SyntaxResult

#failure?, #success?, #to_s

Constructor Details

#initialize(pattern_node, pattern, error_msg) ⇒ InvalidRegexPatternError

Returns a new instance of InvalidRegexPatternError.



33
34
35
36
37
# File 'lib/bel_parser/script/syntax/invalid_regex_pattern.rb', line 33

def initialize(pattern_node, pattern, error_msg)
  super(pattern_node, nil)
  @pattern   = pattern
  @error_msg = error_msg
end

Instance Attribute Details

#patternObject (readonly)

Gets the invalid pattern.



31
32
33
# File 'lib/bel_parser/script/syntax/invalid_regex_pattern.rb', line 31

def pattern
  @pattern
end

Instance Method Details

#msgObject



39
40
41
42
43
# File 'lib/bel_parser/script/syntax/invalid_regex_pattern.rb', line 39

def msg
  <<-MSG.gsub(/^ +/, '').delete("\n")
    "#@pattern" is not a valid regular expression (#@error_msg).
  MSG
end