Sha256: d60751abc67298f1ef8887a3fa9cb7c7805440c6b9a523784ecf47e76f046f7b
Contents?: true
Size: 1.25 KB
Versions: 7
Compression:
Stored size: 1.25 KB
Contents
require 'bel_parser/language' require 'bel_parser/quoting' require 'bel_parser/parsers/ast/node' require 'concurrent/hash' require_relative '../state_function' module BELParser module Script module State class Unset extend StateFunction extend BELParser::Quoting TARGET_NODE = BELParser::Parsers::AST::Unset def self.consume(ast_node, script_context) return nil unless ast_node.is_a?(TARGET_NODE) name_string = ast_node.name.identifier.string_literal case name_string when /\ASTATEMENT_GROUP\Z/ handle_statement_group(script_context) else handle_annotation(name_string, script_context) end end def self.handle_annotation(name, script_context) script_context[:annotations] ||= Concurrent::Hash.new script_context[:annotations].delete(name) end private_class_method :handle_annotation def self.handle_statement_group(script_context) script_context.delete(:statement_group) script_context[:annotations] ||= Concurrent::Hash.new script_context[:annotations].clear end private_class_method :handle_statement_group end end end end
Version data entries
7 entries across 7 versions & 1 rubygems