processing functions
git-svn-id: svn://anubis/jtlc/trunk@23 f5bc74b8-7b62-4e90-9214-7121d538519f
This commit is contained in:
1 parent
7b8436acb4
commit
31ec778b3a
5 files changed
+45
-3
No files matched your search
+22
-2
@@ -7,6 +7,26 @@ using namespace std;
|
||||
|
||||
void FunctionNode::process(refptr<Compiler> compiler)
|
||||
{
|
||||
refptr<Node> params = m_children[2];
|
||||
refptr<Node> type = m_children[1];
|
||||
refptr<Node> name = m_children[0];
|
||||
refptr<Node> params = m_children[1];
|
||||
refptr<Node> type = m_children[2];
|
||||
compiler->write(type->getString());
|
||||
compiler->write(" ");
|
||||
compiler->write(name->getString());
|
||||
compiler->write("(");
|
||||
for (int i = 0, sz = params->getChildren().size(); i < sz; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
compiler->write(", ");
|
||||
}
|
||||
compiler->write(params->getChildren()[i]->getString());
|
||||
}
|
||||
compiler->write(")\n");
|
||||
compiler->write("{\n");
|
||||
for (int i = 3, sz = m_children.size(); i < sz; i++)
|
||||
{
|
||||
m_children[i]->process(compiler);
|
||||
}
|
||||
compiler->write("}\n\n");
|
||||
}
|
||||
@@ -104,6 +104,9 @@ class StructTypeNode : public Node
|
||||
|
||||
class VariableSpecNode : public Node
|
||||
{
|
||||
public:
|
||||
void process(refptr<Compiler> compiler);
|
||||
std::string getString();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
#include <iostream>
|
||||
#include "Node.h"
|
||||
#include "parser/parser.h"
|
||||
#include "main/Compiler.h"
|
||||
using namespace std;
|
||||
|
||||
void VariableSpecNode::process(refptr<Compiler> compiler)
|
||||
{
|
||||
}
|
||||
|
||||
string VariableSpecNode::getString()
|
||||
{
|
||||
return m_children[1]->getString() + " " + m_children[0]->getString();
|
||||
}
|
||||
Reference in new issue
Block a user