class BELParser::Language::Semantics::SemanticIsSequencePosition

AST node for IsSequencePosition is a semantic AST.

Public Class Methods

new(**properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 765
def initialize(**properties)
  super(:is_sequence_position, [], properties)
end

Public Instance Methods

match(value_node, spec, will_match_partial = false) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 769
def match(value_node, spec, will_match_partial = false)
  string_literal = value_node.children[0].string_literal
  integer_position =
    begin
      Integer(string_literal)
    rescue
      nil
    end
  if integer_position && integer_position > 0
    success(value_node, spec)
  else
    invalid_sequence_position_warning(value_node, spec)
  end
end