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

javacc-7.0.4.classes.templates.cpp.SimpleNodeInterface.template Maven / Gradle / Ivy

#if NODE_EXTENDS
class SimpleNode : public ${NODE_EXTENDS}, public Node {
#else
class SimpleNode : public Node {
#fi

  protected: Node *parent;
  protected: std::vector children;
  protected: int id;
  protected: void * value;
  protected: ${PARSER_NAME} *parser;
  //protected: int numChildren;
#if TRACK_TOKENS
  protected: Token *firstToken;
  protected: Token *lastToken;
#fi

  public: SimpleNode(int i);
  public: SimpleNode(${PARSER_NAME} *p, int i);

//#if !NODE_FACTORY
//\#define jjtCreate(id) new SimpleNode(id)
//\#define jjtCreate(p, id) new SimpleNode(p, id)
//#fi

  public: virtual void  jjtOpen() const;
  public: virtual void  jjtClose() const;
  public: virtual void  jjtSetParent(Node *n);
  public: virtual Node* jjtGetParent() const;
  public: virtual void  jjtAddChild(Node *n, int i);
  public: virtual Node* jjtGetChild(int i) const;
  public: virtual int   jjtGetNumChildren() const;
  public: virtual void  jjtSetValue(void * value);
  public: virtual void* jjtGetValue() const;

#if TRACK_TOKENS
  public: virtual Token*jjtGetFirstToken() const;
  public: virtual void  jjtSetFirstToken(Token* token);
  public: virtual Token*jjtGetLastToken() const;
  public: virtual void  jjtSetLastToken(Token* token);

#fi
#if VISITOR
  /** Accept the visitor. **/
  public: virtual ${VISITOR_RETURN_TYPE:-void} jjtAccept(${PARSER_NAME}Visitor *visitor, ${VISITOR_DATA_TYPE:-void *} data) const;

  /** Accept the visitor. **/
  public: virtual void childrenAccept(${PARSER_NAME}Visitor *visitor, ${VISITOR_DATA_TYPE:-void *} data) const;
#fi
  /* You can override these two methods in subclasses of SimpleNode to
     customize the way the node appears when the tree is dumped.  If
     your output uses more than one line you should override
     toString(string), otherwise overriding toString() is probably all
     you need to do. */

  public: virtual JJString toString() const;
  public: virtual JJString toString(const JJString& prefix) const;

  /* Override this method if you want to customize how the node dumps
     out its children. */

  public: virtual void dump(JJString prefix) const;
  public: virtual void dumpToBuffer(const JJString& prefix, const JJString& separator, JJString *sb) const;
  private: virtual std::vector jjtExtractChildrenForDestruction() override;
  public: virtual ~SimpleNode();
  public: virtual int getId() const {
    return id;
  }
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy