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
|
||||
* $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,7 +52,9 @@ static void addlit(char *ytext, int yleng);
|
||||
|
||||
int state_before;
|
||||
|
||||
struct _yy_buffer { YY_BUFFER_STATE buffer;
|
||||
struct _yy_buffer
|
||||
{
|
||||
YY_BUFFER_STATE buffer;
|
||||
long lineno;
|
||||
char *filename;
|
||||
struct _yy_buffer *next;
|
||||
@ -63,7 +65,8 @@ static char *old;
|
||||
#define MAX_NESTED_IF 128
|
||||
static short preproc_tos;
|
||||
static short ifcond;
|
||||
static struct _if_value {
|
||||
static struct _if_value
|
||||
{
|
||||
short condition;
|
||||
short else_branch;
|
||||
} stacked_if_value[MAX_NESTED_IF];
|
||||
@ -285,7 +288,6 @@ cppline {space}*#(.*\\{space})*.*
|
||||
yyless(2);
|
||||
fputs("/*", yyout);
|
||||
}
|
||||
|
||||
<xc>{xcstart} {
|
||||
xcdepth++;
|
||||
/* Put back any characters past slash-star; see above */
|
||||
@ -319,13 +321,9 @@ cppline {space}*#(.*\\{space})*.*
|
||||
}
|
||||
|
||||
<xh>{xhinside} |
|
||||
<xbit>{xbitinside} {
|
||||
addlit(yytext, yyleng);
|
||||
}
|
||||
<xbit>{xbitinside} { addlit(yytext, yyleng); }
|
||||
<xh>{xhcat} |
|
||||
<xbit>{xbitcat} {
|
||||
/* ignore */
|
||||
}
|
||||
<xbit>{xbitcat} { /* ignore */ }
|
||||
<xbit><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); }
|
||||
|
||||
<SQL>{xhstart} {
|
||||
@ -364,12 +362,8 @@ cppline {space}*#(.*\\{space})*.*
|
||||
}
|
||||
<xq>{xqdouble} |
|
||||
<xq>{xqinside} |
|
||||
<xq>{xqliteral} {
|
||||
addlit(yytext, yyleng);
|
||||
}
|
||||
<xq>{xqcat} {
|
||||
/* ignore */
|
||||
}
|
||||
<xq>{xqliteral} { addlit(yytext, yyleng); }
|
||||
<xq>{xqcat} { /* ignore */ }
|
||||
|
||||
<xq><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted string"); }
|
||||
|
||||
@ -405,21 +399,15 @@ cppline {space}*#(.*\\{space})*.*
|
||||
yylval.str = mm_strdup(literalbuf);
|
||||
return CSTRING;
|
||||
}
|
||||
<xd>{xddouble} {
|
||||
addlit(yytext, yyleng-1);
|
||||
}
|
||||
<xd>{xdinside} {
|
||||
addlit(yytext, yyleng);
|
||||
}
|
||||
<xd>{xddouble} { addlit(yytext, yyleng-1); }
|
||||
<xd>{xdinside} { addlit(yytext, yyleng); }
|
||||
<xd,xdc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted identifier"); }
|
||||
<C,SQL>{xdstart} {
|
||||
state_before = YYSTATE;
|
||||
BEGIN(xdc);
|
||||
startlit();
|
||||
}
|
||||
<xdc>{xdcinside} {
|
||||
addlit(yytext, yyleng);
|
||||
}
|
||||
<xdc>{xdcinside} { addlit(yytext, yyleng); }
|
||||
<SQL>{typecast} { return TYPECAST; }
|
||||
<SQL>{self} { /*
|
||||
* We may find a ';' inside a structure
|
||||
@ -687,12 +675,10 @@ cppline {space}*#(.*\\{space})*.*
|
||||
if ( preproc_tos == 0 ) {
|
||||
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;'");
|
||||
}
|
||||
else {
|
||||
else
|
||||
preproc_tos--;
|
||||
}
|
||||
|
||||
ifcond = TRUE; BEGIN(xcond);
|
||||
}
|
||||
@ -707,29 +693,23 @@ cppline {space}*#(.*\\{space})*.*
|
||||
(stacked_if_value[preproc_tos-1].condition &&
|
||||
! stacked_if_value[preproc_tos].condition);
|
||||
|
||||
if ( stacked_if_value[preproc_tos].condition ) {
|
||||
if ( stacked_if_value[preproc_tos].condition )
|
||||
BEGIN(C);
|
||||
}
|
||||
else {
|
||||
else
|
||||
BEGIN(xskip);
|
||||
}
|
||||
}
|
||||
}
|
||||
<C,xskip>{exec_sql}{endif}{space}*";" {
|
||||
if ( preproc_tos == 0 ) {
|
||||
if ( preproc_tos == 0 )
|
||||
mmerror(PARSE_ERROR, ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");
|
||||
}
|
||||
else {
|
||||
else
|
||||
preproc_tos--;
|
||||
}
|
||||
|
||||
if ( stacked_if_value[preproc_tos].condition ) {
|
||||
if ( stacked_if_value[preproc_tos].condition )
|
||||
BEGIN(C);
|
||||
}
|
||||
else {
|
||||
else
|
||||
BEGIN(xskip);
|
||||
}
|
||||
}
|
||||
|
||||
<xskip>{other} { /* ignore */ }
|
||||
|
||||
@ -737,7 +717,8 @@ cppline {space}*#(.*\\{space})*.*
|
||||
if ( preproc_tos >= MAX_NESTED_IF-1 ) {
|
||||
mmerror(PARSE_ERROR, ET_FATAL, "Too many nested 'EXEC SQL IFDEF' conditions");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
struct _defines *defptr;
|
||||
unsigned int i;
|
||||
|
||||
@ -758,13 +739,11 @@ cppline {space}*#(.*\\{space})*.*
|
||||
( (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;
|
||||
}
|
||||
else {
|
||||
else
|
||||
BEGIN(xskip);
|
||||
}
|
||||
}
|
||||
|
||||
<def_ident>{identifier} {
|
||||
old = mm_strdup(yytext);
|
||||
@ -796,11 +775,10 @@ cppline {space}*#(.*\\{space})*.*
|
||||
|
||||
BEGIN(C);
|
||||
}
|
||||
<def>[^;] {
|
||||
addlit(yytext, yyleng);
|
||||
}
|
||||
<def>[^;] { addlit(yytext, yyleng); }
|
||||
|
||||
<incl>[^;]+";" { /* got the include file name */
|
||||
<incl>[^;]+";" {
|
||||
/* got the include file name */
|
||||
struct _yy_buffer *yb;
|
||||
struct _include_path *ip;
|
||||
char inc_file[MAXPGPATH];
|
||||
@ -815,8 +793,10 @@ cppline {space}*#(.*\\{space})*.*
|
||||
|
||||
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;
|
||||
i > 0 && isspace((unsigned char) yytext[i]);
|
||||
i-- )
|
||||
@ -840,7 +820,6 @@ cppline {space}*#(.*\\{space})*.*
|
||||
strcat(inc_file, ".h");
|
||||
yyin = fopen( inc_file, "r" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!yyin)
|
||||
@ -858,9 +837,9 @@ cppline {space}*#(.*\\{space})*.*
|
||||
}
|
||||
|
||||
<<EOF>> {
|
||||
if ( preproc_tos > 0 ) {
|
||||
if ( preproc_tos > 0 )
|
||||
{
|
||||
preproc_tos = 0;
|
||||
|
||||
mmerror(PARSE_ERROR, ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
|
||||
}
|
||||
|
||||
@ -921,9 +900,9 @@ addlit(char *ytext, int yleng)
|
||||
/* enlarge buffer if needed */
|
||||
if ((literallen+yleng) >= literalalloc)
|
||||
{
|
||||
do {
|
||||
do
|
||||
literalalloc *= 2;
|
||||
} while ((literallen+yleng) >= literalalloc);
|
||||
while ((literallen+yleng) >= literalalloc);
|
||||
literalbuf = (char *) realloc(literalbuf, literalalloc);
|
||||
}
|
||||
/* 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