mirror of
https://github.com/postgres/postgres.git
synced 2025-05-12 16:21:30 +03:00
Manually clean up indenting of ecpg lex/yacc files, OK'ed by Michael
Meskes. These files are not touched by pgindent so this has to be manually done.
This commit is contained in:
parent
01747692fe
commit
efd45bc68f
@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.87 2002/03/10 12:09:54 meskes Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.88 2002/03/15 21:46:59 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -52,18 +52,21 @@ static void addlit(char *ytext, int yleng);
|
|||||||
|
|
||||||
int state_before;
|
int state_before;
|
||||||
|
|
||||||
struct _yy_buffer { YY_BUFFER_STATE buffer;
|
struct _yy_buffer
|
||||||
|
{
|
||||||
|
YY_BUFFER_STATE buffer;
|
||||||
long lineno;
|
long lineno;
|
||||||
char * filename;
|
char *filename;
|
||||||
struct _yy_buffer * next;
|
struct _yy_buffer *next;
|
||||||
} *yy_buffer = NULL;
|
} *yy_buffer = NULL;
|
||||||
|
|
||||||
static char *old;
|
static char *old;
|
||||||
|
|
||||||
#define MAX_NESTED_IF 128
|
#define MAX_NESTED_IF 128
|
||||||
static short preproc_tos;
|
static short preproc_tos;
|
||||||
static short ifcond;
|
static short ifcond;
|
||||||
static struct _if_value {
|
static struct _if_value
|
||||||
|
{
|
||||||
short condition;
|
short condition;
|
||||||
short else_branch;
|
short else_branch;
|
||||||
} stacked_if_value[MAX_NESTED_IF];
|
} stacked_if_value[MAX_NESTED_IF];
|
||||||
@ -285,7 +288,6 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
yyless(2);
|
yyless(2);
|
||||||
fputs("/*", yyout);
|
fputs("/*", yyout);
|
||||||
}
|
}
|
||||||
|
|
||||||
<xc>{xcstart} {
|
<xc>{xcstart} {
|
||||||
xcdepth++;
|
xcdepth++;
|
||||||
/* Put back any characters past slash-star; see above */
|
/* Put back any characters past slash-star; see above */
|
||||||
@ -319,13 +321,9 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
}
|
}
|
||||||
|
|
||||||
<xh>{xhinside} |
|
<xh>{xhinside} |
|
||||||
<xbit>{xbitinside} {
|
<xbit>{xbitinside} { addlit(yytext, yyleng); }
|
||||||
addlit(yytext, yyleng);
|
|
||||||
}
|
|
||||||
<xh>{xhcat} |
|
<xh>{xhcat} |
|
||||||
<xbit>{xbitcat} {
|
<xbit>{xbitcat} { /* ignore */ }
|
||||||
/* ignore */
|
|
||||||
}
|
|
||||||
<xbit><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); }
|
<xbit><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); }
|
||||||
|
|
||||||
<SQL>{xhstart} {
|
<SQL>{xhstart} {
|
||||||
@ -340,10 +338,10 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtol(literalbuf, &endptr, 16);
|
val = strtol(literalbuf, &endptr, 16);
|
||||||
if (*endptr != '\0' || errno == ERANGE
|
if (*endptr != '\0' || errno == ERANGE
|
||||||
#ifdef HAVE_LONG_INT_64
|
#ifdef HAVE_LONG_INT_64
|
||||||
/* if long > 32 bits, check for overflow of int4 */
|
/* if long > 32 bits, check for overflow of int4 */
|
||||||
|| val != (long) ((int32) val)
|
|| val != (long) ((int32) val)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
mmerror(PARSE_ERROR, ET_ERROR, "Bad hexadecimal integer input");
|
mmerror(PARSE_ERROR, ET_ERROR, "Bad hexadecimal integer input");
|
||||||
yylval.ival = val;
|
yylval.ival = val;
|
||||||
@ -364,12 +362,8 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
}
|
}
|
||||||
<xq>{xqdouble} |
|
<xq>{xqdouble} |
|
||||||
<xq>{xqinside} |
|
<xq>{xqinside} |
|
||||||
<xq>{xqliteral} {
|
<xq>{xqliteral} { addlit(yytext, yyleng); }
|
||||||
addlit(yytext, yyleng);
|
<xq>{xqcat} { /* ignore */ }
|
||||||
}
|
|
||||||
<xq>{xqcat} {
|
|
||||||
/* ignore */
|
|
||||||
}
|
|
||||||
|
|
||||||
<xq><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted string"); }
|
<xq><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted string"); }
|
||||||
|
|
||||||
@ -405,21 +399,15 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
yylval.str = mm_strdup(literalbuf);
|
yylval.str = mm_strdup(literalbuf);
|
||||||
return CSTRING;
|
return CSTRING;
|
||||||
}
|
}
|
||||||
<xd>{xddouble} {
|
<xd>{xddouble} { addlit(yytext, yyleng-1); }
|
||||||
addlit(yytext, yyleng-1);
|
<xd>{xdinside} { addlit(yytext, yyleng); }
|
||||||
}
|
|
||||||
<xd>{xdinside} {
|
|
||||||
addlit(yytext, yyleng);
|
|
||||||
}
|
|
||||||
<xd,xdc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted identifier"); }
|
<xd,xdc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted identifier"); }
|
||||||
<C,SQL>{xdstart} {
|
<C,SQL>{xdstart} {
|
||||||
state_before = YYSTATE;
|
state_before = YYSTATE;
|
||||||
BEGIN(xdc);
|
BEGIN(xdc);
|
||||||
startlit();
|
startlit();
|
||||||
}
|
}
|
||||||
<xdc>{xdcinside} {
|
<xdc>{xdcinside} { addlit(yytext, yyleng); }
|
||||||
addlit(yytext, yyleng);
|
|
||||||
}
|
|
||||||
<SQL>{typecast} { return TYPECAST; }
|
<SQL>{typecast} { return TYPECAST; }
|
||||||
<SQL>{self} { /*
|
<SQL>{self} { /*
|
||||||
* We may find a ';' inside a structure
|
* We may find a ';' inside a structure
|
||||||
@ -687,12 +675,10 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
if ( preproc_tos == 0 ) {
|
if ( preproc_tos == 0 ) {
|
||||||
mmerror(PARSE_ERROR, ET_FATAL, "Missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
|
mmerror(PARSE_ERROR, ET_FATAL, "Missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
|
||||||
}
|
}
|
||||||
else if ( stacked_if_value[preproc_tos].else_branch ) {
|
else if ( stacked_if_value[preproc_tos].else_branch )
|
||||||
mmerror(PARSE_ERROR, ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
|
mmerror(PARSE_ERROR, ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
preproc_tos--;
|
preproc_tos--;
|
||||||
}
|
|
||||||
|
|
||||||
ifcond = TRUE; BEGIN(xcond);
|
ifcond = TRUE; BEGIN(xcond);
|
||||||
}
|
}
|
||||||
@ -707,29 +693,23 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
(stacked_if_value[preproc_tos-1].condition &&
|
(stacked_if_value[preproc_tos-1].condition &&
|
||||||
! stacked_if_value[preproc_tos].condition);
|
! stacked_if_value[preproc_tos].condition);
|
||||||
|
|
||||||
if ( stacked_if_value[preproc_tos].condition ) {
|
if ( stacked_if_value[preproc_tos].condition )
|
||||||
BEGIN(C);
|
BEGIN(C);
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
BEGIN(xskip);
|
BEGIN(xskip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
<C,xskip>{exec_sql}{endif}{space}*";" {
|
<C,xskip>{exec_sql}{endif}{space}*";" {
|
||||||
if ( preproc_tos == 0 ) {
|
if ( preproc_tos == 0 )
|
||||||
mmerror(PARSE_ERROR, ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");
|
mmerror(PARSE_ERROR, ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
preproc_tos--;
|
preproc_tos--;
|
||||||
}
|
|
||||||
|
|
||||||
if ( stacked_if_value[preproc_tos].condition ) {
|
if ( stacked_if_value[preproc_tos].condition )
|
||||||
BEGIN(C);
|
BEGIN(C);
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
BEGIN(xskip);
|
BEGIN(xskip);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
<xskip>{other} { /* ignore */ }
|
<xskip>{other} { /* ignore */ }
|
||||||
|
|
||||||
@ -737,7 +717,8 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
if ( preproc_tos >= MAX_NESTED_IF-1 ) {
|
if ( preproc_tos >= MAX_NESTED_IF-1 ) {
|
||||||
mmerror(PARSE_ERROR, ET_FATAL, "Too many nested 'EXEC SQL IFDEF' conditions");
|
mmerror(PARSE_ERROR, ET_FATAL, "Too many nested 'EXEC SQL IFDEF' conditions");
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
struct _defines *defptr;
|
struct _defines *defptr;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -758,13 +739,11 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
( (defptr ? ifcond : !ifcond) && stacked_if_value[preproc_tos-1].condition );
|
( (defptr ? ifcond : !ifcond) && stacked_if_value[preproc_tos-1].condition );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( stacked_if_value[preproc_tos].condition ) {
|
if ( stacked_if_value[preproc_tos].condition )
|
||||||
BEGIN C;
|
BEGIN C;
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
BEGIN(xskip);
|
BEGIN(xskip);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
<def_ident>{identifier} {
|
<def_ident>{identifier} {
|
||||||
old = mm_strdup(yytext);
|
old = mm_strdup(yytext);
|
||||||
@ -796,11 +775,10 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
|
|
||||||
BEGIN(C);
|
BEGIN(C);
|
||||||
}
|
}
|
||||||
<def>[^;] {
|
<def>[^;] { addlit(yytext, yyleng); }
|
||||||
addlit(yytext, yyleng);
|
|
||||||
}
|
|
||||||
|
|
||||||
<incl>[^;]+";" { /* got the include file name */
|
<incl>[^;]+";" {
|
||||||
|
/* got the include file name */
|
||||||
struct _yy_buffer *yb;
|
struct _yy_buffer *yb;
|
||||||
struct _include_path *ip;
|
struct _include_path *ip;
|
||||||
char inc_file[MAXPGPATH];
|
char inc_file[MAXPGPATH];
|
||||||
@ -815,8 +793,10 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
|
|
||||||
yy_buffer = yb;
|
yy_buffer = yb;
|
||||||
|
|
||||||
/* skip the ";" and trailing whitespace. Note that yytext contains
|
/*
|
||||||
at least one non-space character plus the ";" */
|
* skip the ";" and trailing whitespace. Note that yytext contains
|
||||||
|
* at least one non-space character plus the ";"
|
||||||
|
*/
|
||||||
for ( i = strlen(yytext)-2;
|
for ( i = strlen(yytext)-2;
|
||||||
i > 0 && isspace((unsigned char) yytext[i]);
|
i > 0 && isspace((unsigned char) yytext[i]);
|
||||||
i-- )
|
i-- )
|
||||||
@ -840,7 +820,6 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
strcat(inc_file, ".h");
|
strcat(inc_file, ".h");
|
||||||
yyin = fopen( inc_file, "r" );
|
yyin = fopen( inc_file, "r" );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!yyin)
|
if (!yyin)
|
||||||
@ -858,9 +837,9 @@ cppline {space}*#(.*\\{space})*.*
|
|||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
if ( preproc_tos > 0 ) {
|
if ( preproc_tos > 0 )
|
||||||
|
{
|
||||||
preproc_tos = 0;
|
preproc_tos = 0;
|
||||||
|
|
||||||
mmerror(PARSE_ERROR, ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
|
mmerror(PARSE_ERROR, ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,9 +900,9 @@ addlit(char *ytext, int yleng)
|
|||||||
/* enlarge buffer if needed */
|
/* enlarge buffer if needed */
|
||||||
if ((literallen+yleng) >= literalalloc)
|
if ((literallen+yleng) >= literalalloc)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
literalalloc *= 2;
|
literalalloc *= 2;
|
||||||
} while ((literallen+yleng) >= literalalloc);
|
while ((literallen+yleng) >= literalalloc);
|
||||||
literalbuf = (char *) realloc(literalbuf, literalalloc);
|
literalbuf = (char *) realloc(literalbuf, literalalloc);
|
||||||
}
|
}
|
||||||
/* append new data, add trailing null */
|
/* append new data, add trailing null */
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user