Commit 71b9df2b authored by Bruce Momjian's avatar Bruce Momjian

Make pgc.l source code alignment consistent.

parent bd5d12a1
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.137 2005/10/05 14:58:36 meskes Exp $ * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.138 2006/02/01 20:56:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -777,8 +777,8 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -777,8 +777,8 @@ cppline {space}*#(.*\\{space})*.*{newline}
keyword = ScanCKeywordLookup(yytext); keyword = ScanCKeywordLookup(yytext);
if (keyword != NULL) if (keyword != NULL)
return keyword->value; return keyword->value;
else
else { {
yylval.str = mm_strdup(yytext); yylval.str = mm_strdup(yytext);
return IDENT; return IDENT;
} }
...@@ -886,15 +886,15 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -886,15 +886,15 @@ cppline {space}*#(.*\\{space})*.*{newline}
/* are we simulating Informix? */ /* are we simulating Informix? */
if (INFORMIX_MODE) if (INFORMIX_MODE)
{ {
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);
} }
else else
{ {
...@@ -904,16 +904,16 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -904,16 +904,16 @@ cppline {space}*#(.*\\{space})*.*{newline}
} }
<C,xskip>{exec_sql}{else}{space}*";" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */ <C,xskip>{exec_sql}{else}{space}*";" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */
if ( stacked_if_value[preproc_tos].else_branch ) { if (stacked_if_value[preproc_tos].else_branch)
mmerror(PARSE_ERROR, ET_FATAL, "Duplicated 'EXEC SQL ELSE;'"); mmerror(PARSE_ERROR, ET_FATAL, "Duplicated 'EXEC SQL ELSE;'");
} else
else { {
stacked_if_value[preproc_tos].else_branch = TRUE; stacked_if_value[preproc_tos].else_branch = TRUE;
stacked_if_value[preproc_tos].condition = stacked_if_value[preproc_tos].condition =
(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);
...@@ -923,16 +923,16 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -923,16 +923,16 @@ cppline {space}*#(.*\\{space})*.*{newline}
/* are we simulating Informix? */ /* are we simulating Informix? */
if (INFORMIX_MODE) if (INFORMIX_MODE)
{ {
if ( stacked_if_value[preproc_tos].else_branch ) { if (stacked_if_value[preproc_tos].else_branch)
mmerror(PARSE_ERROR, ET_FATAL, "Duplicated 'EXEC SQL ELSE;'"); mmerror(PARSE_ERROR, ET_FATAL, "Duplicated 'EXEC SQL ELSE;'");
} else
else { {
stacked_if_value[preproc_tos].else_branch = TRUE; stacked_if_value[preproc_tos].else_branch = TRUE;
stacked_if_value[preproc_tos].condition = stacked_if_value[preproc_tos].condition =
(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);
...@@ -945,12 +945,12 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -945,12 +945,12 @@ cppline {space}*#(.*\\{space})*.*{newline}
} }
} }
<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);
...@@ -959,12 +959,12 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -959,12 +959,12 @@ cppline {space}*#(.*\\{space})*.*{newline}
/* are we simulating Informix? */ /* are we simulating Informix? */
if (INFORMIX_MODE) if (INFORMIX_MODE)
{ {
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);
...@@ -979,32 +979,35 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -979,32 +979,35 @@ cppline {space}*#(.*\\{space})*.*{newline}
<xskip>{other} { /* ignore */ } <xskip>{other} { /* ignore */ }
<xcond>{identifier}{space}*";" { <xcond>{identifier}{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;
/* 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
for ( i = strlen(yytext)-2; * contains at least one non-space character plus the ";"
*/
for (i = strlen(yytext)-2;
i > 0 && isspace((unsigned char) yytext[i]); i > 0 && isspace((unsigned char) yytext[i]);
i-- ) i-- )
{} ;
yytext[i+1] = '\0'; yytext[i+1] = '\0';
for ( defptr = defines; defptr != NULL && for (defptr = defines;
( strcmp(yytext, defptr->old) != 0 ); defptr = defptr->next ); defptr != NULL && strcmp(yytext, defptr->old) != 0;
defptr = defptr->next)
;
preproc_tos++; preproc_tos++;
stacked_if_value[preproc_tos].else_branch = FALSE; stacked_if_value[preproc_tos].else_branch = FALSE;
stacked_if_value[preproc_tos].condition = stacked_if_value[preproc_tos].condition =
( (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);
...@@ -1048,7 +1051,8 @@ cppline {space}*#(.*\\{space})*.*{newline} ...@@ -1048,7 +1051,8 @@ cppline {space}*#(.*\\{space})*.*{newline}
<incl>[^;\<\>\"]+";" { parse_include(); } <incl>[^;\<\>\"]+";" { parse_include(); }
<<EOF>> { <<EOF>> {
if (yy_buffer == NULL) { if (yy_buffer == NULL)
{
if ( preproc_tos > 0 ) if ( preproc_tos > 0 )
{ {
preproc_tos = 0; preproc_tos = 0;
...@@ -1168,10 +1172,10 @@ parse_include(void) ...@@ -1168,10 +1172,10 @@ parse_include(void)
* skip the ";" if there is one and trailing whitespace. Note that * skip the ";" if there is one and trailing whitespace. Note that
* yytext contains at least one non-space character plus the ";" * 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--)
{} ;
if (yytext[i] == ';') if (yytext[i] == ';')
i--; i--;
...@@ -1182,7 +1186,7 @@ parse_include(void) ...@@ -1182,7 +1186,7 @@ parse_include(void)
/* If file name is enclosed in '"' remove these and look only in '.' */ /* If file name is enclosed in '"' remove these and look only in '.' */
/* Informix does look into all include paths though, except filename starts with '/' */ /* Informix does look into all include paths though, except filename starts with '/' */
if ((yytext[0] == '"' && yytext[i] == '"') && if (yytext[0] == '"' && yytext[i] == '"' &&
((compat != ECPG_COMPAT_INFORMIX && compat != ECPG_COMPAT_INFORMIX_SE) || yytext[1] == '/')) ((compat != ECPG_COMPAT_INFORMIX && compat != ECPG_COMPAT_INFORMIX_SE) || yytext[1] == '/'))
{ {
yytext[i] = '\0'; yytext[i] = '\0';
......
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