Class: BELParser::Script::Syntax::UnsupportedBELVersion
- Inherits:
-
Object
- Object
- BELParser::Script::Syntax::UnsupportedBELVersion
- Extended by:
- Language::Syntax::SyntaxFunction, Keyword
- Defined in:
- lib/bel_parser/script/syntax/unsupported_bel_version.rb
Constant Summary collapse
- TARGET_NODE =
BELParser::Parsers::AST::DocumentProperty
Constants included from Keyword
Keyword::BEL_VERSION_REGEX, Keyword::BEL_VERSION_STRING, Keyword::CITATION, Keyword::CITATION_REGEX, Keyword::IMPLICIT_ANNOTATIONS, Keyword::SUPPORT, Keyword::SUPPORT_REGEX
Class Method Summary collapse
Methods included from Keyword
is_bel_version?, is_citation?, is_implicit_annotation?, is_support?
Class Method Details
.map(ast_node, script_context) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bel_parser/script/syntax/unsupported_bel_version.rb', line 17 def self.map(ast_node, script_context) return nil unless ast_node.is_a?(TARGET_NODE) name, value = ast_node.children name_string = name.identifier.string_literal return nil unless is_bel_version?(name_string) value_string = value.children[0].string_literal begin BELParser::Language.specification(value_string) nil rescue ArgumentError script_context[:specification] = BELParser::Language.default_specification UnsupportedBELVersionWarning.new(ast_node, value_string) end end |