Class: BELParser::Language::Semantics::SemanticStatement

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

Overview

AST node for Statement is a semantic AST.

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_bel, #to_s, #to_sexp, #updated

Methods included from Parsers

#serialize

Constructor Details

#initialize(children = [], **properties) ⇒ SemanticStatement

Returns a new instance of SemanticStatement.



306
307
308
# File 'lib/bel_parser/language/semantics_ast.rb', line 306

def initialize(children = [], **properties)
  super(:statement, children, properties)
end

Instance Method Details

#match(parse_node, spec, will_match_partial = false) ⇒ Object



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/bel_parser/language/semantics_ast.rb', line 310

def match(parse_node, spec, will_match_partial = false)
  return nil_node_warning(
    parse_node,
    spec,
    BELParser::Parsers::AST::Statement) if parse_node.nil?

  if parse_node.type == type
    success(parse_node, spec)
  else
    type_warning(
      parse_node,
      spec,
      BELParser::Parsers::AST::Statement,
      parse_node)
  end
end