diff --git a/src/pl/parser/gen_parser.sh b/src/pl/parser/gen_parser.sh index 62f08a997..a077e1097 100755 --- a/src/pl/parser/gen_parser.sh +++ b/src/pl/parser/gen_parser.sh @@ -18,18 +18,25 @@ if [ "$BISON_VERSION" != "$NEED_VERSION" ]; then exit 1 fi +bison_parser() { +BISON_OUTPUT="$(bison -v -Werror -d $1 -o $2 2>&1)" +BISON_RETURN="$?" +echo $BISON_OUTPUT +if [ $BISON_RETURN -ne 0 ] + then + >&2 echo "Compile error: $BISON_OUTPUT, abort." + exit 1 +fi +if [[ $BISON_OUTPUT == *"conflict"* ]] +then + >&2 echo "Compile conflict: $BISON_OUTPUT, abort." + exit 1 +fi +} + # generate pl_parser -bison -v -Werror -d ../../../src/pl/parser/pl_parser_mysql_mode.y -o ../../../src/pl/parser/pl_parser_mysql_mode_tab.c -if [ $? -ne 0 ] -then - echo Compile error[$?], abort - exit 1 -fi -if [ $? -ne 0 ] -then - echo Compile error[$?], abort. - exit 1 -fi +bison_parser ../../../src/pl/parser/pl_parser_mysql_mode.y ../../../src/pl/parser/pl_parser_mysql_mode_tab.c + flex -o ../../../src/pl/parser/pl_parser_mysql_mode_lex.c ../../../src/pl/parser/pl_parser_mysql_mode.l ../../../src/pl/parser/pl_parser_mysql_mode_tab.h #./gen_type_name.sh ob_item_type.h >type_name.c diff --git a/src/pl/parser/pl_parser_mysql_mode.y b/src/pl/parser/pl_parser_mysql_mode.y index b2b47a0c4..e15e1cd8e 100644 --- a/src/pl/parser/pl_parser_mysql_mode.y +++ b/src/pl/parser/pl_parser_mysql_mode.y @@ -543,7 +543,7 @@ call_sp_stmt: opt_sp_cparam_list: /* Empty */ { $$ = NULL; } - | '(' ')' { $$ =NULL; } + | '(' ')' { $$ = NULL; } | '(' sp_cparams ')' { merge_nodes($$, parse_ctx->mem_pool_, T_SP_CPARAM_LIST, $2); @@ -589,7 +589,7 @@ opt_sp_cparam_with_assign: ; cexpr: - { + %prec LOWER_PARENS { //same as expr in sql rule, and terminate when read ';' do_parse_sql_expr_rule($$, parse_ctx, 3, ',', ')', PARAM_ASSIGN_OPERATOR); if (NULL == $$) {