All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javacc-7.0.1.examples.JJTreeExamples.cpp.eg1.Node.h Maven / Gradle / Ivy

There is a newer version: 7.0.13
Show newest version
/* Generated By:JJTree: Do not edit this line. Node.h Version 7.0 */
/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#pragma once

#include 
#include "JavaCC.h"
#include "Token.h"


namespace EG1 {

/* All AST nodes must implement this interface.  It provides basic
   machinery for constructing the parent and child relationships
   between nodes. */

class Node {
  /** This method is called after the node has been made the current
    node.  It indicates that child nodes can now be added to it. */
public:
  virtual void    jjtOpen() const = 0;

  /** This method is called after all the child nodes have been added. */
  virtual void    jjtClose() const = 0;

  /** This pair of methods are used to inform the node of its parent. */
  virtual void    jjtSetParent(Node *n) = 0;
  virtual Node*   jjtGetParent() const = 0;

  /** This method tells the node to add its argument to the node's list of children.  */
  virtual void    jjtAddChild(Node *n, size_t i) = 0;

  /** This method returns a child node.  The children are numbered
     from zero, left to right. */
  virtual Node*   jjtGetChild(size_t i) const = 0;

  /** Return the number of children the node has. */
  virtual size_t  jjtGetNumChildren() const = 0;
  virtual int     getId() const = 0;


  /** Clear list of children, and return children that we have before.
      Used in destructor to do linear destruction of tree.
      Since some parsers has subclassed Node, we can't use pure virtual
      function, that would break backward compatibility. */
private: 
  virtual std::vector jjtExtractChildrenForDestruction() {
    std::vector x;
    return x;
  }
  friend class SimpleNode;

           Node() { }
public:
  virtual ~Node() { }
};


}

/* JavaCC - OriginalChecksum=0f1fd31b3feabb39c3378c7110f015af (do not edit this line) */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy