297 var sqlUnaryExpression =
new NonTerminal(
"sql_unary_expression", typeof(SqlUnaryExpressionNode));
298 var sqlBinaryExpression =
new NonTerminal(
"sql_binary_expression", typeof(SqlBinaryExpressionNode));
299 var sqlBetweenExpression =
new NonTerminal(
"sql_between_expression", typeof(SqlBetweenExpressionNode));
300 var sqlCaseExpression =
new NonTerminal(
"sql_case_expression", typeof(SqlCaseExpressionNode));
301 var sqlReferenceExpression =
new NonTerminal(
"sql_reference_expression", typeof(SqlReferenceExpressionNode));
302 var term =
new NonTerminal(
"term");
303 var sqlSimpleExpression =
new NonTerminal(
"sql_simple_expression");
304 var unaryOp =
new NonTerminal(
"unary_op");
305 var binaryOp =
new NonTerminal(
"binary_op");
306 var binaryOpSimple =
new NonTerminal(
"binary_op_simple");
307 var logicalOp =
new NonTerminal(
"logical_op");
308 var subqueryOp =
new NonTerminal(
"subquery_op");
309 var caseTestExpressionOpt =
new NonTerminal(
"case_test_expression_opt");
310 var caseWhenThenList =
new NonTerminal(
"case_when_then_list");
311 var caseWhenThen =
new NonTerminal(
"case_when_then", typeof(CaseSwitchNode));
312 var caseElseOpt =
new NonTerminal(
"case_else_opt");
313 var sqlVarefExpression =
new NonTerminal(
"sql_varef_expression", typeof(SqlVariableRefExpressionNode));
314 var sqlConstantExpression =
new NonTerminal(
"sql_constant_expression", typeof(SqlConstantExpressionNode));
315 var functionCallExpression =
new NonTerminal(
"function_call_expression", typeof(SqlFunctionCallExpressionNode));
316 var functionCallArgsOpt =
new NonTerminal(
"function_call_args_opt");
317 var functionCallArgsList =
new NonTerminal(
"function_call_args_list");
318 var notOpt =
new NonTerminal(
"not_opt");
319 var grouped =
new NonTerminal(
"grouped");
320 var anyOp =
new NonTerminal(
"any_op");
321 var allOp =
new NonTerminal(
"all_op");
324 sqlBetweenExpression |
328 sqlSimpleExpression.Rule = term | sqlBinaryExpression | sqlUnaryExpression;
329 term.Rule = sqlReferenceExpression |
331 sqlConstantExpression |
332 functionCallExpression |
335 grouped.Rule = ImplyPrecedenceHere(30) +
"(" +
sqlExpression +
")";
336 sqlUnaryExpression.Rule = unaryOp + term;
337 unaryOp.Rule =
Key(
"NOT") |
"+" |
"-" |
"~";
338 sqlBinaryExpression.Rule = sqlSimpleExpression + binaryOp + sqlSimpleExpression;
339 binaryOpSimple.Rule = ToTerm(
"+") |
"-" |
"*" |
"/" |
"%" |
">" |
"<" |
"=" |
"<>";
340 binaryOp.Rule = binaryOpSimple | allOp | anyOp | logicalOp | subqueryOp;
341 logicalOp.Rule =
Key(
"AND") |
Key(
"OR") |
Key(
"IS") |
Key(
"IS") +
Key(
"NOT") +
"&" |
"|";
342 subqueryOp.Rule =
Key(
"IN") |
Key(
"NOT") +
Key(
"IN");
343 anyOp.Rule =
Key(
"ANY") + binaryOpSimple;
344 allOp.Rule =
Key(
"ALL") + binaryOpSimple;
345 sqlBetweenExpression.Rule = sqlSimpleExpression + notOpt +
Key(
"BETWEEN") + sqlSimpleExpression +
Key(
"AND") +
347 sqlCaseExpression.Rule =
Key(
"CASE") + caseTestExpressionOpt + caseWhenThenList + caseElseOpt +
Key(
"END");
350 caseWhenThenList.Rule = MakePlusRule(caseWhenThenList, caseWhenThen);
353 functionCallExpression.Rule =
ObjectName() + functionCallArgsOpt;
354 functionCallArgsOpt.Rule = Empty |
"(" + functionCallArgsList +
")";
355 functionCallArgsList.Rule = MakeStarRule(functionCallArgsList,
Comma, sqlExpression);
359 notOpt.Rule = Empty |
Key(
"NOT");
361 MarkTransient(sqlExpression, term, sqlSimpleExpression, grouped, functionCallArgsOpt);
363 binaryOp.SetFlag(TermFlags.InheritPrecedence);
364 binaryOpSimple.SetFlag(TermFlags.InheritPrecedence);
365 logicalOp.SetFlag(TermFlags.InheritPrecedence);
366 subqueryOp.SetFlag(TermFlags.InheritPrecedence);
367 unaryOp.SetFlag(TermFlags.InheritPrecedence);
NumberLiteral NumberLiteral
NonTerminal sqlExpression
IdentifierTerminal Identifier
NonTerminal SqlQueryExpression()
StringLiteral StringLiteral