Class: BELParser::Language::Semantics::SemanticIsSequencePosition
- Inherits:
-
SemanticASTNode
- Object
- AST::Node
- SemanticASTNode
- BELParser::Language::Semantics::SemanticIsSequencePosition
- Defined in:
- lib/bel_parser/language/semantics_ast.rb
Overview
AST node for IsSequencePosition is a semantic AST.
Instance Attribute Summary
Attributes inherited from AST::Node
Instance Method Summary collapse
-
#initialize(**properties) ⇒ SemanticIsSequencePosition
constructor
A new instance of SemanticIsSequencePosition.
- #match(value_node, spec, will_match_partial = false) ⇒ Object
Methods inherited from SemanticASTNode
Methods inherited from AST::Node
#==, #append, #concat, #dup, #eql?, #inspect, #to_a, #to_ast, #to_bel, #to_s, #to_sexp, #updated
Methods included from Parsers
Constructor Details
#initialize(**properties) ⇒ SemanticIsSequencePosition
Returns a new instance of SemanticIsSequencePosition.
765 766 767 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 765 def initialize(**properties) super(:is_sequence_position, [], properties) end |
Instance Method Details
#match(value_node, spec, will_match_partial = false) ⇒ Object
769 770 771 772 773 774 775 776 777 778 779 780 781 782 |
# 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 |