Skip to content

Commit 472bd4c

Browse files
committed
exp2py: fix some indentation errors found in for and while loops
1 parent fed696d commit 472bd4c

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/exp2python/src/classes_python.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,7 @@ LOOPpyout( struct Loop_ *loop, int level, FILE * file ) {
11041104
fprintf( file, "):\n" );
11051105

11061106
if( loop->while_expr ) {
1107+
python_indent( file, level + 1 );
11071108
fprintf( file, "if " );
11081109
EXPRESSION_out( loop->while_expr, 0 , file );
11091110
fprintf( file, ":\n");
@@ -1113,9 +1114,12 @@ LOOPpyout( struct Loop_ *loop, int level, FILE * file ) {
11131114
}
11141115

11151116
if( loop->until_expr ) {
1117+
python_indent( file, level + 1 );
11161118
fprintf( file, "if " );
11171119
EXPRESSION_out( loop->until_expr, 0 , file );
1118-
fprintf( file, ":\n\tbreak\n");
1120+
fprintf( file, ":\n" );
1121+
python_indent( file, level + 2 );
1122+
fprintf( file, "break\n" );
11191123
}
11201124
} else if( loop->while_expr ) {
11211125
fprintf( file, "while " );
@@ -1124,17 +1128,23 @@ LOOPpyout( struct Loop_ *loop, int level, FILE * file ) {
11241128
STATEMENTlist_out( loop->statements, level + 1 , file );
11251129

11261130
if( loop->until_expr ) {
1131+
python_indent( file, level + 1 );
11271132
fprintf( file, "if " );
11281133
EXPRESSION_out( loop->until_expr, 0 , file );
1129-
fprintf( file, ":\n\tbreak\n");
1134+
fprintf( file, ":\n" );
1135+
python_indent( file, level + 2 );
1136+
fprintf( file, "break\n" );
11301137
}
11311138
} else {
11321139
fprintf( file, "while True:\n" );
11331140
STATEMENTlist_out( loop->statements, level + 1 , file );
11341141

1142+
python_indent( file, level + 1 );
11351143
fprintf( file, "if " );
11361144
EXPRESSION_out( loop->until_expr, 0 , file );
1137-
fprintf( file, ":\n\tbreak\n");
1145+
fprintf( file, ":\n" );
1146+
python_indent( file, level + 2 );
1147+
fprintf( file, "break\n" );
11381148
}
11391149

11401150
}

0 commit comments

Comments
 (0)