/
CCommandNode.cpp
67 lines (48 loc) · 1.22 KB
/
CCommandNode.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* CCommandNode.cpp
* HyperCompiler
*
* Created by Uli Kusterer on 10.05.07.
* Copyright 2007 M. Uli Kusterer. All rights reserved.
*
*/
#include "CCommandNode.h"
#include "CValueNode.h"
#include "CParseTree.h"
namespace Carlson
{
void CCommandNode::DebugPrint( std::ostream& destStream, size_t indentLevel )
{
INDENT_PREPARE(indentLevel);
destStream << indentChars << "Command \"" << mSymbolName << "\"" << std::endl
<< indentChars << "{" << std::endl;
std::vector<CValueNode*>::iterator itty;
for( itty = mParams.begin(); itty != mParams.end(); itty++ )
{
(*itty)->DebugPrint( destStream, indentLevel +1 );
}
destStream << indentChars << "}" << std::endl;
}
void CCommandNode::AddParam( CValueNode* val )
{
mParams.push_back( val );
mParseTree->NodeWasAdded(val);
}
void CCommandNode::Simplify()
{
CNode::Simplify();
std::vector<CValueNode*>::iterator itty;
for( itty = mParams.begin(); itty != mParams.end(); itty++ )
{
(*itty)->Simplify();
}
}
void CCommandNode::GenerateCode( CCodeBlock* inCodeBlock )
{
std::vector<CValueNode*>::iterator itty;
for( itty = mParams.begin(); itty != mParams.end(); itty++ )
{
(*itty)->GenerateCode( inCodeBlock );
}
}
} // namespace Carlson