Skip to content

Commit d4c7d1b

Browse files
committed
put each SUBTYPE/SUPERTYPE on its own line, indent ONEOF
1 parent d10d955 commit d4c7d1b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/exppp/pretty_entity.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
void ENTITY_out( Entity e, int level ) {
1818
const unsigned int EXPLICIT = 0, DERIVED = 1;
19+
int linelen = exppp_linelength;
1920
bool first_time = true;
2021

2122
first_newline();
@@ -26,6 +27,7 @@ void ENTITY_out( Entity e, int level ) {
2627
level += exppp_nesting_indent;
2728
indent2 = level + exppp_continuation_indent;
2829

30+
exppp_linelength = indent2; /* force newlines */
2931
if( ENTITYget_abstract( e ) ) {
3032
if( e->u.entity->subtype_expression ) {
3133
raw( "\n%*sABSTRACT SUPERTYPE OF ", level, "" );
@@ -55,6 +57,7 @@ void ENTITY_out( Entity e, int level ) {
5557
}
5658

5759
raw( ";\n" );
60+
exppp_linelength = linelen;
5861

5962
#if 0
6063
/* add a little more space before entities if sub or super appears */

src/exppp/pretty_expr.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,15 @@ void EXPR__out( Expression e, int paren, unsigned int previous_op ) {
125125
} LISTod
126126
raw( "]" );
127127
break;
128-
case oneof_:
128+
case oneof_: {
129+
int old_indent = indent2;
129130
wrap( "ONEOF ( " );
130131

132+
if( exppp_linelength == indent2 ) {
133+
exppp_linelength += exppp_continuation_indent;
134+
}
135+
indent2 += exppp_continuation_indent;
136+
131137
i = 0;
132138
LISTdo( e->u.list, arg, Expression )
133139
i++;
@@ -137,8 +143,14 @@ void EXPR__out( Expression e, int paren, unsigned int previous_op ) {
137143
EXPR_out( arg, 0 );
138144
LISTod
139145

146+
if( exppp_linelength == indent2 ) {
147+
exppp_linelength = old_indent;
148+
}
149+
indent2 = old_indent;
150+
140151
raw( " )" );
141152
break;
153+
}
142154
default:
143155
fprintf( stderr, "%s:%d: ERROR - unknown expression, type %d", e->symbol.filename, e->symbol.line, TYPEis( e->type ) );
144156
abort();

0 commit comments

Comments
 (0)