Commit a58930bb authored by Michael Meskes's avatar Michael Meskes

Synced parser yet again.

Michael
parent d4803f55
...@@ -1270,6 +1270,12 @@ Mon Jun 17 15:23:51 CEST 2002 ...@@ -1270,6 +1270,12 @@ Mon Jun 17 15:23:51 CEST 2002
- Fixed parser bug in pgc.l. Octal numbers in single quotes are now - Fixed parser bug in pgc.l. Octal numbers in single quotes are now
correctly handled. correctly handled.
Sat Jul 20 10:09:58 CEST 2002
- Synced preproc.y with gram.y.
- Synced pgc.l with scan.l.
- Synced keywords.c.
- Set ecpg version to 2.10.0. - Set ecpg version to 2.10.0.
- Set library version to 3.4.0. - Set library version to 3.4.0.
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.37 2002/06/12 12:06:53 meskes Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.38 2002/07/20 08:24:18 meskes Exp $ */
/* /*
* The aim is to get a simpler inteface to the database routines. * The aim is to get a simpler inteface to the database routines.
...@@ -56,7 +56,7 @@ struct sqlca sqlca = ...@@ -56,7 +56,7 @@ struct sqlca sqlca =
}; };
/* This function returns a newly malloced string that has the \ /* This function returns a newly malloced string that has the \
in the argument quoted with \ and the ' quote with ' as SQL92 says. in the argument quoted with \ and the ' quoted with ' as SQL92 says.
*/ */
static static
char * char *
...@@ -84,7 +84,6 @@ quote_postgres(char *arg, int lineno) ...@@ -84,7 +84,6 @@ quote_postgres(char *arg, int lineno)
default: default:
; ;
} }
res[ri] = arg[i]; res[ri] = arg[i];
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.52 2002/07/01 06:56:10 meskes Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.53 2002/07/20 08:24:18 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -44,6 +44,8 @@ static ScanKeyword ScanKeywords[] = { ...@@ -44,6 +44,8 @@ static ScanKeyword ScanKeywords[] = {
{"as", AS}, {"as", AS},
{"asc", ASC}, {"asc", ASC},
{"assertion", ASSERTION}, {"assertion", ASSERTION},
{"assignment", ASSIGNMENT},
{"asymmetric", ASYMMETRIC},
{"at", AT}, {"at", AT},
{"authorization", AUTHORIZATION}, {"authorization", AUTHORIZATION},
{"backward", BACKWARD}, {"backward", BACKWARD},
...@@ -77,6 +79,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -77,6 +79,7 @@ static ScanKeyword ScanKeywords[] = {
{"committed", COMMITTED}, {"committed", COMMITTED},
{"constraint", CONSTRAINT}, {"constraint", CONSTRAINT},
{"constraints", CONSTRAINTS}, {"constraints", CONSTRAINTS},
{"conversion", CONVERSION_P},
{"copy", COPY}, {"copy", COPY},
{"create", CREATE}, {"create", CREATE},
{"createdb", CREATEDB}, {"createdb", CREATEDB},
...@@ -98,6 +101,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -98,6 +101,7 @@ static ScanKeyword ScanKeywords[] = {
{"deferred", DEFERRED}, {"deferred", DEFERRED},
{"definer", DEFINER}, {"definer", DEFINER},
{"delete", DELETE_P}, {"delete", DELETE_P},
{"delimiter", DELIMITER},
{"delimiters", DELIMITERS}, {"delimiters", DELIMITERS},
{"desc", DESC}, {"desc", DESC},
{"distinct", DISTINCT}, {"distinct", DISTINCT},
...@@ -251,6 +255,8 @@ static ScanKeyword ScanKeywords[] = { ...@@ -251,6 +255,8 @@ static ScanKeyword ScanKeywords[] = {
{"setof", SETOF}, {"setof", SETOF},
{"share", SHARE}, {"share", SHARE},
{"show", SHOW}, {"show", SHOW},
{"similar", SIMILAR},
{"simple", SIMPLE},
{"smallint", SMALLINT}, {"smallint", SMALLINT},
{"some", SOME}, {"some", SOME},
{"stable", STABLE}, {"stable", STABLE},
...@@ -262,6 +268,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -262,6 +268,7 @@ static ScanKeyword ScanKeywords[] = {
{"storage", STORAGE}, {"storage", STORAGE},
{"strict", STRICT}, {"strict", STRICT},
{"substring", SUBSTRING}, {"substring", SUBSTRING},
{"symmetric", SYMMETRIC},
{"sysid", SYSID}, {"sysid", SYSID},
{"table", TABLE}, {"table", TABLE},
{"temp", TEMP}, {"temp", TEMP},
...@@ -274,6 +281,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -274,6 +281,7 @@ static ScanKeyword ScanKeywords[] = {
{"toast", TOAST}, {"toast", TOAST},
{"trailing", TRAILING}, {"trailing", TRAILING},
{"transaction", TRANSACTION}, {"transaction", TRANSACTION},
{"treat", TREAT},
{"trigger", TRIGGER}, {"trigger", TRIGGER},
{"trim", TRIM}, {"trim", TRIM},
{"true", TRUE_P}, {"true", TRUE_P},
...@@ -304,6 +312,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -304,6 +312,7 @@ static ScanKeyword ScanKeywords[] = {
{"with", WITH}, {"with", WITH},
{"without", WITHOUT}, {"without", WITHOUT},
{"work", WORK}, {"work", WORK},
{"write", WRITE},
{"year", YEAR_P}, {"year", YEAR_P},
{"zone", ZONE}, {"zone", ZONE},
}; };
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.96 2002/07/01 06:56:10 meskes Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.97 2002/07/20 08:24:18 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -89,14 +89,14 @@ static struct _if_value ...@@ -89,14 +89,14 @@ static struct _if_value
* We use exclusive states for quoted strings, extended comments, * We use exclusive states for quoted strings, extended comments,
* and to eliminate parsing troubles for numeric strings. * and to eliminate parsing troubles for numeric strings.
* Exclusive states: * Exclusive states:
* <xbit> bit string literal * <xb> bit string literal
* <xc> extended C-style comments - thomas 1997-07-12 * <xc> extended C-style comments - thomas 1997-07-12
* <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27 * <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27
* <xh> hexadecimal numeric string - thomas 1997-11-16 * <xh> hexadecimal numeric string - thomas 1997-11-16
* <xq> quoted strings - thomas 1997-07-30 * <xq> quoted strings - thomas 1997-07-30
*/ */
%x xbit %x xb
%x xc %x xc
%x xd %x xd
%x xdc %x xdc
...@@ -108,10 +108,10 @@ static struct _if_value ...@@ -108,10 +108,10 @@ static struct _if_value
/* Bit string /* Bit string
*/ */
xbitstart [bB]{quote} xbstart [bB]{quote}
xbitstop {quote} xbstop {quote}
xbitinside [^']* xbinside [^']*
xbitcat {quote}{whitespace_with_newline}{quote} xbcat {quote}{whitespace_with_newline}{quote}
/* Hexadecimal number /* Hexadecimal number
*/ */
...@@ -120,6 +120,10 @@ xhstop {quote} ...@@ -120,6 +120,10 @@ xhstop {quote}
xhinside [^']+ xhinside [^']+
xhcat {quote}{whitespace_with_newline}{quote} xhcat {quote}{whitespace_with_newline}{quote}
/* National character
*/
xnstart [nN]{quote}
/* C version of hex number /* C version of hex number
*/ */
xch 0[xX][0-9A-Fa-f]* xch 0[xX][0-9A-Fa-f]*
...@@ -318,13 +322,13 @@ cppline {space}*#(.*\\{space})*.* ...@@ -318,13 +322,13 @@ cppline {space}*#(.*\\{space})*.*
<xc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated /* comment"); } <xc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated /* comment"); }
<SQL>{xbitstart} { <SQL>{xbstart} {
token_start = yytext; token_start = yytext;
BEGIN(xbit); BEGIN(xb);
startlit(); startlit();
addlitchar('b'); addlitchar('b');
} }
<xbit>{xbitstop} { <xb>{xbstop} {
BEGIN(SQL); BEGIN(SQL);
if (literalbuf[strspn(literalbuf, "01") + 1] != '\0') if (literalbuf[strspn(literalbuf, "01") + 1] != '\0')
mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string input."); mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string input.");
...@@ -333,10 +337,10 @@ cppline {space}*#(.*\\{space})*.* ...@@ -333,10 +337,10 @@ cppline {space}*#(.*\\{space})*.*
} }
<xh>{xhinside} | <xh>{xhinside} |
<xbit>{xbitinside} { addlit(yytext, yyleng); } <xb>{xbinside} { addlit(yytext, yyleng); }
<xh>{xhcat} | <xh>{xhcat} |
<xbit>{xbitcat} { /* ignore */ } <xb>{xbcat} { /* ignore */ }
<xbit><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); } <xb><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); }
<SQL>{xhstart} { <SQL>{xhstart} {
token_start = yytext; token_start = yytext;
...@@ -362,7 +366,15 @@ cppline {space}*#(.*\\{space})*.* ...@@ -362,7 +366,15 @@ cppline {space}*#(.*\\{space})*.*
} }
<xh><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated hexadecimal integer"); } <xh><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated hexadecimal integer"); }
<SQL>{xnstart} {
/* National character.
* Need to remember type info to flow it forward into the parser.
* Not yet implemented. - thomas 2002-06-17
*/
token_start = yytext;
BEGIN(xq);
startlit();
}
<C,SQL>{xqstart} { <C,SQL>{xqstart} {
token_start = yytext; token_start = yytext;
state_before = YYSTATE; state_before = YYSTATE;
...@@ -372,7 +384,6 @@ cppline {space}*#(.*\\{space})*.* ...@@ -372,7 +384,6 @@ cppline {space}*#(.*\\{space})*.*
<xq>{xqstop} { <xq>{xqstop} {
BEGIN(state_before); BEGIN(state_before);
yylval.str = mm_strdup(literalbuf); yylval.str = mm_strdup(literalbuf);
printf("MM: %s\n", yylval.str);
return SCONST; return SCONST;
} }
<xq>{xqdouble} { addlitchar('\''); } <xq>{xqdouble} { addlitchar('\''); }
...@@ -580,7 +591,7 @@ cppline {space}*#(.*\\{space})*.* ...@@ -580,7 +591,7 @@ cppline {space}*#(.*\\{space})*.*
*/ */
if (ptr == NULL) if (ptr == NULL)
{ {
yylval.str = mm_strdup( yytext); yylval.str = mm_strdup(yytext);
return IDENT; return IDENT;
} }
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment