Make pgc.l source code alignment consistent.

This commit is contained in:
Bruce Momjian 2006-02-01 20:56:44 +00:00
parent bd5d12a16b
commit 71b9df2bed

View File

@ -12,7 +12,7 @@
*
*
* 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}
keyword = ScanCKeywordLookup(yytext);
if (keyword != NULL)
return keyword->value;
else {
else
{
yylval.str = mm_strdup(yytext);
return IDENT;
}
@ -886,15 +886,15 @@ cppline {space}*#(.*\\{space})*.*{newline}
/* are we simulating Informix? */
if (INFORMIX_MODE)
{
if ( preproc_tos == 0 ) {
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
preproc_tos--;
ifcond = TRUE; BEGIN(xcond);
ifcond = TRUE;
BEGIN(xcond);
}
else
{
@ -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' */
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;'");
}
else {
else
{
stacked_if_value[preproc_tos].else_branch = TRUE;
stacked_if_value[preproc_tos].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);
else
BEGIN(xskip);
@ -923,16 +923,16 @@ cppline {space}*#(.*\\{space})*.*{newline}
/* are we simulating Informix? */
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;'");
}
else {
else
{
stacked_if_value[preproc_tos].else_branch = TRUE;
stacked_if_value[preproc_tos].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);
else
BEGIN(xskip);
@ -945,12 +945,12 @@ cppline {space}*#(.*\\{space})*.*{newline}
}
}
<C,xskip>{exec_sql}{endif}{space}*";" {
if ( preproc_tos == 0 )
if (preproc_tos == 0)
mmerror(PARSE_ERROR, ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");
else
preproc_tos--;
if ( stacked_if_value[preproc_tos].condition )
if (stacked_if_value[preproc_tos].condition)
BEGIN(C);
else
BEGIN(xskip);
@ -959,12 +959,12 @@ cppline {space}*#(.*\\{space})*.*{newline}
/* are we simulating Informix? */
if (INFORMIX_MODE)
{
if ( preproc_tos == 0 )
if (preproc_tos == 0)
mmerror(PARSE_ERROR, ET_FATAL, "Unmatched 'EXEC SQL ENDIF;'");
else
preproc_tos--;
if ( stacked_if_value[preproc_tos].condition )
if (stacked_if_value[preproc_tos].condition)
BEGIN(C);
else
BEGIN(xskip);
@ -979,32 +979,35 @@ cppline {space}*#(.*\\{space})*.*{newline}
<xskip>{other} { /* ignore */ }
<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");
}
else
{
struct _defines *defptr;
unsigned int i;
/* skip the ";" and trailing whitespace. Note that yytext contains
at least one non-space character plus the ";" */
for ( i = strlen(yytext)-2;
/*
* 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-- )
{}
;
yytext[i+1] = '\0';
for ( defptr = defines; defptr != NULL &&
( strcmp(yytext, defptr->old) != 0 ); defptr = defptr->next );
for (defptr = defines;
defptr != NULL && strcmp(yytext, defptr->old) != 0;
defptr = defptr->next)
;
preproc_tos++;
stacked_if_value[preproc_tos].else_branch = FALSE;
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;
else
BEGIN(xskip);
@ -1048,7 +1051,8 @@ cppline {space}*#(.*\\{space})*.*{newline}
<incl>[^;\<\>\"]+";" { parse_include(); }
<<EOF>> {
if (yy_buffer == NULL) {
if (yy_buffer == NULL)
{
if ( preproc_tos > 0 )
{
preproc_tos = 0;
@ -1168,10 +1172,10 @@ parse_include(void)
* skip the ";" if there is one 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-- )
{}
i--)
;
if (yytext[i] == ';')
i--;
@ -1182,7 +1186,7 @@ parse_include(void)
/* If file name is enclosed in '"' remove these and look only in '.' */
/* 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] == '/'))
{
yytext[i] = '\0';