Class: BELParser::Script::Syntax::UndefinedAnnotationError
- Inherits:
-
Language::Syntax::SyntaxError
- Object
- Language::Syntax::SyntaxResult
- Language::Syntax::SyntaxError
- BELParser::Script::Syntax::UndefinedAnnotationError
- Defined in:
- lib/bel_parser/script/syntax/undefined_annotation.rb
Overview
UndefinedAnnotationError represents an undefined annotation seen when checking a SET annotation.
Instance Attribute Summary collapse
-
#prefix ⇒ Object
readonly
Gets the undefined prefix.
Attributes inherited from Language::Syntax::SyntaxResult
#expression_node, #specification
Instance Method Summary collapse
-
#initialize(set_node, prefix, annotation_definitions) ⇒ UndefinedAnnotationError
constructor
A new instance of UndefinedAnnotationError.
- #msg ⇒ Object
Methods inherited from Language::Syntax::SyntaxError
Methods inherited from Language::Syntax::SyntaxResult
Constructor Details
#initialize(set_node, prefix, annotation_definitions) ⇒ UndefinedAnnotationError
Returns a new instance of UndefinedAnnotationError.
39 40 41 42 43 |
# File 'lib/bel_parser/script/syntax/undefined_annotation.rb', line 39 def initialize(set_node, prefix, annotation_definitions) super(set_node, nil) @prefix = prefix @annotation_definitions = annotation_definitions end |
Instance Attribute Details
#prefix ⇒ Object (readonly)
Gets the undefined prefix.
37 38 39 |
# File 'lib/bel_parser/script/syntax/undefined_annotation.rb', line 37 def prefix @prefix end |
Instance Method Details
#msg ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/bel_parser/script/syntax/undefined_annotation.rb', line 45 def msg defined_annotations = if @annotation_definitions.empty? 'No annotations are defined.' else annotation_prefixes = @annotation_definitions.keys.join(', ') "Defined annotations: #{annotation_prefixes}" end <<-MSG.gsub(/^ +/, '').delete("\n") Annotation definition is missing for "#@prefix". #{defined_annotations} MSG end |