diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-06-21 08:59:53 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-06-21 08:59:53 (GMT) |
commit | 0e4681913485cb450493e9a35ae297d88f12b19d (patch) | |
tree | 22d3ee0037b6afe9b4b74a854e52c3a2cebd5a8b /module.cc | |
parent | 1c2472067c3843342f56b5833c284106ab349417 (diff) |
Clifford Wolf:
Parser seams to be fully functional now
git-svn-id: http://svn.clifford.at/openscad/trunk@5 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'module.cc')
-rw-r--r-- | module.cc | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -38,6 +38,8 @@ ModuleInstanciation::~ModuleInstanciation() { foreach (Expression *v, argexpr) delete v; + foreach (ModuleInstanciation *v, children) + delete v; } QString ModuleInstanciation::dump(QString indent) const @@ -53,14 +55,27 @@ QString ModuleInstanciation::dump(QString indent) const text += argnames[i] + QString(" = "); text += argexpr[i]->dump(); } - text += QString(") {\n"); - for (int i = 0; i < children.size(); i++) { - children[i]->dump(indent + QString("\t")); + if (children.size() == 0) { + text += QString(");\n"); + } else if (children.size() == 1) { + text += QString(")\n"); + text += children[0]->dump(indent + QString("\t")); + } else { + text += QString(") {\n"); + for (int i = 0; i < children.size(); i++) { + text += children[i]->dump(indent + QString("\t")); + } + text += QString("%1}\n").arg(indent); } - text += QString("%1}\n").arg(indent); return text; } +AbstractNode *ModuleInstanciation::evaluate(const Context*) const +{ + /* FIXME */ + return NULL; +} + Module::~Module() { foreach (Expression *v, assignments) @@ -69,6 +84,8 @@ Module::~Module() delete v; foreach (AbstractModule *v, modules) delete v; + foreach (ModuleInstanciation *v, children) + delete v; } AbstractNode *Module::evaluate(const Context *ctx, const QVector<QString> &call_argnames, const QVector<Value> &call_argvalues) const @@ -77,7 +94,6 @@ AbstractNode *Module::evaluate(const Context *ctx, const QVector<QString> &call_ c.args(argnames, argexpr, call_argnames, call_argvalues); /* FIXME */ - return NULL; } |