class BELParser::Script::Syntax::UnresolvableNamespace
Constants
- TARGET_NODE
AST
node representing the definition of a namespace.
Public Class Methods
map(ast_node, script_context)
click to toggle source
# File lib/bel_parser/script/syntax/unresolvable_namespace.rb, line 15 def self.map(ast_node, script_context) return nil unless ast_node.is_a?(TARGET_NODE) uri_reader, url_reader = script_context.values_at(:uri_reader, :url_reader) keyword, domain = ast_node.children if domain.url? ApplyResourceURI.new.process(ast_node) if ast_node.uri uri = ast_node.uri unless uri_reader.retrieve_resource(uri) prefix = keyword.identifier.string_literal return UnresolvableNamespaceError.new(ast_node, prefix, uri) end else url = domain.child.string.string_literal unless url_reader.retrieve_resource(url) prefix = keyword.identifier.string_literal return UnresolvableNamespaceError.new(ast_node, prefix, url) end end end nil end