diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index cff09a8d0c..221ad7dd41 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -1004,5 +1004,10 @@ Tue Oct 31 16:09:55 CET 2000 - Added patch by Christof Petig fixing some parser bugs. + +Fri Nov 3 11:34:43 CET 2000 + + - Synced pgc.l with scan.l. + - Synced gram.y and preproc.y. - Set ecpg version to 2.8.0. - Set library version to 3.2.0. diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index d6b4b28dff..0837b9b00e 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.66 2000/10/25 07:00:33 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.67 2000/11/03 10:47:54 meskes Exp $ * *------------------------------------------------------------------------- */ @@ -21,8 +21,6 @@ #include #include -#include "postgres.h" - #include "miscadmin.h" #include "nodes/parsenodes.h" #include "nodes/pg_list.h" @@ -89,14 +87,14 @@ static struct _if_value { * We use exclusive states for quoted strings, extended comments, * and to eliminate parsing troubles for numeric strings. * Exclusive states: - * binary numeric string - thomas 1997-11-16 + * bit string literal * extended C-style comments - thomas 1997-07-12 * delimited identifiers (double-quoted identifiers) - thomas 1997-10-27 * hexadecimal numeric string - thomas 1997-11-16 * quoted strings - thomas 1997-07-30 */ -%x xb +%x xbit %x xc %x xd %x xdc @@ -106,12 +104,12 @@ static struct _if_value { %x xcond %x xskip -/* Binary number +/* Bit string */ -xbstart [bB]{quote} -xbstop {quote} -xbinside [^']+ -xbcat {quote}{whitespace_with_newline}{quote} +xbitstart [bB]{quote} +xbitstop {quote} +xbitinside [^']* +xbitcat {quote}{whitespace_with_newline}{quote} /* Hexadecimal number */ @@ -192,7 +190,7 @@ typecast "::" * If you change either set, adjust the character lists appearing in the * rule for "operator"! */ -self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|] +self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=] op_chars [\~\!\@\#\^\&\|\`\?\$\+\-\*\/\%\<\>\=] operator {op_chars}+ @@ -313,30 +311,29 @@ cppline {space}*#(.*\\{line_end})*.* <> { mmerror(ET_ERROR, "Unterminated /* comment"); } -{xbstart} { - BEGIN(xb); +{xbitstart} { + BEGIN(xbit); startlit(); } -{xbstop} { +{xbitstop} { char* endptr; BEGIN(SQL); - errno = 0; - yylval.ival = strtol(literalbuf, &endptr, 2); - if (*endptr != '\0' || errno == ERANGE) - mmerror(ET_ERROR, "Bad binary integer input!"); - return ICONST; + if (literalbuf[strspn(literalbuf, "01") + 1] != '\0') + mmerror(ET_ERROR, "invalid bit string input."); + yylval.str = literalbuf; + return BITCONST; } {xhinside} | -{xbinside} { +{xbitinside} { addlit(yytext, yyleng); } {xhcat} | -{xbcat} { +{xbitcat} { /* ignore */ } -<> { mmerror(ET_ERROR, "Unterminated binary integer"); } +<> { mmerror(ET_ERROR, "Unterminated bit string"); } {xhstart} { BEGIN(xh); @@ -490,7 +487,7 @@ cppline {space}*#(.*\\{line_end})*.* * that the "self" rule would have. */ if (nchars == 1 && - strchr(",()[].;$:+-*/%^<>=|", yytext[0])) + strchr(",()[].;$:+-*/%^<>=", yytext[0])) return yytext[0]; } diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 1a0beba3e6..ded00a63ef 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -242,7 +242,7 @@ make_name(void) %token UNIONJOIN /* Special keywords, not in the query language - see the "lex" file */ -%token IDENT SCONST Op CSTRING CVARIABLE CPP_LINE IP +%token IDENT SCONST Op CSTRING CVARIABLE CPP_LINE IP BITCONST %token ICONST PARAM %token FCONST @@ -281,7 +281,7 @@ make_name(void) %type CreateAsElement OptCreateAs CreateAsList CreateAsStmt %type OptUnder key_reference comment_text ConstraintDeferrabilitySpec %type key_match ColLabel SpecialRuleRelation ColId columnDef -%type ColConstraint ColConstraintElem drop_type +%type ColConstraint ColConstraintElem drop_type Bitconst %type OptTableElementList OptTableElement TableConstraint %type ConstraintElem key_actions ColQualList TokenId DropSchemaStmt %type target_list target_el update_target_list alias_clause @@ -3790,6 +3790,7 @@ ParamNo: PARAM opt_indirection Iconst: ICONST { $$ = make_name();}; Fconst: FCONST { $$ = make_name();}; +Bitconst: BITCONST { $$ = make_name();}; Sconst: SCONST { $$ = (char *)mm_alloc(strlen($1) + 3); $$[0]='\''; @@ -3825,6 +3826,7 @@ AllConst: Sconst { $$ = $1; } PosAllConst: Sconst { $$ = $1; } | Fconst { $$ = $1; } | Iconst { $$ = $1; } + | Bitconst { $$ = $1; } | civar { $$ = make_str("?"); } ;