Sha256: a8075aba73d8ac220aa492ee4831d661ca8720f6b0572869c6cf800f86df4064
Contents?: true
Size: 1001 Bytes
Versions: 49
Compression:
Stored size: 1001 Bytes
Contents
require 'bel_parser/language' require 'bel_parser/parsers/ast/node' require 'concurrent/hash' require_relative '../keywords' require_relative '../state_function' module BELParser module Script module State class BELVersion extend StateFunction extend Keyword TARGET_NODE = BELParser::Parsers::AST::DocumentProperty DEFAULT_BEL_VERSION = '1.0' def self.consume(ast_node, script_context) return unless ast_node.is_a?(TARGET_NODE) name, value = ast_node.children name_string = name.identifier.string_literal return unless is_bel_version?(name_string) value_string = value.children[0].string_literal begin spec = BELParser::Language.specification(value_string) rescue ArgumentError spec = BELParser::Language.specification(DEFAULT_BEL_VERSION) end script_context[:specification] = spec end end end end end
Version data entries
49 entries across 49 versions & 1 rubygems