Class: BELParser::Language::Semantics::SemanticFunctionOf
- Inherits:
-
SemanticASTNode
- Object
- AST::Node
- SemanticASTNode
- BELParser::Language::Semantics::SemanticFunctionOf
- Defined in:
- lib/bel_parser/language/semantics_ast.rb
Overview
AST node for FunctionOf is a semantic AST.
Instance Attribute Summary
Attributes inherited from AST::Node
Instance Method Summary collapse
- #functions ⇒ Object
-
#initialize(functions, **properties) ⇒ SemanticFunctionOf
constructor
A new instance of SemanticFunctionOf.
- #match(identifier, spec) ⇒ Object
Methods inherited from SemanticASTNode
Methods inherited from AST::Node
#==, #append, #concat, #dup, #eql?, #inspect, #to_a, #to_ast, #to_sexp, #updated
Constructor Details
#initialize(functions, **properties) ⇒ SemanticFunctionOf
Returns a new instance of SemanticFunctionOf.
639 640 641 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 639 def initialize(functions, **properties) super(:function_of, functions, properties) end |
Instance Method Details
#functions ⇒ Object
643 644 645 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 643 def functions children end |
#match(identifier, spec) ⇒ Object
647 648 649 650 651 652 653 654 655 656 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 647 def match(identifier, spec) return success(identifier, spec) if functions.include?(:*) function = spec.function(identifier.string_literal.to_sym) if functions.include?(function) success(identifier, spec) else invalid_function_warning(identifier, spec, functions) end end |