Class: BELParser::Language::Semantics::SemanticAminoAcidOf
- Inherits:
-
SemanticASTNode
- Object
- AST::Node
- SemanticASTNode
- BELParser::Language::Semantics::SemanticAminoAcidOf
- Defined in:
- lib/bel_parser/language/semantics_ast.rb
Overview
AST node for AminoAcidOf is a semantic AST.
Instance Attribute Summary
Attributes inherited from AST::Node
Instance Method Summary collapse
- #amino_acids ⇒ Object
-
#initialize(amino_acids, **properties) ⇒ SemanticAminoAcidOf
constructor
A new instance of SemanticAminoAcidOf.
- #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(amino_acids, **properties) ⇒ SemanticAminoAcidOf
Returns a new instance of SemanticAminoAcidOf.
713 714 715 716 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 713 def initialize(amino_acids, **properties) properties[:hashed] = Hash[amino_acids.map { |t| [t, true] }] super(:amino_acid_of, amino_acids, properties) end |
Instance Method Details
#amino_acids ⇒ Object
718 719 720 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 718 def amino_acids children end |
#match(value_node, spec, will_match_partial = false) ⇒ Object
722 723 724 725 726 727 728 729 730 731 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 722 def match(value_node, spec, will_match_partial = false) string_literal_sym = value_node.children[0].string_literal.to_sym return success(value_node, spec) if @hashed[:*] if @hashed.key?(string_literal_sym) success(value_node, spec) else invalid_amino_acid_warning(value_node, spec, @hashed.keys) end end |