mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Indent C code in flex and bison files
In the style of pgindent, done semi-manually. Discussion: https://www.postgresql.org/message-id/flat/7d062ecc-7444-23ec-a159-acd8adf9b586%40enterprisedb.com
This commit is contained in:
@ -99,9 +99,9 @@ static short preproc_tos;
|
||||
static bool ifcond;
|
||||
static struct _if_value
|
||||
{
|
||||
bool active;
|
||||
bool saw_active;
|
||||
bool else_branch;
|
||||
bool active;
|
||||
bool saw_active;
|
||||
bool else_branch;
|
||||
} stacked_if_value[MAX_NESTED_IF];
|
||||
|
||||
%}
|
||||
@ -1031,7 +1031,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
char* endptr;
|
||||
|
||||
errno = 0;
|
||||
base_yylval.ival = strtoul((char *)yytext,&endptr,16);
|
||||
base_yylval.ival = strtoul((char *) yytext, &endptr, 16);
|
||||
if (*endptr != '\0' || errno == ERANGE)
|
||||
{
|
||||
errno = 0;
|
||||
@ -1166,7 +1166,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
*/
|
||||
for (i = strlen(yytext)-2;
|
||||
i > 0 && ecpg_isspace(yytext[i]);
|
||||
i-- )
|
||||
i--)
|
||||
;
|
||||
yytext[i+1] = '\0';
|
||||
|
||||
@ -1290,7 +1290,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
}
|
||||
|
||||
<C,xskip>{exec_sql}{else}{space}*";" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */
|
||||
if ( preproc_tos == 0 )
|
||||
if (preproc_tos == 0)
|
||||
mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
|
||||
else if (stacked_if_value[preproc_tos].else_branch)
|
||||
mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE");
|
||||
@ -1312,7 +1312,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
/* are we simulating Informix? */
|
||||
if (INFORMIX_MODE)
|
||||
{
|
||||
if ( preproc_tos == 0 )
|
||||
if (preproc_tos == 0)
|
||||
mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
|
||||
else if (stacked_if_value[preproc_tos].else_branch)
|
||||
mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE");
|
||||
@ -1382,7 +1382,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
*/
|
||||
for (i = strlen(yytext)-2;
|
||||
i > 0 && ecpg_isspace(yytext[i]);
|
||||
i-- )
|
||||
i--)
|
||||
;
|
||||
yytext[i+1] = '\0';
|
||||
|
||||
@ -1456,7 +1456,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
<<EOF>> {
|
||||
if (yy_buffer == NULL)
|
||||
{
|
||||
if ( preproc_tos > 0 )
|
||||
if (preproc_tos > 0)
|
||||
{
|
||||
preproc_tos = 0;
|
||||
mmfatal(PARSE_ERROR, "missing \"EXEC SQL ENDIF;\"");
|
||||
@ -1479,7 +1479,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
if (yyin != NULL)
|
||||
fclose(yyin);
|
||||
|
||||
yy_delete_buffer( YY_CURRENT_BUFFER );
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
||||
yy_switch_to_buffer(yy_buffer->buffer);
|
||||
|
||||
yylineno = yy_buffer->lineno;
|
||||
@ -1661,7 +1661,7 @@ parse_include(void)
|
||||
if (strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
|
||||
{
|
||||
strcat(inc_file, ".h");
|
||||
yyin = fopen( inc_file, "r" );
|
||||
yyin = fopen(inc_file, "r");
|
||||
}
|
||||
}
|
||||
/* if the command was "include_next" we have to disregard the first hit */
|
||||
@ -1677,7 +1677,7 @@ parse_include(void)
|
||||
mmfatal(NO_INCLUDE_FILE, "could not open include file \"%s\" on line %d", yytext, yylineno);
|
||||
|
||||
input_filename = mm_strdup(inc_file);
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE ));
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
|
||||
yylineno = 1;
|
||||
output_line_number();
|
||||
|
||||
|
Reference in New Issue
Block a user