added Compiler class to pass to Node::process() instead of a FILE *

git-svn-id: svn://anubis/jtlc/trunk@22 f5bc74b8-7b62-4e90-9214-7121d538519f
This commit is contained in:
josh committed 2010-01-14 20:27:01 +00:00
1 parent b686d15705
commit 7b8436acb4
7 files changed
+46 -10

No files matched your search

+4 -3
View File
@@ -3,10 +3,11 @@
#include <string>
#include "Node.h"
#include "util/refptr.h"
#include "main/Compiler.h"
using namespace std;
void CStatementNode::process(FILE * out)
void CStatementNode::process(refptr<Compiler> compiler)
{
fprintf(out, "%s", m_string.c_str());
fprintf(out, "\n");
compiler->write(m_string);
compiler->write("\n");
}
+2 -1
View File
@@ -2,9 +2,10 @@
#include <iostream>
#include "Node.h"
#include "parser/parser.h"
#include "main/Compiler.h"
using namespace std;
void FunctionNode::process(FILE * out)
void FunctionNode::process(refptr<Compiler> compiler)
{
refptr<Node> params = m_children[2];
refptr<Node> type = m_children[1];
+2 -2
View File
@@ -17,13 +17,13 @@ void Node::addChildren(refptr<Node> other)
}
}
void Node::process(FILE * out)
void Node::process(refptr<Compiler> compiler)
{
for (vector< refptr<Node> >::const_iterator it = m_children.begin();
it != m_children.end();
it++)
{
(*it)->process(out);
(*it)->process(compiler);
}
}
+4 -3
View File
@@ -7,6 +7,7 @@
#include <vector>
#include <string>
#include "util/refptr.h"
#include "main/Compiler.h"
class Node
{
@@ -19,7 +20,7 @@ class Node
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);
virtual void process(refptr<Compiler> compiler);
protected:
std::vector< refptr<Node> > m_children;
@@ -41,7 +42,7 @@ class CStatementNode : public Node
{
public:
CStatementNode(const std::string & str) { m_string = str; }
virtual void process(FILE * out);
virtual void process(refptr<Compiler> compiler);
};
class DoubleNode : public Node
@@ -53,7 +54,7 @@ class DoubleNode : public Node
class FunctionNode : public Node
{
public:
void process(FILE * out);
void process(refptr<Compiler> compiler);
};
class IdentifierNode : public Node