From acc610c00cfd5112bd4e6947daf241dfe7bc09cb Mon Sep 17 00:00:00 2001 From: Simon Sobisch Date: Thu, 28 Jul 2022 21:06:54 +0200 Subject: [PATCH] improve parser diagnostics by labeling tokens --- libgixpp/gix_esql_parser.yy | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/libgixpp/gix_esql_parser.yy b/libgixpp/gix_esql_parser.yy index 2d2b9ea..6e65635 100644 --- a/libgixpp/gix_esql_parser.yy +++ b/libgixpp/gix_esql_parser.yy @@ -82,22 +82,22 @@ static std::string to_std_string(connect_to_info_t *i) { if (i) { char buffer [3 */ %token PERIOD %token SELECT -%token SELECTFROM +%token SELECTFROM "SELECT FROM" %token TOKEN -%token HOSTTOKEN +%token HOSTTOKEN "host-variable" %token WORD %token PICTURE %token INSERT %token UPDATE %token DISCONNECT -%token CONNECT_RESET +%token CONNECT_RESET "CONNECT RESET" %token DELETE %token EXECUTE %token OTHERFUNC %token INTO %token NUMERIC -%token END_EXEC -%token EXECSQL +%token END_EXEC "END-EXEC" +%token EXECSQL "EXEC SQL" %token INCLUDE %token FROM %token IMMEDIATE @@ -106,24 +106,24 @@ static std::string to_std_string(connect_to_info_t *i) { if (i) { char buffer [3 %token FOR %token COMMA %token STATEMENT -%token WORKINGBEGIN -%token WORKINGEND +%token WORKINGBEGIN "Begin of WORKING-STORAGE SECTION" +%token WORKINGEND "End of WORLING-STORAGE SECTION" %token LINKAGEBEGIN %token LINKAGEEND -%token LOCALSTORAGEBEGIN -%token LOCALSTORAGEEND +%token LOCALSTORAGEBEGIN "Begin of LOCAL-STORAGE SECTION" +%token LOCALSTORAGEEND "End of LOCAL-STORAGE SECTION" %token FD -%token FILEBEGIN -%token FILEEND -%token PROCEDURE_DIVISION +%token FILEBEGIN "Begin of FILE SECTION" +%token FILEEND "End of FILE SECTION" +%token PROCEDURE_DIVISION "PROCEDURE DIVISION" %token HOSTVARIANTBEGIN %token HOSTVARIANTEND -%token INCLUDE_FILE -%token INCLUDE_SQLCA +%token INCLUDE_FILE "INCLUDE file" +%token INCLUDE_SQLCA "INCLUDE SQLCA" %token SQLCA -%token IDENTIFIED_BY -%token COMMIT_WORK -%token ROLLBACK_WORK +%token IDENTIFIED_BY "IDENTIFIED BY" +%token COMMIT_WORK "COMMIT" +%token ROLLBACK_WORK "ROLLBACK" %token SAVEPOINT %token CONNECT %token TO @@ -132,23 +132,23 @@ static std::string to_std_string(connect_to_info_t *i) { if (i) { char buffer [3 %token IS %token VARYING %token IGNORE -%token DECLARE_VAR +%token DECLARE_VAR "EXEC SQL VAR" %token USING %token OPEN %token CLOSE %token FETCH %token WHENEVER -%token NOT_FOUND +%token NOT_FOUND "NOT FOUND" %token SQLERROR %token SQLWARNING %token CONTINUE %token PERFORM %token GOTO %token TRAILING -%token COMP_1 -%token COMP_2 -%token COMP_3 -%token COMP_5 +%token COMP_1 "COMP-1" +%token COMP_2 "COMP-2" +%token COMP_3 "COMP-3" +%token COMP_5 "COMP-5" %token COMP %token CHAR %token VARCHAR @@ -161,14 +161,14 @@ static std::string to_std_string(connect_to_info_t *i) { if (i) { char buffer [3 %token SIGN %token LEADING %token SEPARATE -%token SQL_TYPE_IS +%token SQL_TYPE_IS "SQL TYPE IS" %token ARE %token VALUE %token ALL %token OCCURS %token UNBOUNDED -%token DEPENDING_ON -%token ASCENDING_KEY_IS +%token DEPENDING_ON "DEPENDING ON" +%token ASCENDING_KEY_IS "ASCENDING KEY IS" %token INDEXED_BY %token EXTERNAL %token TIMES @@ -177,8 +177,8 @@ static std::string to_std_string(connect_to_info_t *i) { if (i) { char buffer [3 %token TABLE %token COPY %token COPY_FILE -%token WITH_HOLD -%token WHERE_CURRENT_OF +%token WITH_HOLD "WITH HOLD" +%token WHERE_CURRENT_OF "WHERE CURRENT OF" %token PREPARE %type *> token_list declaresql includesql incfile opt_othersql_tokens