Skip to content

Commit

Permalink
When printing function bodies, avoid some redundant spaces
Browse files Browse the repository at this point in the history
In particular, don't print 'if x  then', but rather 'if x then'
(note the extra space in the former), and similar after "local",
and before "do".

Resolves #473
  • Loading branch information
fingolfin committed Jul 12, 2017
1 parent b7afc33 commit 99d6333
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ void PrintFunction (
/* print the locals */
nloc = NLOC_FUNC(func);
if ( nloc >= 1 ) {
Pr("%>local ",0L,0L);
Pr("%>local ",0L,0L);
for ( i = 1; i <= nloc; i++ ) {
if ( NAMS_FUNC(func) != 0 )
Pr( "%I", (Int)NAMI_FUNC( func, (Int)(narg+i) ), 0L );
Expand Down
12 changes: 6 additions & 6 deletions src/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ void PrintIf (
/* print the 'if' branch */
Pr( "if%4> ", 0L, 0L );
PrintExpr( ADDR_STAT(stat)[0] );
Pr( "%2< then%2>\n", 0L, 0L );
Pr( "%2< then%2>\n", 0L, 0L );
PrintStat( ADDR_STAT(stat)[1] );
Pr( "%4<\n", 0L, 0L );

Expand All @@ -1991,7 +1991,7 @@ void PrintIf (
else {
Pr( "elif%4> ", 0L, 0L );
PrintExpr( ADDR_STAT(stat)[2*(i-1)] );
Pr( "%2< then%2>\n", 0L, 0L );
Pr( "%2< then%2>\n", 0L, 0L );
}
PrintStat( ADDR_STAT(stat)[2*(i-1)+1] );
Pr( "%4<\n", 0L, 0L );
Expand All @@ -2018,9 +2018,9 @@ void PrintFor (

Pr( "for%4> ", 0L, 0L );
PrintExpr( ADDR_STAT(stat)[0] );
Pr( "%2< in%2> ", 0L, 0L );
Pr( "%2< in%2> ", 0L, 0L );
PrintExpr( ADDR_STAT(stat)[1] );
Pr( "%2< do%2>\n", 0L, 0L );
Pr( "%2< do%2>\n", 0L, 0L );
for ( i = 2; i <= SIZE_STAT(stat)/sizeof(Stat)-1; i++ ) {
PrintStat( ADDR_STAT(stat)[i] );
if ( i < SIZE_STAT(stat)/sizeof(Stat)-1 ) Pr( "\n", 0L, 0L );
Expand All @@ -2045,7 +2045,7 @@ void PrintWhile (

Pr( "while%4> ", 0L, 0L );
PrintExpr( ADDR_STAT(stat)[0] );
Pr( "%2< do%2>\n", 0L, 0L );
Pr( "%2< do%2>\n", 0L, 0L );
for ( i = 1; i <= SIZE_STAT(stat)/sizeof(Stat)-1; i++ ) {
PrintStat( ADDR_STAT(stat)[i] );
if ( i < SIZE_STAT(stat)/sizeof(Stat)-1 ) Pr( "\n", 0L, 0L );
Expand Down Expand Up @@ -2082,7 +2082,7 @@ void PrintAtomic (
}
PrintExpr(ADDR_STAT(stat)[2*i]);
}
Pr( "%2< do%2>\n", 0L, 0L );
Pr( "%2< do%2>\n", 0L, 0L );
PrintStat( ADDR_STAT(stat)[0]);
Pr( "%4<\nod;", 0L, 0L );
}
Expand Down

0 comments on commit 99d6333

Please sign in to comment.