Class: BELParser::Language::Syntax::SyntaxError

Inherits:
SyntaxResult
  • Object
show all
Defined in:
lib/bel_parser/language/syntax_error.rb

Overview

SyntaxError defines a SyntaxResult that should be regarded as an error with the expression.

Instance Attribute Summary

Attributes inherited from SyntaxResult

#expression_node, #specification

Instance Method Summary collapse

Constructor Details

#initialize(expression_node, specification) ⇒ SyntaxError

Returns a new instance of SyntaxError.



9
10
11
# File 'lib/bel_parser/language/syntax_error.rb', line 9

def initialize(expression_node, specification)
  super(expression_node, specification)
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/bel_parser/language/syntax_error.rb', line 22

def failure?
  true
end

#msgObject

This method is abstract.

Subclass and override #msg to provide the message.

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/bel_parser/language/syntax_error.rb', line 14

def msg
  raise NotImplementedError, "#{__method__} is not implemented."
end

#success?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/bel_parser/language/syntax_error.rb', line 18

def success?
  false
end

#to_sObject



26
27
28
# File 'lib/bel_parser/language/syntax_error.rb', line 26

def to_s
  "Error: #{msg}"
end