blob: 19b193aec4fee188e541e21fc5a9e0f3c7b3db66 (
plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/*
* Copyright (C) 2007-2012 Xagasoft, All rights reserved.
*
* This file is part of the Xagasoft Build and is released under the
* terms of the license contained in the file LICENSE.
*/
#include "astnode.h"
#include "astleaf.h"
#include "astbranch.h"
AstNode::AstNode( const Location &loc, Type eType ) :
eType( eType ),
loc( loc )
{
}
AstNode::~AstNode()
{
}
Bu::Formatter &operator<<( Bu::Formatter &f, const AstNode &n )
{
f << n.getType();
if( n.getClass() == AstNode::typeBranch )
{
f << *dynamic_cast<const AstBranch *>(&n);
}
else
{
f << *dynamic_cast<const AstLeaf *>(&n);
}
return f;
}
Bu::Formatter &operator<<( Bu::Formatter &f, const AstNode::Type &t )
{
switch( t )
{
case AstNode::typeFunction: f << "Function"; break;
case AstNode::typeSet: f << "Set"; break;
case AstNode::typeUnset: f << "Unset"; break;
case AstNode::typeIf: f << "If"; break;
case AstNode::typeInclude: f << "Include"; break;
case AstNode::typeTarget: f << "Target"; break;
case AstNode::typeRule: f << "Rule"; break;
case AstNode::typeConfig: f << "Config"; break;
case AstNode::typeList: f << "List"; break;
case AstNode::typeInlineFunc: f << "InlineFunc"; break;
case AstNode::typeRequires: f << "Requires"; break;
case AstNode::typeFor: f << "For"; break;
case AstNode::typeFunctionDef: f << "FunctionDef"; break;
case AstNode::typeReturn: f << "Return"; break;
case AstNode::typeProfile: f << "Profile"; break;
case AstNode::typeInput: f << "Input"; break;
case AstNode::typeRuleDef: f << "RuleDef"; break;
case AstNode::typeOutput: f << "Output"; break;
case AstNode::typeAutoConfig: f << "AutoConfig"; break;
case AstNode::typeGlobalConfig: f << "GlobalConfig"; break;
case AstNode::typeType: f << "Type"; break;
case AstNode::typeValue: f << "Value"; break;
case AstNode::typeAllow: f << "Allow"; break;
case AstNode::typeDefault: f << "Default"; break;
case AstNode::typeExport: f << "Export"; break;
case AstNode::typeExpr: f << "Expr"; break;
case AstNode::typeActionDef: f << "ActionDef"; break;
case AstNode::typeProcessTarget:f << "ProcessTarget"; break;
case AstNode::typeTag: f << "Tag"; break;
case AstNode::typeVariable: f << "Variable"; break;
case AstNode::typeString: f << "String"; break;
case AstNode::typeInt: f << "Int"; break;
case AstNode::typeFloat: f << "Float"; break;
case AstNode::typeBool: f << "Bool"; break;
case AstNode::typeVersion: f << "Version"; break;
case AstNode::typeOpEq: f << "Operator ="; break;
case AstNode::typeOpPlusEq: f << "Operator +="; break;
case AstNode::typeOpPlusEqRaw: f << "Operator <<"; break;
case AstNode::typeError: f << "Error"; break;
case AstNode::typeWarning: f << "Warning"; break;
case AstNode::typeNotice: f << "Notice"; break;
case AstNode::typeTypeString: f << "Type String"; break;
case AstNode::typeTypeInt: f << "Type Int"; break;
case AstNode::typeTypeFloat: f << "Type Float"; break;
case AstNode::typeTypeBool: f << "Type Bool"; break;
case AstNode::typeTypeVersion: f << "Type Version"; break;
case AstNode::typeCmpEq: f << "Compare ="; break;
case AstNode::typeCmpLt: f << "Compare <"; break;
case AstNode::typeCmpGt: f << "Compare >"; break;
case AstNode::typeCmpNe: f << "Compare !="; break;
case AstNode::typeCmpLtEq: f << "Compare <="; break;
case AstNode::typeCmpGtEq: f << "Compare >="; break;
case AstNode::typeCondition: f << "Condition"; break;
case AstNode::typeDisplay: f << "Display"; break;
case AstNode::typeCache: f << "Cache"; break;
case AstNode::typePushPrefix: f << "Push Prefix"; break;
case AstNode::typePopPrefix: f << "Pop Prefix"; break;
case AstNode::typeNull: f << "Null"; break;
case AstNode::typeVariableRef: f << "VariableRef"; break;
case AstNode::typeOpPlus: f << "Operator +"; break;
case AstNode::typeOpMinus: f << "Operator -"; break;
case AstNode::typeOpMultiply: f << "Operator *"; break;
case AstNode::typeOpDivide: f << "Operator /"; break;
case AstNode::typeOpNegate: f << "Operator negate"; break;
case AstNode::typeOpNot: f << "Operator not"; break;
case AstNode::typeBranch: f << "Branch"; break;
case AstNode::typeLeaf: f << "Leaf"; break;
case AstNode::typeClassMask: f << "ClassMask"; break;
case AstNode::typeDataNone: f << "<Data None>"; break;
case AstNode::typeDataString: f << "<Data String>"; break;
case AstNode::typeDataInt: f << "<Data Int>"; break;
case AstNode::typeDataFloat: f << "<Data Float>"; break;
case AstNode::typeDataBool: f << "<Data Bool>"; break;
case AstNode::typeDataVersion: f << "<Data Version>"; break;
case AstNode::typeDataMask: f << "<Data Mask>"; break;
}
return f;
}
|