class BELParser::Script::Syntax::UndefinedAnnotationValue
Constants
Public Class Methods
annotation(name_string, script_context)
click to toggle source
# File lib/bel_parser/script/syntax/undefined_annotation_value.rb, line 51 def self.annotation(name_string, script_context) hash = script_context[:annotation_definitions] ||= Concurrent::Hash.new hash[name_string] end
map(ast_node, script_context)
click to toggle source
# File lib/bel_parser/script/syntax/undefined_annotation_value.rb, line 18 def self.map(ast_node, script_context) return nil unless ast_node.is_a?(TARGET_NODE) name, value = ast_node.children name_string = ast_node.name.identifier.string_literal return nil if is_implicit_annotation?(name_string) type, dataset = annotation(name_string, script_context) return nil unless type == :uri || type == :url reader = case type when :uri script_context[:uri_reader] when :url script_context[:url_reader] end value_node = ast_node.value.children[0] if value_node.is_a?(LIST_NODE) value_node .list_items.map { |li| li.children[0].string_literal } .map do |string| map_value(ast_node, name_string, string, dataset.identifier, reader) end else map_value( ast_node, name_string, value_node.string_literal, dataset.identifier, reader) end end
map_value(ast_node, name_string, value_string, identifier, reader)
click to toggle source
# File lib/bel_parser/script/syntax/undefined_annotation_value.rb, line 57 def self.map_value(ast_node, name_string, value_string, identifier, reader) value = reader.retrieve_value_from_resource(identifier, value_string) UndefinedAnnotationValueWarning.new( ast_node, name_string, value_string) unless value end