Class: BELParser::Language::Semantics::SemanticIsAminoAcidRange

Inherits:
SemanticASTNode show all
Defined in:
lib/bel_parser/language/semantics_ast.rb

Overview

AST node for IsAminoAcidRange is a semantic AST.

Constant Summary collapse

START_STOP =
/[1-9][0-9]*_[1-9][0-9]*/
UNDETERMINED =
/[1?]_[?*]/
UNKNOWN_START_STOP =
'?'.freeze

Instance Attribute Summary

Attributes inherited from AST::Node

#children, #hash, #type

Instance Method Summary collapse

Methods inherited from SemanticASTNode

#terminal?

Methods inherited from AST::Node

#==, #append, #concat, #dup, #eql?, #inspect, #to_a, #to_ast, #to_sexp, #updated

Constructor Details

#initialize(**properties) ⇒ SemanticIsAminoAcidRange

Returns a new instance of SemanticIsAminoAcidRange.



741
742
743
# File 'lib/bel_parser/language/semantics_ast.rb', line 741

def initialize(**properties)
  super(:is_amino_acid_range, [], properties)
end

Instance Method Details

#match(value_node, spec) ⇒ Object



745
746
747
748
749
750
751
752
753
# File 'lib/bel_parser/language/semantics_ast.rb', line 745

def match(value_node, spec)
  string_literal = value_node.children[0]
  case string_literal
  when START_STOP, UNDETERMINED, UNKNOWN_START_STOP
    success(value_node, spec)
  else
    invalid_amino_acid_range_warning(value_node, spec)
  end
end