MXS-3404 Fix problem by extending parser

This commit is contained in:
Johan Wikman
2021-02-16 08:35:22 +02:00
parent 797d7812cc
commit 0dd5ed23d3
3 changed files with 20 additions and 2 deletions

View File

@ -646,7 +646,7 @@ columnid(A) ::= nm(X). {
QUERY QUICK
RAISE RECURSIVE /*REINDEX*/ RELEASE /*RENAME*/ /*REPLACE*/ RESET RESTRICT ROLLBACK ROLLUP ROW
SAVEPOINT SELECT_OPTIONS_KW /*SEQUENCE*/ SHARE SLAVE /*START*/ STATEMENT STATUS
TABLES TEMP TEMPTABLE /*TRIGGER*/
TABLES TEMP TEMPTABLE /*TRIGGER*/ TRIM TRIM_ARG
/*TRUNCATE*/
// TODO: UNSIGNED is a reserved word and should not automatically convert into an identifer.
// TODO: However, if not here then rules such as CAST need to be modified.
@ -2130,6 +2130,17 @@ expr(A) ::= keyword_as_function(X) LP distinct(D) exprlist(Y) RP(E). {
A.pExpr->flags |= EP_Distinct;
}
}
trim_arg1_opt ::= TRIM_ARG.
trim_arg1_opt ::= .
trim_arg2 ::= INTEGER|STRING.
expr(A) ::= TRIM(X) LP trim_arg1_opt trim_arg2 FROM expr(Y) RP(Z). {
ExprList* pArgs = sqlite3ExprListAppend(pParse, NULL, Y.pExpr);
A.pExpr = sqlite3ExprFunction(pParse, pArgs, &X);
spanSet(&A, &X, &Z);
}
%endif
expr(A) ::= id(X) LP STAR RP(E) wf_opt. {
A.pExpr = sqlite3ExprFunction(pParse, 0, &X);