Class: BELParser::Language::Syntax::SyntaxResult

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

Overview

SyntaxResult represents the result of running a SyntaxFunction.

Direct Known Subclasses

SyntaxError, SyntaxWarning, Valid

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expression_node, specification) ⇒ SyntaxResult

Returns a new instance of SyntaxResult.



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

def initialize(expression_node, specification)
  @expression_node = expression_node
  @specification   = specification
end

Instance Attribute Details

#expression_nodeObject (readonly)

Returns the value of attribute expression_node.



6
7
8
# File 'lib/bel_parser/language/syntax_result.rb', line 6

def expression_node
  @expression_node
end

#specificationObject (readonly)

Returns the value of attribute specification.



6
7
8
# File 'lib/bel_parser/language/syntax_result.rb', line 6

def specification
  @specification
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/bel_parser/language/syntax_result.rb', line 17

def failure?
  false
end

#msgObject

This method is abstract.

Subclass and override #msg to provide the message.

Raises:

  • (NotImplementedError)


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

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

#success?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/bel_parser/language/syntax_result.rb', line 13

def success?
  true
end

#to_sObject



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

def to_s
  "Info: #{msg}"
end