started filling in new node types, creating them in parser
git-svn-id: svn://anubis/jtlc/trunk@13 f5bc74b8-7b62-4e90-9214-7121d538519f
This commit is contained in:
1 parent
8333a037c9
commit
55b80e8f09
5 files changed
+82
-18
No files matched your search
@@ -0,0 +1,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "Node.h"
|
||||
#include "util/refptr.h"
|
||||
using namespace std;
|
||||
|
||||
void CStatementNode::process(FILE * out)
|
||||
{
|
||||
fprintf(out, "%s", m_string.c_str());
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
#include "Node.h"
|
||||
#include <vector>
|
||||
#include "Node.h"
|
||||
#include "util/refptr.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
+30
-8
@@ -2,6 +2,7 @@
|
||||
#ifndef NODE_H
|
||||
#define NODE_H NODE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -15,31 +16,52 @@ class Node
|
||||
void addChildren(refptr<Node> other);
|
||||
std::vector< refptr<Node> > & getChildren() { return m_children; }
|
||||
|
||||
virtual uint64_t getInteger() { return 0x0ULL; }
|
||||
virtual std::string getString() { return ""; }
|
||||
virtual double getDouble() { return m_double; }
|
||||
virtual uint64_t getInteger() { return m_integer; }
|
||||
virtual std::string getString() { return m_string; }
|
||||
virtual void process(FILE * out) { }
|
||||
|
||||
protected:
|
||||
std::vector< refptr<Node> > m_children;
|
||||
uint64_t m_integer;
|
||||
std::string m_string;
|
||||
double m_double;
|
||||
};
|
||||
|
||||
|
||||
class CStatementNode : public Node
|
||||
{
|
||||
public:
|
||||
CStatementNode(const std::string & str) { m_string = str; }
|
||||
virtual void process(FILE * out);
|
||||
};
|
||||
|
||||
class DoubleNode : public Node
|
||||
{
|
||||
public:
|
||||
DoubleNode(double val) { m_double = val; }
|
||||
};
|
||||
|
||||
class IdentifierNode : public Node
|
||||
{
|
||||
public:
|
||||
IdentifierNode(const std::string & str) { m_string = str; }
|
||||
};
|
||||
|
||||
class IntegerNode : public Node
|
||||
{
|
||||
public:
|
||||
IntegerNode(uint64_t integer) { m_integer = integer; }
|
||||
unsigned long getInteger() { return m_integer; }
|
||||
protected:
|
||||
uint64_t m_integer;
|
||||
};
|
||||
|
||||
class ProgramNode : public Node
|
||||
{
|
||||
};
|
||||
|
||||
class StringNode : public Node
|
||||
{
|
||||
public:
|
||||
StringNode(const std::string & str) { m_string = str; }
|
||||
std::string getString() { return m_string; }
|
||||
protected:
|
||||
std::string m_string;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user