javacc-7.0.1.examples.JJTreeExamples.cpp.eg2.SimpleNode.h Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javacc Show documentation
Show all versions of javacc Show documentation
JavaCC is a parser/scanner generator for Java.
/* 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 EG2 {
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=0ffe283306cc29557a2f14029b263af4 (do not edit this line) */