110 {
113 int num = 0;
114 while (
_token != Tokens.EOS)
115 {
116 while (true)
117 {
120 {
121 case Tokens.EOS:
122 break;
123 case Tokens.Name:
124 case Tokens.Numeric:
125 case Tokens.Decimal:
126 case Tokens.Float:
127 case Tokens.StringConst:
128 case Tokens.Date:
129 case Tokens.Parent:
130 {
131 ExpressionNode node = null;
134 {
136 }
138 {
140 if (operatorInfo._type == Nodes.Binop && operatorInfo._op == 5 &&
_token != Tokens.Parent)
141 {
142 throw ExprException.InWithoutParentheses();
143 }
144 }
147 {
148 case Tokens.Parent:
149 {
150 string relationName;
151 try
152 {
154 if (
_token == Tokens.LeftParen)
155 {
160 }
161 else
162 {
163 relationName = null;
165 }
166 }
168 {
169 throw ExprException.LookupArgument();
170 }
174 node =
new LookupNode(
_table, columnName, relationName);
175 break;
176 }
177 case Tokens.Name:
178 {
181 break;
182 }
183 case Tokens.Numeric:
186 break;
187 case Tokens.Decimal:
190 break;
191 case Tokens.Float:
194 break;
195 case Tokens.StringConst:
198 break;
199 case Tokens.Date:
202 break;
203 }
205 continue;
206 }
207 case Tokens.LeftParen:
208 {
209 num++;
210 ExpressionNode node;
212 {
214 if (operatorInfo._type == Nodes.Binop && operatorInfo._op == 5)
215 {
216 node =
new FunctionNode(
_table,
"In");
219 }
220 else
221 {
223 }
224 continue;
225 }
228 ExpressionNode expressionNode2 =
NodePeek();
229 if (expressionNode2 == null || expressionNode2.GetType() != typeof(NameNode))
230 {
231 throw ExprException.SyntaxError();
232 }
233 NameNode nameNode2 = (NameNode)
NodePop();
234 node =
new FunctionNode(
_table, nameNode2._name);
237 {
241 }
242 else
243 {
246 }
247 continue;
248 }
249 case Tokens.RightParen:
250 {
252 {
254 }
256 {
257 throw ExprException.TooManyRightParentheses();
258 }
261 if (
_prevOperand == 0 && operatorInfo._type != Nodes.Call)
262 {
263 throw ExprException.MissingOperand(operatorInfo);
264 }
265 if (operatorInfo._type == Nodes.Call)
266 {
268 {
269 ExpressionNode argument2 =
NodePop();
270 FunctionNode functionNode2 = (FunctionNode)
NodePop();
271 functionNode2.AddArgument(argument2);
272 functionNode2.Check();
274 }
275 }
276 else
277 {
278 ExpressionNode node =
NodePop();
279 node =
new UnaryNode(
_table, 0, node);
281 }
283 num--;
284 continue;
285 }
286 case Tokens.ListSeparator:
287 {
289 {
290 throw ExprException.MissingOperandBefore(",");
291 }
294 if (operatorInfo._type != Nodes.Call)
295 {
296 throw ExprException.SyntaxError();
297 }
298 ExpressionNode argument =
NodePop();
299 FunctionNode functionNode = (FunctionNode)
NodePop();
300 functionNode.AddArgument(argument);
303 continue;
304 }
305 case Tokens.BinaryOp:
307 {
309 {
311 }
312 else
313 {
315 {
316 throw ExprException.MissingOperandBefore(Operators.ToString(
_op));
317 }
319 }
320 goto case Tokens.UnaryOp;
321 }
325 continue;
326 case Tokens.UnaryOp:
328 continue;
329 case Tokens.ZeroOp:
331 {
333 }
336 continue;
337 case Tokens.Dot:
338 {
339 ExpressionNode expressionNode =
NodePeek();
340 if (expressionNode != null && expressionNode.GetType() == typeof(NameNode))
341 {
343 if (
_token == Tokens.Name)
344 {
345 NameNode nameNode = (NameNode)
NodePop();
348 continue;
349 }
350 }
351 goto default;
352 }
353 default:
355 }
356 break;
357 }
359 {
361 {
363 throw ExprException.MissingOperand(operatorInfo);
364 }
365 }
366 else
367 {
370 {
371 throw ExprException.MissingRightParen();
372 }
373 }
374 }
377 }
static bool IsCatchableExceptionType(Exception e)
void BuildExpression(int pri)
readonly DataTable _table
void NodePush(ExpressionNode node)
void CheckToken(Tokens token)
ExpressionNode _expression
ExpressionNode ParseAggregateArgument(FunctionId aggregate)
ExpressionNode NodePeek()
void ScanToken(Tokens token)
ExpressionNode[] _nodeStack