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

javacc-7.0.1.examples.JJTreeExamples.cpp.eg3.SimpleNode.h Maven / Gradle / Ivy

There is a newer version: 7.0.13
Show newest version
/* Generated By:JJTree: Do not edit this line. SimpleNode.h Version 7.0 */
/* JavaCCOptions:MULTI=true,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"
#include "Node.h"
#include "ParserTreeConstants.h"

namespace EG3 {

class Parser;

class SimpleNode : public Node {
protected: 
  std::vector children;
  Node*              parent = nullptr;
  void*              value  = nullptr;
//int                numChildren;
  Parser*    parser = nullptr;
  int                id;

public: 
           SimpleNode(int id);
           SimpleNode(Parser* parser, int id);
  virtual ~SimpleNode();

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

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


  /* 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. */
     
  virtual JJString toString() const;
  virtual JJString toString(const JJString& prefix) const;

  /* Override this method if you want to customize how the node dumps
     out its children. */
  virtual void          dump(const JJString& prefix) const;
  virtual void          dumpToBuffer(const JJString& prefix, const JJString& separator, JJString *sb) const;
  virtual int           getId() const { return id;  }
};
}
/* JavaCC - OriginalChecksum=eb13d4a811828b39dfabebe393087f1e (do not edit this line) */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy