00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef COMMA_PARSECLIENT_HDR_GUARD
00010 #define COMMA_PARSECLIENT_HDR_GUARD
00011
00012 #include "comma/basic/ParameterModes.h"
00013 #include "comma/basic/IdentifierInfo.h"
00014 #include "comma/parser/Descriptors.h"
00015
00016 namespace llvm {
00017
00018 class APInt;
00019
00020 }
00021
00022 namespace comma {
00023
00024 class ParseClient {
00025
00026 public:
00027
00028
00029
00030
00031 Node getNullNode() { return Node::getNullNode(this); }
00032
00033
00034
00035
00036
00037 Node getInvalidNode() { return Node::getInvalidNode(this); }
00038
00039
00040
00041
00042
00043 virtual void deleteNode(Node &node) = 0;
00044
00045
00046
00047
00048 virtual void beginModelDeclaration(Descriptor &desc) = 0;
00049
00050 virtual void endModelDefinition() = 0;
00051
00052
00053
00054
00055
00056
00057 virtual Node acceptModelParameter(Descriptor &desc,
00058 IdentifierInfo *formal,
00059 Node typeNode,
00060 Location loc) = 0;
00061
00062
00063
00064 virtual void acceptModelDeclaration(Descriptor &desc) = 0;
00065
00066 virtual void beginWithExpression() = 0;
00067 virtual void endWithExpression() = 0;
00068
00069
00070 virtual void acceptWithSupersignature(Node typeNode, Location loc) = 0;
00071
00072
00073 virtual void acceptCarrier(IdentifierInfo *name,
00074 Node typeNode,
00075 Location loc) = 0;
00076
00077
00078
00079
00080 virtual void beginAddExpression() = 0;
00081
00082
00083 virtual void endAddExpression() = 0;
00084
00085 virtual void beginSubroutineDeclaration(Descriptor &desc) = 0;
00086
00087 virtual Node acceptSubroutineParameter(IdentifierInfo *formal,
00088 Location loc,
00089 Node typeNode,
00090 PM::ParameterMode mode) = 0;
00091
00092 virtual Node acceptSubroutineDeclaration(Descriptor &desc,
00093 bool definitionFollows) = 0;
00094
00097 virtual void beginSubroutineDefinition(Node declarationNode) = 0;
00098
00101 virtual void acceptSubroutineStmt(Node stmt) = 0;
00102
00105 virtual void endSubroutineDefinition() = 0;
00106
00107 virtual bool acceptObjectDeclaration(Location loc,
00108 IdentifierInfo *name,
00109 Node type,
00110 Node initializer) = 0;
00111
00112 virtual Node acceptPercent(Location loc) = 0;
00113
00114 virtual Node acceptTypeName(IdentifierInfo *info,
00115 Location loc,
00116 Node qualNode) = 0;
00117
00118 virtual Node acceptTypeApplication(IdentifierInfo *connective,
00119 NodeVector &argumentNodes,
00120 Location *argumentLocs,
00121 IdentifierInfo **keys,
00122 Location *keyLocs,
00123 unsigned numKeys,
00124 Location loc) = 0;
00125
00126 virtual Node acceptKeywordSelector(IdentifierInfo *key,
00127 Location loc,
00128 Node exprNode,
00129 bool forSubroutine) = 0;
00130
00131 virtual Node acceptDirectName(IdentifierInfo *name,
00132 Location loc,
00133 Node qualNode) = 0;
00134
00135 virtual Node acceptFunctionName(IdentifierInfo *name,
00136 Location loc,
00137 Node qualNode) = 0;
00138
00139 virtual Node acceptFunctionCall(Node connective,
00140 Location loc,
00141 NodeVector &args) = 0;
00142
00143 virtual Node acceptProcedureName(IdentifierInfo *name,
00144 Location loc,
00145 Node qualNode) = 0;
00146
00147 virtual Node acceptProcedureCall(Node connective,
00148 Location loc,
00149 NodeVector &args) = 0;
00150
00151
00152
00153 virtual Node acceptInj(Location loc, Node expr) = 0;
00154
00155
00156
00157 virtual Node acceptPrj(Location loc, Node expr) = 0;
00158
00159 virtual Node acceptQualifier(Node qualifierType, Location loc) = 0;
00160
00161 virtual Node acceptNestedQualifier(Node qualifier,
00162 Node qualifierType,
00163 Location loc) = 0;
00164
00165 virtual Node acceptIntegerLiteral(llvm::APInt &value, Location loc) = 0;
00166
00167
00168
00169 virtual bool acceptImportDeclaration(Node importedType, Location loc) = 0;
00170
00171 virtual Node acceptIfStmt(Location loc, Node condition,
00172 Node *consequents, unsigned numConsequents) = 0;
00173
00174 virtual Node acceptElseStmt(Location loc, Node ifNode,
00175 Node *alternates, unsigned numAlternates) = 0;
00176
00177 virtual Node acceptElsifStmt(Location loc,
00178 Node ifNode,
00179 Node condition,
00180 Node *consequents,
00181 unsigned numConsequents) = 0;
00182
00183 virtual Node acceptEmptyReturnStmt(Location loc) = 0;
00184
00185 virtual Node acceptReturnStmt(Location loc, Node retNode) = 0;
00186
00187 virtual Node acceptAssignmentStmt(Location loc,
00188 IdentifierInfo *target,
00189 Node value) = 0;
00190
00191
00192 virtual Node beginBlockStmt(Location loc, IdentifierInfo *label = 0) = 0;
00193
00194
00195 virtual void acceptBlockStmt(Node block, Node stmt) = 0;
00196
00197
00198
00199
00200 virtual void endBlockStmt(Node block) = 0;
00201
00202
00203
00204
00205
00206 virtual Node beginEnumerationType(IdentifierInfo *name,
00207 Location loc) = 0;
00208
00209
00210
00211 virtual void acceptEnumerationLiteral(Node enumeration,
00212 IdentifierInfo *name,
00213 Location loc) = 0;
00214
00215
00216
00217 virtual void endEnumerationType(Node enumeration) = 0;
00218
00225 virtual void acceptIntegerTypedef(IdentifierInfo *name, Location loc,
00226 Node low, Node high) = 0;
00227
00228 protected:
00229
00230 Node getNode(void *ptr) { return Node(this, ptr); }
00231
00232
00233 Node getReleasedNode(void *ptr) {
00234 Node node(this, ptr);
00235 node.release();
00236 return node;
00237 }
00238 };
00239
00240 }
00241
00242 #endif