class BELParser::Script::Syntax::UndefinedAnnotation

Constants

TARGET_NODE

AST node representing a set.

Public Class Methods

map(ast_node, script_context) click to toggle source
# File lib/bel_parser/script/syntax/undefined_annotation.rb, line 18
def self.map(ast_node, script_context)
  return nil unless ast_node.is_a?(TARGET_NODE)
  name_string = ast_node.name.identifier.string_literal
  annotation_definitions =
    script_context[:annotation_definitions] ||= Concurrent::Hash.new

  return nil if is_implicit_annotation?(name_string)
  return nil if annotation_definitions.key?(name_string)
  UndefinedAnnotationError.new(
    ast_node,
    name_string,
    script_context[:annotation_definitions])
end