diff --git a/dbms/src/Parsers/ExpressionElementParsers.cpp b/dbms/src/Parsers/ExpressionElementParsers.cpp index 52a35238de8..8c5932c773a 100644 --- a/dbms/src/Parsers/ExpressionElementParsers.cpp +++ b/dbms/src/Parsers/ExpressionElementParsers.cpp @@ -36,7 +36,8 @@ bool ParserArray::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected & expect return false; ws.ignore(pos, end); - contents.parse(pos, end, contents_node, expected); + if (!contents.parse(pos, end, contents_node, expected)) + return false; ws.ignore(pos, end); if (!close.ignore(pos, end, expected)) @@ -64,7 +65,8 @@ bool ParserParenthesisExpression::parseImpl(Pos & pos, Pos end, ASTPtr & node, E return false; ws.ignore(pos, end); - contents.parse(pos, end, contents_node, expected); + if (!contents.parse(pos, end, contents_node, expected)) + return false; ws.ignore(pos, end); if (!close.ignore(pos, end, expected)) @@ -108,7 +110,8 @@ bool ParserSubquery::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected & exp return false; ws.ignore(pos, end); - select.parse(pos, end, select_node, expected); + if (!select.parse(pos, end, select_node, expected)) + return false; ws.ignore(pos, end); if (!close.ignore(pos, end, expected)) @@ -222,7 +225,8 @@ bool ParserFunction::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected & exp ws.ignore(pos, end); Pos contents_begin = pos; - contents.parse(pos, end, expr_list_args, expected); + if (!contents.parse(pos, end, expr_list_args, expected)) + return false; Pos contents_end = pos; ws.ignore(pos, end); @@ -259,7 +263,8 @@ bool ParserFunction::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected & exp expr_list_args = nullptr; ws.ignore(pos, end); - contents.parse(pos, end, expr_list_args, expected); + if (!contents.parse(pos, end, expr_list_args, expected)) + return false; ws.ignore(pos, end); if (!close.ignore(pos, end, expected)) diff --git a/dbms/src/Parsers/ExpressionListParsers.cpp b/dbms/src/Parsers/ExpressionListParsers.cpp index 4150da557cc..b4226b57075 100644 --- a/dbms/src/Parsers/ExpressionListParsers.cpp +++ b/dbms/src/Parsers/ExpressionListParsers.cpp @@ -84,6 +84,7 @@ bool ParserList::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected & expecte break; list->children.push_back(elem); + first = false; } else { @@ -98,8 +99,6 @@ bool ParserList::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected & expecte list->children.push_back(elem); } - - first = false; } if (!allow_empty && first) @@ -123,6 +122,7 @@ bool ParserLeftAssociativeBinaryOperatorList::parseImpl(Pos & pos, Pos end, ASTP return false; node = elem; + first = false; } else { @@ -184,8 +184,6 @@ bool ParserLeftAssociativeBinaryOperatorList::parseImpl(Pos & pos, Pos end, ASTP node = function_node; } - - first = false; } return true;