typename fix
[prop.git] / prop-src / printing.cc
blobc9ad9914e3f92533e2e3a5e3b8b91be654017fe3
1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.6),
3 // last updated on Nov 2, 1999.
4 // The original source file is "printing.pcc".
5 ///////////////////////////////////////////////////////////////////////////////
7 #define PROP_STRCMP_USED
8 #define PROP_QUARK_USED
9 #include <propdefs.h>
10 ///////////////////////////////////////////////////////////////////////////////
11 // Quark literals
12 ///////////////////////////////////////////////////////////////////////////////
13 static const Quark _p_r_i_n_t_i_n_gco_c_c_Q1("x_");
14 #line 1 "printing.pcc"
15 ///////////////////////////////////////////////////////////////////////////////
17 // This file implements various pretty printing and formating routines.
19 ///////////////////////////////////////////////////////////////////////////////
21 #include <iostream>
22 #include <strstream>
23 #include <AD/contain/bitset.h>
24 #include <AD/strings/charesc.h>
25 #include <AD/strings/quark.h>
26 #include <stdio.h>
27 #include <ctype.h>
28 #include "ir.h"
29 #include "ast.h"
30 #include "matchcom.h"
31 #include "type.h"
32 #include "options.h"
33 #include "list.h"
34 #include "graphtype.h"
36 ///////////////////////////////////////////////////////////////////////////////
38 // Flags controlling printing formats of types.
40 ///////////////////////////////////////////////////////////////////////////////
41 Bool pretty_print_ty = true;
42 Bool pretty_print_pattern = false;
43 Bool pretty_print_exp = false;
44 Bool print_semantic_stack = false;
45 Bool print_inner_action = false;
46 Bool print_default_value = true;
47 Id ty_id = 0;
48 Parameter ty_parameter = TYformal;
50 ///////////////////////////////////////////////////////////////////////////////
52 // Print an identifier list
54 ///////////////////////////////////////////////////////////////////////////////
55 std::ostream& operator << (std::ostream& f, Ids vars)
56 { for(Ids vs = vars; vs; vs = vs->_2)
57 { f << vs->_1; if (vs->_2) f << ", "; }
58 return f;
61 ///////////////////////////////////////////////////////////////////////////////
63 // Print a scope
65 ///////////////////////////////////////////////////////////////////////////////
66 std::ostream& operator << (std::ostream& f, Scope s)
68 #line 53 "printing.pcc"
69 #line 57 "printing.pcc"
71 switch (s) {
72 case PRIVATEscope: {
73 #line 56 "printing.pcc"
74 f << "private";
76 #line 57 "printing.pcc"
77 } break;
78 case PROTECTEDscope: {
79 #line 55 "printing.pcc"
80 f << "protected";
82 #line 56 "printing.pcc"
83 } break;
84 default: {
85 #line 54 "printing.pcc"
86 f << "public";
88 #line 55 "printing.pcc"
89 } break;
92 #line 57 "printing.pcc"
93 #line 57 "printing.pcc"
95 return f;
98 ///////////////////////////////////////////////////////////////////////////////
99 // Return the label for an tuple element index
100 ///////////////////////////////////////////////////////////////////////////////
101 Id index_of(int i,Id prefix)
102 { if (prefix == 0) prefix = "";
103 return Quark(Quark(prefix,"_"),i);
106 ///////////////////////////////////////////////////////////////////////////////
108 // Print a persistent id.
110 ///////////////////////////////////////////////////////////////////////////////
111 std::ostream& operator << (std::ostream& f, Pid pid)
113 #line 75 "printing.pcc"
114 #line 78 "printing.pcc"
116 if (pid) {
117 #line 76 "printing.pcc"
118 f << pid->PERSISTid;
119 #line 76 "printing.pcc"
120 } else {}
122 #line 78 "printing.pcc"
123 #line 78 "printing.pcc"
125 return f;
128 ///////////////////////////////////////////////////////////////////////////////
130 // Print a literal.
132 ///////////////////////////////////////////////////////////////////////////////
133 std::ostream& operator << (std::ostream& f, Literal l)
135 #line 88 "printing.pcc"
136 #line 109 "printing.pcc"
138 switch (l->tag__) {
139 case a_Literal::tag_INTlit: {
140 #line 89 "printing.pcc"
141 f << ((Literal_INTlit *)l)->INTlit;
142 #line 89 "printing.pcc"
143 } break;
144 case a_Literal::tag_BOOLlit: {
145 #line 90 "printing.pcc"
146 f << (((Literal_BOOLlit *)l)->BOOLlit ? "true" : "false");
147 #line 90 "printing.pcc"
148 } break;
149 case a_Literal::tag_CHARlit: {
150 #line 91 "printing.pcc"
151 char b[32]; print_char(b,((Literal_CHARlit *)l)->CHARlit); f << '\'' << b << '\'';
152 #line 91 "printing.pcc"
153 } break;
154 case a_Literal::tag_REALlit: {
155 #line 93 "printing.pcc"
156 // use sprintf due to library problems in libg++ 2.5.8 on Linux
157 char buf[256];
158 sprintf(buf,"%lf", ((Literal_REALlit *)l)->REALlit);
159 f << buf;
160 // ostrstream S(buf,sizeof(buf));
161 // std::ostream& S2 = S;
162 // S2 << r << ends;
163 // f << S.str();
165 #line 101 "printing.pcc"
166 } break;
167 case a_Literal::tag_STRINGlit: {
168 #line 102 "printing.pcc"
169 f << ((Literal_STRINGlit *)l)->STRINGlit;
170 #line 102 "printing.pcc"
171 } break;
172 case a_Literal::tag_REGEXPlit: {
173 #line 103 "printing.pcc"
174 f << ((Literal_REGEXPlit *)l)->REGEXPlit;
175 #line 103 "printing.pcc"
176 } break;
177 case a_Literal::tag_QUARKlit: {
178 #line 104 "printing.pcc"
179 if (pretty_print_pattern) f << '#' << ((Literal_QUARKlit *)l)->QUARKlit;
180 else f << MatchCompiler::quark_name(((Literal_QUARKlit *)l)->QUARKlit);
182 #line 106 "printing.pcc"
183 } break;
184 default: {
185 #line 107 "printing.pcc"
186 if (pretty_print_pattern) f << "#" << ((Literal_BIGINTlit *)l)->BIGINTlit;
187 else f << ((Literal_BIGINTlit *)l)->BIGINTlit;
189 #line 109 "printing.pcc"
190 } break;
193 #line 110 "printing.pcc"
194 #line 110 "printing.pcc"
196 return f;
199 ///////////////////////////////////////////////////////////////////////////////
201 // Print type list.
203 ///////////////////////////////////////////////////////////////////////////////
204 std::ostream& operator << (std::ostream& f, Tys tys)
205 { for(Tys t = tys; t; t = t->_2) {
206 f << t->_1;
207 if (t->_2 !=
208 #line 122 "printing.pcc"
209 #line 122 "printing.pcc"
210 nil_1_
211 #line 122 "printing.pcc"
212 #line 122 "printing.pcc"
213 ) f << ", ";
215 return f;
218 ///////////////////////////////////////////////////////////////////////////////
220 // Print type variables (i.e. template actual arguments)
222 ///////////////////////////////////////////////////////////////////////////////
223 void print_tyvars(std::ostream& f, Tys tys, Bool is_datatype)
224 { if (tys !=
225 #line 133 "printing.pcc"
226 #line 133 "printing.pcc"
227 nil_1_
228 #line 133 "printing.pcc"
229 #line 133 "printing.pcc"
231 if (is_datatype) f << "(" << tys << ")";
232 else f << '<' << tys << "> ";
235 ///////////////////////////////////////////////////////////////////////////////
237 // Print type variables (i.e. formal template arguments)
239 ///////////////////////////////////////////////////////////////////////////////
240 void print_tyvars(std::ostream& f, TyVars tyvars, char open, char close, Bool header)
241 { if (tyvars !=
242 #line 144 "printing.pcc"
243 #line 144 "printing.pcc"
244 nil_1_
245 #line 144 "printing.pcc"
246 #line 144 "printing.pcc"
248 if (header) f << "template ";
249 f << open;
250 for(TyVars t = tyvars; t; t = t->_2) {
251 if (header) f << "class ";
252 f << t->_1;
253 if (t->_2) f << ", ";
255 f << close;
256 if (header) f << ' ';
260 ///////////////////////////////////////////////////////////////////////////////
262 // Print a tuple type.
264 ///////////////////////////////////////////////////////////////////////////////
265 void print_tuple(std::ostream& f, Tys tys)
266 { if (pretty_print_ty) {
267 f << '(' << tys << ')';
268 } else {
269 f << "struct {";
270 int i = 1;
271 for (Tys t = tys; t; t = t->_2) {
272 ty_id = index_of(i);
273 f << t->_1 << "; ";
274 ty_id =
275 #line 171 "printing.pcc"
276 #line 171 "printing.pcc"
277 nil_1_
278 #line 171 "printing.pcc"
279 #line 171 "printing.pcc"
282 f << "} ";
286 ///////////////////////////////////////////////////////////////////////////////
288 // Print a mktuple type
290 ///////////////////////////////////////////////////////////////////////////////
291 void print_mktuple(std::ostream& f, Tys tys)
292 { if (pretty_print_ty) {
293 f << ".[" << tys << ']';
294 } else {
295 f << "Tuple" << length(tys);
296 print_tyvars(f,tys,false);
300 ///////////////////////////////////////////////////////////////////////////////
302 // Print a record type.
304 ///////////////////////////////////////////////////////////////////////////////
305 void print_record(std::ostream& f, Ids labs, Tys tys, Bool flex)
306 { if (! pretty_print_ty) f << "struct ";
307 f << "{ ";
308 Tys t; Ids l;
309 for (t = tys, l = labs; t && l; t = t->_2, l = l->_2) {
310 if (pretty_print_ty) {
311 f << l->_1 << " : " << t->_1;
312 if (t->_2) f << ", ";
313 } else {
314 ty_id = l->_1; f << t->_1 << "; ";
315 ty_id =
316 #line 206 "printing.pcc"
317 #line 206 "printing.pcc"
318 nil_1_
319 #line 206 "printing.pcc"
320 #line 206 "printing.pcc"
324 if (pretty_print_ty && flex) f << " ... ";
325 f << " }";
328 ///////////////////////////////////////////////////////////////////////////////
330 // Print a function parameter.
332 ///////////////////////////////////////////////////////////////////////////////
333 void print_parameter (std::ostream& f, Ty ty, Id id, Parameter p)
334 { Parameter save = ty_parameter;
335 Bool sp = pretty_print_ty;
336 pretty_print_ty = false;
337 ty_parameter = p;
339 #line 223 "printing.pcc"
340 #line 269 "printing.pcc"
342 Ty _V1 = deref(ty);
343 if (_V1) {
344 switch (_V1->tag__) {
345 case a_Ty::tag_TYCONty: {
346 if (boxed(((Ty_TYCONty *)_V1)->_1)) {
347 switch (((Ty_TYCONty *)_V1)->_1->tag__) {
348 case a_TyCon::tag_RECORDtycon: {
349 #line 241 "printing.pcc"
350 Ids l;
351 Tys t;
352 if (p == TYformal || p == TYsimpleformal ||
353 p == TYactual && ((Ty_TYCONty *)_V1)->_2 !=
354 #line 244 "printing.pcc"
355 #line 244 "printing.pcc"
356 nil_1_
357 #line 244 "printing.pcc"
358 #line 244 "printing.pcc"
359 ) f << '(';
360 for (l = ((TyCon_RECORDtycon *)((Ty_TYCONty *)_V1)->_1)->_1, t = ((Ty_TYCONty *)_V1)->_2; l && t; l = l->_2, t = t->_2) {
361 if (p != TYbody)
362 ty_id =
363 #line 247 "printing.pcc"
364 #line 247 "printing.pcc"
365 _p_r_i_n_t_i_n_gco_c_c_Q1
366 #line 247 "printing.pcc"
367 #line 247 "printing.pcc"
368 + l->_1;
369 else
370 ty_id = l->_1;
371 if (p != TYactual) f << t->_1;
372 else f << ty_id;
373 if (p != TYbody) { if (t->_2) f << ", "; }
374 else f << "; ";
375 ty_id =
376 #line 254 "printing.pcc"
377 #line 254 "printing.pcc"
378 nil_1_
379 #line 254 "printing.pcc"
380 #line 254 "printing.pcc"
383 if (p == TYformal || p == TYsimpleformal ||
384 p == TYactual && ((Ty_TYCONty *)_V1)->_2 !=
385 #line 257 "printing.pcc"
386 #line 257 "printing.pcc"
387 nil_1_
388 #line 257 "printing.pcc"
389 #line 257 "printing.pcc"
390 ) f << ')';
392 #line 258 "printing.pcc"
393 } break;
394 default: {
395 L1:;
396 #line 259 "printing.pcc"
397 if (p != TYbody) f << '(';
398 if (p != TYbody)
399 ty_id =
400 #line 261 "printing.pcc"
401 #line 261 "printing.pcc"
402 _p_r_i_n_t_i_n_gco_c_c_Q1
403 #line 261 "printing.pcc"
404 #line 261 "printing.pcc"
405 + id;
406 else
407 ty_id = id;
408 if (p != TYactual) f << _V1;
409 else f << ty_id;
410 if (p == TYbody) f << "; ";
411 ty_id = 0;
412 if (p != TYbody) f << ')';
414 #line 269 "printing.pcc"
415 } break;
417 } else {
418 switch ((int)((Ty_TYCONty *)_V1)->_1) {
419 case ((int)TUPLEtycon): {
420 #line 225 "printing.pcc"
421 int i = 1;
422 if (p == TYformal || p == TYsimpleformal ||
423 p == TYactual && ((Ty_TYCONty *)_V1)->_2 !=
424 #line 227 "printing.pcc"
425 #line 227 "printing.pcc"
426 nil_1_
427 #line 227 "printing.pcc"
428 #line 227 "printing.pcc"
429 ) f << '(';
430 for (Tys ts = ((Ty_TYCONty *)_V1)->_2; ts; ts = ts->_2) {
431 ty_id = index_of(i,(p != TYbody ? "x" : ""));
432 if (p != TYactual) f << ts->_1;
433 else f << ty_id;
434 if (p != TYbody) { if (ts->_2) f << ", "; }
435 else f << "; ";
436 i++;
437 ty_id =
438 #line 235 "printing.pcc"
439 #line 235 "printing.pcc"
440 nil_1_
441 #line 235 "printing.pcc"
442 #line 235 "printing.pcc"
445 if (p == TYformal || p == TYsimpleformal ||
446 p == TYactual && ((Ty_TYCONty *)_V1)->_2 !=
447 #line 238 "printing.pcc"
448 #line 238 "printing.pcc"
449 nil_1_
450 #line 238 "printing.pcc"
451 #line 238 "printing.pcc"
452 ) f << ')';
454 #line 239 "printing.pcc"
455 } break;
456 default: { goto L1; } break;
459 } break;
460 default: { goto L1; } break;
462 } else { goto L1; }
464 #line 270 "printing.pcc"
465 #line 270 "printing.pcc"
467 ty_parameter = save;
468 pretty_print_ty = sp;
471 ///////////////////////////////////////////////////////////////////////////////
473 // Method to print a type expression.
475 ///////////////////////////////////////////////////////////////////////////////
476 std::ostream& operator << (std::ostream& f, Ty ty)
477 { Id this_id = 0;
478 if (ty_id) { this_id = ty_id; ty_id = 0; }
479 ty = deref(ty);
481 #line 284 "printing.pcc"
482 #line 350 "printing.pcc"
484 if (ty) {
485 switch (ty->tag__) {
486 case a_Ty::tag_VARty: {
487 #line 286 "printing.pcc"
488 f << "???";
489 #line 286 "printing.pcc"
490 } break;
491 case a_Ty::tag_INDty: {
492 #line 287 "printing.pcc"
493 f << ((Ty_INDty *)ty)->_1;
494 #line 287 "printing.pcc"
495 } break;
496 case a_Ty::tag_QUALty: {
497 #line 331 "printing.pcc"
498 if (((Ty_QUALty *)ty)->_1 & QUALunsigned) f << "unsigned ";
499 if (((Ty_QUALty *)ty)->_1 & QUALsigned) f << "signed ";
500 if ((ty_parameter == TYformal || ty_parameter == TYsimpleformal)
501 && (((Ty_QUALty *)ty)->_1 & QUALclass))
502 f << (TYCONty(REFtycon,
503 #line 335 "printing.pcc"
504 #line 335 "printing.pcc"
505 list_1_(QUALty(QUALconst,((Ty_QUALty *)ty)->_2))
506 #line 335 "printing.pcc"
507 #line 335 "printing.pcc"
509 else
510 f << ((Ty_QUALty *)ty)->_2;
511 if (((Ty_QUALty *)ty)->_1 & QUALconst) f << " const";
513 #line 339 "printing.pcc"
514 } break;
515 case a_Ty::tag_TYCONty: {
516 if (boxed(((Ty_TYCONty *)ty)->_1)) {
517 switch (((Ty_TYCONty *)ty)->_1->tag__) {
518 case a_TyCon::tag_IDtycon: {
519 #line 300 "printing.pcc"
520 if (options.new_type_format && ((Ty_TYCONty *)ty)->_2 !=
521 #line 300 "printing.pcc"
522 #line 300 "printing.pcc"
523 nil_1_
524 #line 300 "printing.pcc"
525 #line 300 "printing.pcc"
528 #line 301 "printing.pcc"
529 #line 310 "printing.pcc"
531 Ty _V2 = deref_all(ty);
532 if (_V2) {
533 switch (_V2->tag__) {
534 case a_Ty::tag_TYCONty: {
535 if (boxed(((Ty_TYCONty *)_V2)->_1)) {
536 switch (((Ty_TYCONty *)_V2)->_1->tag__) {
537 case a_TyCon::tag_DATATYPEtycon: {
538 #line 303 "printing.pcc"
539 if (! pretty_print_ty) f << "a_";
540 f << ((TyCon_DATATYPEtycon *)((Ty_TYCONty *)_V2)->_1)->id; print_tyvars(f,((Ty_TYCONty *)ty)->_2,false);
541 if (! pretty_print_ty)
542 { if (((Ty_TYCONty *)ty)->_2 ==
543 #line 306 "printing.pcc"
544 #line 306 "printing.pcc"
545 nil_1_
546 #line 306 "printing.pcc"
547 #line 306 "printing.pcc"
548 ) f << ' ';
549 f << "* ";
552 #line 309 "printing.pcc"
553 } break;
554 default: {
555 L2:;
556 #line 310 "printing.pcc"
557 f << ((TyCon_IDtycon *)((Ty_TYCONty *)ty)->_1)->IDtycon; print_tyvars(f,((Ty_TYCONty *)ty)->_2,false);
558 #line 310 "printing.pcc"
559 } break;
561 } else { goto L2; }
562 } break;
563 default: { goto L2; } break;
565 } else { goto L2; }
567 #line 311 "printing.pcc"
568 #line 311 "printing.pcc"
570 } else
571 { f << ((TyCon_IDtycon *)((Ty_TYCONty *)ty)->_1)->IDtycon;
573 #line 314 "printing.pcc"
574 #line 316 "printing.pcc"
576 Ty _V3 = deref_all(ty);
577 if (_V3) {
578 switch (_V3->tag__) {
579 case a_Ty::tag_TYCONty: {
580 if (boxed(((Ty_TYCONty *)_V3)->_1)) {
581 switch (((Ty_TYCONty *)_V3)->_1->tag__) {
582 case a_TyCon::tag_DATATYPEtycon: {
583 #line 315 "printing.pcc"
584 print_tyvars(f,((Ty_TYCONty *)ty)->_2,! pretty_print_ty);
585 #line 315 "printing.pcc"
586 } break;
587 default: {
588 L3:;
589 #line 316 "printing.pcc"
590 print_tyvars(f,((Ty_TYCONty *)ty)->_2,false);
591 #line 316 "printing.pcc"
592 } break;
594 } else { goto L3; }
595 } break;
596 default: { goto L3; } break;
598 } else { goto L3; }
600 #line 317 "printing.pcc"
601 #line 317 "printing.pcc"
605 #line 319 "printing.pcc"
606 } break;
607 case a_TyCon::tag_RECORDtycon: {
608 #line 298 "printing.pcc"
609 print_record(f,((TyCon_RECORDtycon *)((Ty_TYCONty *)ty)->_1)->_1,((Ty_TYCONty *)ty)->_2,((TyCon_RECORDtycon *)((Ty_TYCONty *)ty)->_1)->_2);
610 #line 298 "printing.pcc"
611 } break;
612 case a_TyCon::tag_ARRAYtycon: {
613 if (((Ty_TYCONty *)ty)->_2) {
614 if (((Ty_TYCONty *)ty)->_2->_2) {
615 L4:;
616 #line 350 "printing.pcc"
617 bug ("operator << (std::ostream&, Ty)");
618 #line 350 "printing.pcc"
619 } else {
620 #line 321 "printing.pcc"
621 if (this_id) { ty_id = this_id; this_id = 0; }
622 f << ((Ty_TYCONty *)ty)->_2->_1 << '[' << ((TyCon_ARRAYtycon *)((Ty_TYCONty *)ty)->_1)->ARRAYtycon << ']';
624 #line 323 "printing.pcc"
626 } else { goto L4; }
627 } break;
628 case a_TyCon::tag_DATATYPEtycon: {
629 if (((Ty_TYCONty *)ty)->_2) {
630 #line 342 "printing.pcc"
631 if (! pretty_print_ty) f << "a_";
632 f << ((TyCon_DATATYPEtycon *)((Ty_TYCONty *)ty)->_1)->id; print_tyvars(f,((Ty_TYCONty *)ty)->_2,false);
633 if (! pretty_print_ty)
634 { if (((Ty_TYCONty *)ty)->_2 ==
635 #line 345 "printing.pcc"
636 #line 345 "printing.pcc"
637 nil_1_
638 #line 345 "printing.pcc"
639 #line 345 "printing.pcc"
640 ) f << ' ';
641 f << "* ";
644 #line 348 "printing.pcc"
645 } else {
646 #line 340 "printing.pcc"
647 f << ((TyCon_DATATYPEtycon *)((Ty_TYCONty *)ty)->_1)->id;
648 #line 340 "printing.pcc"
650 } break;
651 case a_TyCon::tag_GRAPHtycon: {
652 #line 293 "printing.pcc"
653 f << ((TyCon_GRAPHtycon *)((Ty_TYCONty *)ty)->_1)->GRAPHtycon->class_name;
654 #line 293 "printing.pcc"
655 } break;
656 case a_TyCon::tag_NODEtycon: {
657 #line 294 "printing.pcc"
658 f << ((TyCon_NODEtycon *)((Ty_TYCONty *)ty)->_1)->NODEtycon->graph()->class_name <<"::"<< ((TyCon_NODEtycon *)((Ty_TYCONty *)ty)->_1)->NODEtycon->name();
659 #line 294 "printing.pcc"
660 } break;
661 case a_TyCon::tag_EDGEtycon: {
662 #line 295 "printing.pcc"
663 f << "edge " << ((TyCon_EDGEtycon *)((Ty_TYCONty *)ty)->_1)->EDGEtycon->name();
664 #line 295 "printing.pcc"
665 } break;
666 default: { goto L4; } break;
668 } else {
669 switch ((int)((Ty_TYCONty *)ty)->_1) {
670 case ((int)POINTERtycon): {
671 if (((Ty_TYCONty *)ty)->_2) {
672 if (((Ty_TYCONty *)ty)->_2->_2) { goto L4; } else {
673 #line 290 "printing.pcc"
674 f << ((Ty_TYCONty *)ty)->_2->_1 << " *";
675 #line 290 "printing.pcc"
677 } else { goto L4; }
678 } break;
679 case ((int)REFtycon): {
680 if (((Ty_TYCONty *)ty)->_2) {
681 if (((Ty_TYCONty *)ty)->_2->_2) { goto L4; } else {
682 #line 291 "printing.pcc"
683 f << ((Ty_TYCONty *)ty)->_2->_1 << " &";
684 #line 291 "printing.pcc"
686 } else { goto L4; }
687 } break;
688 case ((int)TUPLEtycon): {
689 #line 296 "printing.pcc"
690 print_tuple(f,((Ty_TYCONty *)ty)->_2);
691 #line 296 "printing.pcc"
692 } break;
693 case ((int)EXTUPLEtycon): {
694 #line 297 "printing.pcc"
695 print_mktuple(f,((Ty_TYCONty *)ty)->_2);
696 #line 297 "printing.pcc"
697 } break;
698 case ((int)FUNtycon): {
699 if (((Ty_TYCONty *)ty)->_2) {
700 if (((Ty_TYCONty *)ty)->_2->_2) {
701 if (((Ty_TYCONty *)ty)->_2->_2->_2) { goto L4; } else {
702 #line 292 "printing.pcc"
703 f << ((Ty_TYCONty *)ty)->_2->_1 << " -> " << ((Ty_TYCONty *)ty)->_2->_2->_1;
704 #line 292 "printing.pcc"
706 } else { goto L4; }
707 } else { goto L4; }
708 } break;
709 default: {
710 if (((Ty_TYCONty *)ty)->_2) { goto L4; } else {
711 #line 289 "printing.pcc"
712 f << "type";
713 #line 289 "printing.pcc"
715 } break;
718 } break;
719 case a_Ty::tag_POLYty: {
720 #line 288 "printing.pcc"
721 f << ((Ty_POLYty *)ty)->_1;
722 #line 288 "printing.pcc"
723 } break;
724 case a_Ty::tag_DEFVALty: {
725 #line 325 "printing.pcc"
726 if (this_id) { ty_id = this_id; this_id = 0; }
727 f << ((Ty_DEFVALty *)ty)->_1;
728 if (ty_parameter != TYbody && ty_parameter != TYsimpleformal
729 && print_default_value) f << " = " << ((Ty_DEFVALty *)ty)->_2;
731 #line 329 "printing.pcc"
732 } break;
733 default: {
734 #line 349 "printing.pcc"
735 f << ((Ty_NESTEDty *)ty)->_1 << "::" << ((Ty_NESTEDty *)ty)->_2;
736 #line 349 "printing.pcc"
737 } break;
739 } else {
740 #line 285 "printing.pcc"
741 f << "error";
742 #line 285 "printing.pcc"
745 #line 351 "printing.pcc"
746 #line 351 "printing.pcc"
748 if (this_id) f << ' ' << this_id;
749 return f;
753 ///////////////////////////////////////////////////////////////////////////////
755 // Method to print a pattern list.
757 ///////////////////////////////////////////////////////////////////////////////
758 void print (std::ostream& f, Pats pats, Id open, Id close,
759 Bool flex1, Pat p, Bool flex2 = false,
760 Pat len = NOpat, Pat array = NOpat)
761 { f << open;
762 if (len != NOpat)
763 { f << " |" << len;
764 if (array != NOpat) f << " : " << array;
765 f << " |";
767 if (flex2) f << " ... ";
768 for (Pats ps = pats; ps; ps = ps->_2) {
769 f << ps->_1;
770 if (ps->_2) f << ", ";
772 if (flex1 && pats !=
773 #line 376 "printing.pcc"
774 #line 376 "printing.pcc"
775 nil_1_
776 #line 376 "printing.pcc"
777 #line 376 "printing.pcc"
778 && p != NOpat) f << " ... ";
779 if (p != NOpat) f << p;
780 f << close;
783 ///////////////////////////////////////////////////////////////////////////////
785 // Method to print a labeled pattern list.
787 ///////////////////////////////////////////////////////////////////////////////
788 void print (std::ostream& f, LabPats lab_pats, Bool flex)
789 { f << '{';
790 for (LabPats ps = lab_pats; ps; ps = ps->_2) {
791 f << ps->_1.label << " = " << ps->_1.pat;
792 if (ps->_2) f << ", ";
794 f << '}';
797 ///////////////////////////////////////////////////////////////////////////////
799 // Methods extract the open and close brace of a list.
801 ///////////////////////////////////////////////////////////////////////////////
802 Id open_of(Cons c)
804 #line 401 "printing.pcc"
805 #line 406 "printing.pcc"
807 if (c) {
808 #line 402 "printing.pcc"
809 char s[3];
810 s[0] = c->name[0]; s[1] = c->name[1]; s[2] = '\0';
811 return Quark(s);
813 #line 405 "printing.pcc"
814 } else {
815 #line 406 "printing.pcc"
816 return "<??>[";
817 #line 406 "printing.pcc"
820 #line 407 "printing.pcc"
821 #line 407 "printing.pcc"
825 Id close_of(Cons c)
827 #line 411 "printing.pcc"
828 #line 413 "printing.pcc"
830 if (c) {
831 #line 412 "printing.pcc"
832 return c->name+2;
833 #line 412 "printing.pcc"
834 } else {
835 #line 413 "printing.pcc"
836 return "]";
837 #line 413 "printing.pcc"
840 #line 414 "printing.pcc"
841 #line 414 "printing.pcc"
845 Id close_of2(Cons c)
847 #line 418 "printing.pcc"
848 #line 420 "printing.pcc"
850 if (c) {
851 #line 419 "printing.pcc"
852 return c->name+strlen(c->name)-2;
853 #line 419 "printing.pcc"
854 } else {
855 #line 420 "printing.pcc"
856 return "]";
857 #line 420 "printing.pcc"
860 #line 421 "printing.pcc"
861 #line 421 "printing.pcc"
865 ///////////////////////////////////////////////////////////////////////////////
867 // Method to print a pattern list.
869 ///////////////////////////////////////////////////////////////////////////////
870 std::ostream& operator << (std::ostream& f, Pats ps)
871 { print(f,ps,"","",false,NOpat); return f; }
873 ///////////////////////////////////////////////////////////////////////////////
875 // Method to print a pattern.
877 ///////////////////////////////////////////////////////////////////////////////
878 std::ostream& operator << (std::ostream& f, Pat p)
880 #line 438 "printing.pcc"
881 #line 486 "printing.pcc"
883 if (p) {
884 switch (p->tag__) {
885 case a_Pat::tag_WILDpat: {
886 #line 440 "printing.pcc"
887 f << '_';
888 #line 440 "printing.pcc"
889 } break;
890 case a_Pat::tag_INDpat: {
891 #line 443 "printing.pcc"
892 f << '?' << ((Pat_INDpat *)p)->_1;
893 #line 443 "printing.pcc"
894 } break;
895 case a_Pat::tag_POLYpat: {
896 if (((Pat_POLYpat *)p)->_3) {
897 #line 468 "printing.pcc"
898 f << ((Pat_POLYpat *)p)->_1 << '(' << ((Pat_POLYpat *)p)->_3 << ") = " << ((Pat_POLYpat *)p)->_4;
899 #line 468 "printing.pcc"
900 } else {
901 #line 467 "printing.pcc"
902 f << ((Pat_POLYpat *)p)->_1 << " = " << ((Pat_POLYpat *)p)->_4;
903 #line 467 "printing.pcc"
905 } break;
906 case a_Pat::tag_IDpat: {
907 #line 442 "printing.pcc"
908 f << ((Pat_IDpat *)p)->_1;
909 #line 442 "printing.pcc"
910 } break;
911 case a_Pat::tag_CONSpat: {
912 if (((Pat_CONSpat *)p)->CONSpat) {
913 if (((Pat_CONSpat *)p)->CONSpat->alg_ty) {
914 switch (((Pat_CONSpat *)p)->CONSpat->alg_ty->tag__) {
915 case a_Ty::tag_TYCONty: {
916 if (boxed(((Ty_TYCONty *)((Pat_CONSpat *)p)->CONSpat->alg_ty)->_1)) {
917 switch (((Ty_TYCONty *)((Pat_CONSpat *)p)->CONSpat->alg_ty)->_1->tag__) {
918 case a_TyCon::tag_DATATYPEtycon: {
919 if (
920 #line 461 "printing.pcc"
921 (((Pat_CONSpat *)p)->CONSpat->qual & QUALvariable)
922 #line 461 "printing.pcc"
925 #line 462 "printing.pcc"
926 f << ((TyCon_DATATYPEtycon *)((Ty_TYCONty *)((Pat_CONSpat *)p)->CONSpat->alg_ty)->_1)->id << "?";
927 #line 462 "printing.pcc"
928 } else {
930 L5:;
931 #line 463 "printing.pcc"
932 f << ((Pat_CONSpat *)p)->CONSpat->name;
933 #line 463 "printing.pcc"
935 } break;
936 default: { goto L5; } break;
938 } else { goto L5; }
939 } break;
940 default: { goto L5; } break;
942 } else { goto L5; }
943 } else {
944 #line 464 "printing.pcc"
945 f << "<none>";
946 #line 464 "printing.pcc"
948 } break;
949 case a_Pat::tag_APPpat: {
950 #line 465 "printing.pcc"
951 f << ((Pat_APPpat *)p)->_1 << ' ' << ((Pat_APPpat *)p)->_2;
952 #line 465 "printing.pcc"
953 } break;
954 case a_Pat::tag_TYPEDpat: {
955 #line 445 "printing.pcc"
956 f << ((Pat_TYPEDpat *)p)->_1 << " : " << ((Pat_TYPEDpat *)p)->_2;
957 #line 445 "printing.pcc"
958 } break;
959 case a_Pat::tag_ASpat: {
960 #line 444 "printing.pcc"
961 f << ((Pat_ASpat *)p)->_1 << " as " << ((Pat_ASpat *)p)->_2;
962 #line 444 "printing.pcc"
963 } break;
964 case a_Pat::tag_LITERALpat: {
965 #line 482 "printing.pcc"
966 Bool save = pretty_print_pattern;
967 pretty_print_pattern = true;
968 f << ((Pat_LITERALpat *)p)->LITERALpat;
969 pretty_print_pattern = save;
971 #line 486 "printing.pcc"
972 } break;
973 case a_Pat::tag_CONTEXTpat: {
974 #line 474 "printing.pcc"
975 f << "<<";
976 for (Conses ids = ((Pat_CONTEXTpat *)p)->_1; ids; ids = ids->_2)
977 { if (ids->_1 != NOcons) f << ids->_1->name;
978 if (ids->_2) f << ", ";
980 f << ">>" << ((Pat_CONTEXTpat *)p)->_2;
982 #line 480 "printing.pcc"
983 } break;
984 case a_Pat::tag_LEXEMEpat: {
985 #line 466 "printing.pcc"
986 f << "lexeme class " << ((Pat_LEXEMEpat *)p)->_1;
987 #line 466 "printing.pcc"
988 } break;
989 case a_Pat::tag_ARRAYpat: {
990 #line 448 "printing.pcc"
991 print(f,((Pat_ARRAYpat *)p)->_1,"[","]",((Pat_ARRAYpat *)p)->_2,NOpat);
992 #line 448 "printing.pcc"
993 } break;
994 case a_Pat::tag_TUPLEpat: {
995 #line 446 "printing.pcc"
996 print(f,((Pat_TUPLEpat *)p)->TUPLEpat,"(",")",false,NOpat);
997 #line 446 "printing.pcc"
998 } break;
999 case a_Pat::tag_EXTUPLEpat: {
1000 #line 447 "printing.pcc"
1001 print(f,((Pat_EXTUPLEpat *)p)->EXTUPLEpat,".(",")",false,NOpat);
1002 #line 447 "printing.pcc"
1003 } break;
1004 case a_Pat::tag_RECORDpat: {
1005 #line 449 "printing.pcc"
1006 print(f,((Pat_RECORDpat *)p)->_1,((Pat_RECORDpat *)p)->_2);
1007 #line 449 "printing.pcc"
1008 } break;
1009 case a_Pat::tag_LISTpat: {
1010 #line 472 "printing.pcc"
1011 print(f,((Pat_LISTpat *)p)->head,open_of(((Pat_LISTpat *)p)->nil),close_of(((Pat_LISTpat *)p)->nil),true,((Pat_LISTpat *)p)->tail);
1012 #line 472 "printing.pcc"
1013 } break;
1014 case a_Pat::tag_VECTORpat: {
1015 #line 470 "printing.pcc"
1016 print(f,((Pat_VECTORpat *)p)->elements,open_of(((Pat_VECTORpat *)p)->cons),close_of2(((Pat_VECTORpat *)p)->cons),((Pat_VECTORpat *)p)->tail_flex,NOpat,((Pat_VECTORpat *)p)->head_flex,((Pat_VECTORpat *)p)->len,((Pat_VECTORpat *)p)->array);
1017 #line 470 "printing.pcc"
1018 } break;
1019 case a_Pat::tag_APPENDpat: {
1020 #line 457 "printing.pcc"
1021 f << '(' << ((Pat_APPENDpat *)p)->_1 << " ; " << ((Pat_APPENDpat *)p)->_2 << ')';
1022 #line 457 "printing.pcc"
1023 } break;
1024 case a_Pat::tag_GUARDpat: {
1025 #line 456 "printing.pcc"
1026 f << ((Pat_GUARDpat *)p)->_1 << " | " << ((Pat_GUARDpat *)p)->_2;
1027 #line 456 "printing.pcc"
1028 } break;
1029 case a_Pat::tag_LOGICALpat: {
1030 switch (((Pat_LOGICALpat *)p)->_1) {
1031 case NOTpat: {
1032 #line 450 "printing.pcc"
1033 f << "(! " << ((Pat_LOGICALpat *)p)->_2 << ")";
1034 #line 450 "printing.pcc"
1035 } break;
1036 case ANDpat: {
1037 #line 451 "printing.pcc"
1038 f << '(' << ((Pat_LOGICALpat *)p)->_2 << " && " << ((Pat_LOGICALpat *)p)->_3 << ')';
1039 #line 451 "printing.pcc"
1040 } break;
1041 case ORpat: {
1042 #line 452 "printing.pcc"
1043 f << '(' << ((Pat_LOGICALpat *)p)->_2 << " || " << ((Pat_LOGICALpat *)p)->_3 << ')';
1044 #line 452 "printing.pcc"
1045 } break;
1046 case EQUIVpat: {
1047 #line 454 "printing.pcc"
1048 f << '(' << ((Pat_LOGICALpat *)p)->_2 << " equiv: " << ((Pat_LOGICALpat *)p)->_3 << ')';
1049 #line 454 "printing.pcc"
1050 } break;
1051 case XORpat: {
1052 #line 455 "printing.pcc"
1053 f << '(' << ((Pat_LOGICALpat *)p)->_2 << " xor: " << ((Pat_LOGICALpat *)p)->_3 << ')';
1054 #line 455 "printing.pcc"
1055 } break;
1056 default: {
1057 #line 453 "printing.pcc"
1058 f << '(' << ((Pat_LOGICALpat *)p)->_2 << " implies: " << ((Pat_LOGICALpat *)p)->_3 << ')';
1059 #line 453 "printing.pcc"
1060 } break;
1062 } break;
1063 case a_Pat::tag_BACKEDGEpat: {
1064 #line 441 "printing.pcc"
1065 f << '<' << ((Pat_BACKEDGEpat *)p)->_2 << '>';
1066 #line 441 "printing.pcc"
1067 } break;
1068 case a_Pat::tag_UNIFYpat: {
1069 #line 458 "printing.pcc"
1070 f << '(' << ((Pat_UNIFYpat *)p)->_1 << " := " << ((Pat_UNIFYpat *)p)->_2 << ")";
1071 #line 458 "printing.pcc"
1072 } break;
1073 default: {
1074 #line 459 "printing.pcc"
1075 f << ((Pat_MARKEDpat *)p)->_2;
1076 #line 459 "printing.pcc"
1077 } break;
1079 } else {}
1081 #line 487 "printing.pcc"
1082 #line 487 "printing.pcc"
1084 return f;
1087 ///////////////////////////////////////////////////////////////////////////////
1089 // Convert a string into a suitable encoding
1091 ///////////////////////////////////////////////////////////////////////////////
1092 void encode_string(char * buf, const char * s)
1093 { while (*s)
1094 { unsigned char c = *s++;
1095 if (c == '"')
1096 { *buf++ = 'X'; *buf++ = 'X';
1097 } else if (isalnum(c) || c == '_')
1098 { *buf++ = '_'; *buf++ = c;
1099 } else
1101 int lo = c % 16, hi = c / 16;
1102 *buf++ = hi + 'a';
1103 *buf++ = lo + 'a';
1106 *buf++ = '\0';
1109 ///////////////////////////////////////////////////////////////////////////////
1111 // Method to print the mangled name of list constructors.
1113 ///////////////////////////////////////////////////////////////////////////////
1114 #line 518 "printing.pcc"
1115 #line 532 "printing.pcc"
1116 Id mangle (char const * x_1);
1117 Id mangle (char const * x_1)
1119 if ((x_1 == 0)) {
1121 #line 518 "printing.pcc"
1122 return "(null)";
1123 #line 518 "printing.pcc"
1124 } else {
1126 if (_less_string(x_1,"#{}")) {
1127 if (_less_string(x_1,"#[]")) {
1128 if (_equal_string(x_1,"#()")) {
1129 #line 523 "printing.pcc"
1130 return "nil_2_";
1131 #line 523 "printing.pcc"
1133 else if (_equal_string(x_1,"#(...)")) {
1134 #line 520 "printing.pcc"
1135 return "list_2_";
1136 #line 520 "printing.pcc"
1138 else if (_equal_string(x_1,"#[...]")) {
1139 #line 519 "printing.pcc"
1140 return "list_1_";
1141 #line 519 "printing.pcc"
1143 else {
1144 if ((x_1[0] == '\"')) {
1146 #line 529 "printing.pcc"
1147 char buf[256]; encode_string(buf,x_1);
1148 return Quark(buf);
1149 #line 530 "printing.pcc"
1150 } else {
1152 #line 531 "printing.pcc"
1153 return x_1;
1154 #line 531 "printing.pcc"
1157 } else {
1158 if (_equal_string(x_1,"#[]")) {
1159 #line 522 "printing.pcc"
1160 return "nil_1_";
1161 #line 522 "printing.pcc"
1163 else if (_equal_string(x_1,"#{...}")) {
1164 #line 521 "printing.pcc"
1165 return "list_3_";
1166 #line 521 "printing.pcc"
1168 else {
1169 if ((x_1[0] == '\"')) {
1171 #line 529 "printing.pcc"
1172 char buf[256]; encode_string(buf,x_1);
1173 return Quark(buf);
1174 #line 530 "printing.pcc"
1175 } else {
1177 #line 531 "printing.pcc"
1178 return x_1;
1179 #line 531 "printing.pcc"
1183 } else {
1184 if (_equal_string(x_1,"#{}")) {
1185 #line 524 "printing.pcc"
1186 return "nil_3_";
1187 #line 524 "printing.pcc"
1189 else if (_equal_string(x_1,"(|...|)")) {
1190 #line 526 "printing.pcc"
1191 return "vector_2_";
1192 #line 526 "printing.pcc"
1194 else if (_equal_string(x_1,"[|...|]")) {
1195 #line 525 "printing.pcc"
1196 return "vector_1_";
1197 #line 525 "printing.pcc"
1199 else if (_equal_string(x_1,"{|...|}")) {
1200 #line 527 "printing.pcc"
1201 return "vector_3_";
1202 #line 527 "printing.pcc"
1204 else {
1205 if ((x_1[0] == '\"')) {
1207 #line 529 "printing.pcc"
1208 char buf[256]; encode_string(buf,x_1);
1209 return Quark(buf);
1210 #line 530 "printing.pcc"
1211 } else {
1213 #line 531 "printing.pcc"
1214 return x_1;
1215 #line 531 "printing.pcc"
1221 #line 532 "printing.pcc"
1222 #line 532 "printing.pcc"
1225 ///////////////////////////////////////////////////////////////////////////////
1227 // Method to print the name of a constructor
1229 ///////////////////////////////////////////////////////////////////////////////
1230 std::ostream& print_cons (std::ostream& f, Cons cons)
1232 #line 540 "printing.pcc"
1233 #line 548 "printing.pcc"
1235 if (cons) {
1236 if (cons->alg_ty) {
1237 switch (cons->alg_ty->tag__) {
1238 case a_Ty::tag_TYCONty: {
1239 if (cons->ty) {
1240 if (boxed(((Ty_TYCONty *)cons->alg_ty)->_1)) {
1241 switch (((Ty_TYCONty *)cons->alg_ty)->_1->tag__) {
1242 case a_TyCon::tag_DATATYPEtycon: {
1243 L6:;
1244 #line 543 "printing.pcc"
1245 if (((TyCon_DATATYPEtycon *)((Ty_TYCONty *)cons->alg_ty)->_1)->opt & OPTsubclassless)
1246 f << "a_" << ((TyCon_DATATYPEtycon *)((Ty_TYCONty *)cons->alg_ty)->_1)->id;
1247 else
1248 f << ((TyCon_DATATYPEtycon *)((Ty_TYCONty *)cons->alg_ty)->_1)->id << "_" << mangle(cons->name);
1250 #line 547 "printing.pcc"
1251 } break;
1252 default: {
1253 L7:;
1254 #line 548 "printing.pcc"
1255 bug("print_cons()");
1256 #line 548 "printing.pcc"
1257 } break;
1259 } else { goto L7; }
1260 } else {
1261 L8:;
1262 #line 541 "printing.pcc"
1263 f << mangle(cons->name);
1264 #line 541 "printing.pcc"
1266 } break;
1267 default: {
1268 L9:;
1269 if (cons->ty) { goto L7; } else { goto L8; }
1270 } break;
1272 } else { goto L9; }
1273 } else { goto L7; }
1275 #line 549 "printing.pcc"
1276 #line 549 "printing.pcc"
1278 return f;
1281 ///////////////////////////////////////////////////////////////////////////////
1283 // Method to print an expression list
1285 ///////////////////////////////////////////////////////////////////////////////
1286 std::ostream& operator << (std::ostream& f, Exps es)
1287 { for (Exps l = es; l; l = l->_2) {
1288 f << l->_1; if (l->_2) f << ',';
1290 return f;
1293 ///////////////////////////////////////////////////////////////////////////////
1295 // Method to print an expression.
1297 ///////////////////////////////////////////////////////////////////////////////
1298 std::ostream& operator << (std::ostream& f, Exp e)
1300 #line 571 "printing.pcc"
1301 #line 725 "printing.pcc"
1303 if (e) {
1304 switch (e->tag__) {
1305 case a_Exp::tag_LITERALexp: {
1306 #line 577 "printing.pcc"
1307 f << ((Exp_LITERALexp *)e)->LITERALexp;
1308 #line 577 "printing.pcc"
1309 } break;
1310 case a_Exp::tag_IDexp: {
1311 #line 573 "printing.pcc"
1312 f << ((Exp_IDexp *)e)->IDexp;
1313 #line 573 "printing.pcc"
1314 } break;
1315 case a_Exp::tag_RELexp: {
1316 if (
1317 #line 574 "printing.pcc"
1318 same_selectors
1319 #line 574 "printing.pcc"
1322 #line 574 "printing.pcc"
1323 f << "_0";
1324 #line 574 "printing.pcc"
1325 } else {
1327 #line 575 "printing.pcc"
1328 f << '_' << ((Exp_RELexp *)e)->RELexp;
1329 #line 575 "printing.pcc"
1331 } break;
1332 case a_Exp::tag_DOTexp: {
1333 if (((Exp_DOTexp *)e)->_1) {
1334 switch (((Exp_DOTexp *)e)->_1->tag__) {
1335 case a_Exp::tag_SELECTORexp: {
1336 if (
1337 #line 579 "printing.pcc"
1338 pretty_print_exp
1339 #line 579 "printing.pcc"
1342 #line 580 "printing.pcc"
1343 f << ((Exp_SELECTORexp *)((Exp_DOTexp *)e)->_1)->_1 << '!' << ((Exp_SELECTORexp *)((Exp_DOTexp *)e)->_1)->_2->name << '.';
1344 int n = atol(((Exp_DOTexp *)e)->_2+1);
1345 if (n > 0) f << n; else f << ((Exp_DOTexp *)e)->_2;
1347 #line 583 "printing.pcc"
1348 } else {
1350 #line 587 "printing.pcc"
1351 f << MatchCompiler::make_select(((Exp_SELECTORexp *)((Exp_DOTexp *)e)->_1)->_1,((Exp_SELECTORexp *)((Exp_DOTexp *)e)->_1)->_2,((Exp_SELECTORexp *)((Exp_DOTexp *)e)->_1)->_3,((Exp_DOTexp *)e)->_2);
1352 #line 587 "printing.pcc"
1354 } break;
1355 case a_Exp::tag_DEREFexp: {
1356 #line 589 "printing.pcc"
1357 f << ((Exp_DEREFexp *)((Exp_DOTexp *)e)->_1)->DEREFexp << "->" << ((Exp_DOTexp *)e)->_2;
1358 #line 589 "printing.pcc"
1359 } break;
1360 default: {
1361 L10:;
1362 #line 590 "printing.pcc"
1363 f << ((Exp_DOTexp *)e)->_1 << '.' << ((Exp_DOTexp *)e)->_2;
1364 #line 590 "printing.pcc"
1365 } break;
1367 } else { goto L10; }
1368 } break;
1369 case a_Exp::tag_SELECTORexp: {
1370 if (
1371 #line 584 "printing.pcc"
1372 pretty_print_exp
1373 #line 584 "printing.pcc"
1376 #line 585 "printing.pcc"
1377 f << ((Exp_SELECTORexp *)e)->_1 << '!' << ((Exp_SELECTORexp *)e)->_2->name;
1378 #line 585 "printing.pcc"
1379 } else {
1381 #line 588 "printing.pcc"
1382 f << MatchCompiler::make_select(((Exp_SELECTORexp *)e)->_1,((Exp_SELECTORexp *)e)->_2,((Exp_SELECTORexp *)e)->_3);
1383 #line 588 "printing.pcc"
1385 } break;
1386 case a_Exp::tag_DEREFexp: {
1387 #line 591 "printing.pcc"
1388 f << "(*" << ((Exp_DEREFexp *)e)->DEREFexp << ')';
1389 #line 591 "printing.pcc"
1390 } break;
1391 case a_Exp::tag_ARROWexp: {
1392 #line 592 "printing.pcc"
1393 f << ((Exp_ARROWexp *)e)->_1 << "->" << ((Exp_ARROWexp *)e)->_2;
1394 #line 592 "printing.pcc"
1395 } break;
1396 case a_Exp::tag_INDEXexp: {
1397 #line 594 "printing.pcc"
1398 f << ((Exp_INDEXexp *)e)->_1 << '[' << ((Exp_INDEXexp *)e)->_2 << ']';
1399 #line 594 "printing.pcc"
1400 } break;
1401 case a_Exp::tag_BINOPexp: {
1402 #line 595 "printing.pcc"
1403 f << '(' << ((Exp_BINOPexp *)e)->_2 << ' ' << ((Exp_BINOPexp *)e)->_1 << ' ' << ((Exp_BINOPexp *)e)->_3 << ')';
1404 #line 595 "printing.pcc"
1405 } break;
1406 case a_Exp::tag_PREFIXexp: {
1407 #line 596 "printing.pcc"
1408 f << '(' << ((Exp_PREFIXexp *)e)->_1 << ' ' << ((Exp_PREFIXexp *)e)->_2 << ')';
1409 #line 596 "printing.pcc"
1410 } break;
1411 case a_Exp::tag_POSTFIXexp: {
1412 #line 597 "printing.pcc"
1413 f << '(' << ((Exp_POSTFIXexp *)e)->_2 << ' ' << ((Exp_POSTFIXexp *)e)->_1 << ')';
1414 #line 597 "printing.pcc"
1415 } break;
1416 case a_Exp::tag_APPexp: {
1417 #line 593 "printing.pcc"
1418 f << ((Exp_APPexp *)e)->_1 << '(' << ((Exp_APPexp *)e)->_2 << ')';
1419 #line 593 "printing.pcc"
1420 } break;
1421 case a_Exp::tag_ASSIGNexp: {
1422 #line 578 "printing.pcc"
1423 f << '(' << ((Exp_ASSIGNexp *)e)->_1 << " = " << ((Exp_ASSIGNexp *)e)->_2 << ')';
1424 #line 578 "printing.pcc"
1425 } break;
1426 case a_Exp::tag_IFexp: {
1427 #line 610 "printing.pcc"
1428 f << '(' << ((Exp_IFexp *)e)->_1 << " ? " << ((Exp_IFexp *)e)->_2 << " : " << ((Exp_IFexp *)e)->_3 <<')';
1429 #line 610 "printing.pcc"
1430 } break;
1431 case a_Exp::tag_TUPLEexp: {
1432 #line 608 "printing.pcc"
1433 f << ((Exp_TUPLEexp *)e)->TUPLEexp;
1434 #line 608 "printing.pcc"
1435 } break;
1436 case a_Exp::tag_EXTUPLEexp: {
1437 #line 609 "printing.pcc"
1438 f << "mkTuple" << length(((Exp_EXTUPLEexp *)e)->EXTUPLEexp) << '(' << ((Exp_EXTUPLEexp *)e)->EXTUPLEexp << ')';
1439 #line 609 "printing.pcc"
1440 } break;
1441 case a_Exp::tag_RECORDexp: {
1442 #line 685 "printing.pcc"
1443 f << "{ ";
1444 for (LabExps l = ((Exp_RECORDexp *)e)->RECORDexp; l; l = l->_2) {
1445 f << l->_1.label << " = " << l->_1.exp;
1446 if (l->_2) f << ", ";
1448 f << " }";
1450 #line 691 "printing.pcc"
1451 } break;
1452 case a_Exp::tag_LISTexp: {
1453 if (
1454 #line 692 "printing.pcc"
1455 pretty_print_exp
1456 #line 692 "printing.pcc"
1459 #line 693 "printing.pcc"
1460 f << open_of(((Exp_LISTexp *)e)->_2);
1461 for(Exps exp_list = ((Exp_LISTexp *)e)->_3; exp_list; exp_list = exp_list->_2)
1462 { f << exp_list->_1;
1463 if (exp_list->_2) f << ", ";
1465 if (((Exp_LISTexp *)e)->_4 != NOexp)
1466 { f << " ... " << ((Exp_LISTexp *)e)->_4; }
1467 f << close_of(((Exp_LISTexp *)e)->_2);
1469 #line 701 "printing.pcc"
1470 } else {
1472 if (((Exp_LISTexp *)e)->_1) {
1473 if (((Exp_LISTexp *)e)->_2) {
1474 #line 703 "printing.pcc"
1475 int i = 0;
1476 for(Exps exp_list = ((Exp_LISTexp *)e)->_3; exp_list; exp_list = exp_list->_2)
1477 { Exp exp = exp_list->_1;
1478 f << mangle(((Exp_LISTexp *)e)->_1->name) << '(' << exp;
1479 if (exp_list->_2) f << ',';
1480 i++;
1482 if (((Exp_LISTexp *)e)->_4 != NOexp) f << ',' << ((Exp_LISTexp *)e)->_4;
1483 else if (((Exp_LISTexp *)e)->_3 ==
1484 #line 711 "printing.pcc"
1485 #line 711 "printing.pcc"
1486 nil_1_
1487 #line 711 "printing.pcc"
1488 #line 711 "printing.pcc"
1489 ) f << mangle(((Exp_LISTexp *)e)->_2->name);
1490 while (i-- > 0) f << ')';
1492 #line 713 "printing.pcc"
1493 } else {
1494 L11:; }
1495 } else { goto L11; }
1497 } break;
1498 case a_Exp::tag_VECTORexp: {
1499 if (((Exp_VECTORexp *)e)->_1) {
1500 #line 716 "printing.pcc"
1501 f << mangle(((Exp_VECTORexp *)e)->_1->name) << '(';
1502 { for(Exps exps = ((Exp_VECTORexp *)e)->_2; exps; exps = exps->_2)
1503 { f << exps->_1;
1504 if (exps->_2 !=
1505 #line 719 "printing.pcc"
1506 #line 719 "printing.pcc"
1507 nil_1_
1508 #line 719 "printing.pcc"
1509 #line 719 "printing.pcc"
1510 ) f << ',';
1513 f << ')';
1515 #line 723 "printing.pcc"
1516 } else {}
1517 } break;
1518 case a_Exp::tag_CONSexp: {
1519 if (((Exp_CONSexp *)e)->_1) {
1520 if (((Exp_CONSexp *)e)->_3) {
1521 switch (((Exp_CONSexp *)e)->_3->tag__) {
1522 case a_Exp::tag_RECORDexp: {
1523 if (((Exp_CONSexp *)e)->_1->ty) {
1524 switch (((Exp_CONSexp *)e)->_1->ty->tag__) {
1525 case a_Ty::tag_TYCONty: {
1526 if (boxed(((Ty_TYCONty *)((Exp_CONSexp *)e)->_1->ty)->_1)) {
1527 switch (((Ty_TYCONty *)((Exp_CONSexp *)e)->_1->ty)->_1->tag__) {
1528 case a_TyCon::tag_RECORDtycon: {
1529 if (((Exp_CONSexp *)e)->_3) {
1530 switch (((Exp_CONSexp *)e)->_3->tag__) {
1531 case a_Exp::tag_RECORDexp: {
1532 L12:;
1533 #line 632 "printing.pcc"
1534 // rearrange arguments to
1535 if (((Exp_CONSexp *)e)->_2)
1536 { f << "new (" << ((Exp_CONSexp *)e)->_2 << ") "; print_cons(f,((Exp_CONSexp *)e)->_1); }
1537 else
1538 { f << mangle(((Exp_CONSexp *)e)->_1->name); }
1540 f << '(';
1541 { for_each (LabExp, i, ((Exp_RECORDexp *)((Exp_CONSexp *)e)->_3)->RECORDexp) {
1542 for_each (Id, j, ((TyCon_RECORDtycon *)((Ty_TYCONty *)((Exp_CONSexp *)e)->_1->ty)->_1)->_1) if (i.label == j) goto next;
1543 error ("%Lillegal record label '%s' in expression: %s%e\n",
1544 i.label,((Exp_CONSexp *)e)->_1->name,((Exp_CONSexp *)e)->_3);
1545 next: ;
1548 { Bool comma = false;
1549 Ids is; Tys ts;
1550 for(is = ((TyCon_RECORDtycon *)((Ty_TYCONty *)((Exp_CONSexp *)e)->_1->ty)->_1)->_1, ts = ((Ty_TYCONty *)((Exp_CONSexp *)e)->_1->ty)->_2; is; is = is->_2, ts = ts->_2) {
1551 Id i = is->_1;
1552 Bool found = false;
1553 for_each (LabExp, j, ((Exp_RECORDexp *)((Exp_CONSexp *)e)->_3)->RECORDexp) {
1554 if (i == j.label) {
1555 if (found)
1556 error ("%Lduplicated label '%s' in expression: %s%e\n",
1557 j.label,((Exp_CONSexp *)e)->_1->name,((Exp_CONSexp *)e)->_3);
1558 found = true;
1559 if (comma) f << ", "; comma = true;
1560 f << j.exp;
1563 if (! found) {
1565 #line 662 "printing.pcc"
1566 #line 665 "printing.pcc"
1568 Exp _V4 = default_val(ts->_1);
1569 if (_V4) {
1570 #line 665 "printing.pcc"
1571 if (comma) f << ", "; comma = true; f << _V4;
1572 #line 665 "printing.pcc"
1573 } else {
1574 #line 663 "printing.pcc"
1575 error ("%Lmissing label '%s' in expression: %s%e\n",
1576 i, ((Exp_CONSexp *)e)->_1->name, ((Exp_CONSexp *)e)->_3);
1577 #line 664 "printing.pcc"
1580 #line 666 "printing.pcc"
1581 #line 666 "printing.pcc"
1586 f << ')';
1588 #line 671 "printing.pcc"
1589 } break;
1590 default: {
1591 L13:;
1592 #line 673 "printing.pcc"
1593 error("%Lconstructor '%s' doesn't take labeled arguments\n", ((Exp_CONSexp *)e)->_1->name);
1595 #line 674 "printing.pcc"
1596 } break;
1598 } else { goto L13; }
1599 } break;
1600 default: { goto L13; } break;
1602 } else { goto L13; }
1603 } break;
1604 default: { goto L13; } break;
1606 } else { goto L13; }
1607 } break;
1608 default: {
1609 L14:;
1610 if (((Exp_CONSexp *)e)->_1->ty) {
1611 switch (((Exp_CONSexp *)e)->_1->ty->tag__) {
1612 case a_Ty::tag_TYCONty: {
1613 L15:;
1614 if (boxed(((Ty_TYCONty *)((Exp_CONSexp *)e)->_1->ty)->_1)) {
1615 switch (((Ty_TYCONty *)((Exp_CONSexp *)e)->_1->ty)->_1->tag__) {
1616 case a_TyCon::tag_RECORDtycon: {
1617 L16:;
1618 if (((Exp_CONSexp *)e)->_3) {
1619 switch (((Exp_CONSexp *)e)->_3->tag__) {
1620 case a_Exp::tag_RECORDexp: { goto L12; } break;
1621 default: {
1622 L17:;
1623 #line 678 "printing.pcc"
1624 if (((Exp_CONSexp *)e)->_2)
1625 { f << "new (" << ((Exp_CONSexp *)e)->_2 << ") "; print_cons(f,((Exp_CONSexp *)e)->_1); }
1626 else
1627 { f << mangle(((Exp_CONSexp *)e)->_1->name); }
1628 f << '(' << ((Exp_CONSexp *)e)->_3 << ')';
1630 #line 683 "printing.pcc"
1631 } break;
1633 } else { goto L17; }
1634 } break;
1635 default: { goto L17; } break;
1637 } else { goto L17; }
1638 } break;
1639 default: { goto L17; } break;
1641 } else {
1642 L18:;
1643 if (((Exp_CONSexp *)e)->_3) { goto L17; } else {
1644 L19:;
1645 if (((Exp_CONSexp *)e)->_2) { goto L17; } else {
1646 L20:;
1647 #line 676 "printing.pcc"
1648 f << mangle(((Exp_CONSexp *)e)->_1->name);
1649 #line 676 "printing.pcc"
1653 } break;
1655 } else { goto L14; }
1656 } else {
1657 L21:;
1658 #line 725 "printing.pcc"
1659 bug("operator << (std::ostream&, Exp);");
1660 #line 725 "printing.pcc"
1662 } break;
1663 case a_Exp::tag_CASTexp: {
1664 #line 598 "printing.pcc"
1665 Bool save = pretty_print_ty;
1666 pretty_print_ty = false;
1667 f << "((" << ((Exp_CASTexp *)e)->_1 << ')' << ((Exp_CASTexp *)e)->_2 << ')';
1668 pretty_print_ty = save;
1670 #line 602 "printing.pcc"
1671 } break;
1672 case a_Exp::tag_QUALexp: {
1673 #line 603 "printing.pcc"
1674 f << ((Exp_QUALexp *)e)->_1 << "::" << ((Exp_QUALexp *)e)->_2;
1675 #line 603 "printing.pcc"
1676 } break;
1677 case a_Exp::tag_EQexp: {
1678 #line 604 "printing.pcc"
1679 f << "equality_of(" << ((Exp_EQexp *)e)->_2 << ',' << ((Exp_EQexp *)e)->_3 << ')';
1680 #line 604 "printing.pcc"
1681 } break;
1682 case a_Exp::tag_UNIFYexp: {
1683 #line 605 "printing.pcc"
1684 f << "unify(" << ((Exp_UNIFYexp *)e)->_2 << ',' << ((Exp_UNIFYexp *)e)->_3 << ')';
1685 #line 605 "printing.pcc"
1686 } break;
1687 case a_Exp::tag_LTexp: {
1688 #line 606 "printing.pcc"
1689 f << '(' << ((Exp_LTexp *)e)->_2 << " < " << ((Exp_LTexp *)e)->_3 << ')';
1690 #line 606 "printing.pcc"
1691 } break;
1692 case a_Exp::tag_HASHexp: {
1693 #line 607 "printing.pcc"
1694 f << "hash(" << ((Exp_HASHexp *)e)->_2 << ')';
1695 #line 607 "printing.pcc"
1696 } break;
1697 case a_Exp::tag_THISCOSTexp: {
1698 #line 628 "printing.pcc"
1699 f << "t__->cost";
1700 #line 628 "printing.pcc"
1701 } break;
1702 case a_Exp::tag_COSTexp: {
1703 #line 627 "printing.pcc"
1704 f << "t__->kids[" << ((Exp_COSTexp *)e)->COSTexp << "]->cost";
1705 #line 627 "printing.pcc"
1706 } break;
1707 case a_Exp::tag_THISSYNexp: {
1708 #line 622 "printing.pcc"
1709 if (((Exp_THISSYNexp *)e)->_3)
1710 f << "__";
1711 else // in parser
1712 f << "t__->u._" << ((Exp_THISSYNexp *)e)->_1;
1714 #line 626 "printing.pcc"
1715 } break;
1716 case a_Exp::tag_SYNexp: {
1717 #line 612 "printing.pcc"
1718 if (((Exp_SYNexp *)e)->_4)
1719 f << '_' << ((Exp_SYNexp *)e)->_1 << "__";
1720 else if (((Exp_SYNexp *)e)->_2 < 0) // parser semantic action
1721 { if (((Exp_SYNexp *)e)->_1 == 0) f << "syn_" << "._" << -((Exp_SYNexp *)e)->_2;
1722 else f << "t__[" << ((Exp_SYNexp *)e)->_1 << "+to__]._" << -((Exp_SYNexp *)e)->_2;
1724 else
1725 f << "t__->kids[" << ((Exp_SYNexp *)e)->_1 << "]->u._" << ((Exp_SYNexp *)e)->_2;
1727 #line 620 "printing.pcc"
1728 } break;
1729 case a_Exp::tag_MARKEDexp: {
1730 #line 576 "printing.pcc"
1731 f << ((Exp_MARKEDexp *)e)->_2;
1732 #line 576 "printing.pcc"
1733 } break;
1734 default: { goto L21; } break;
1736 } else {
1737 #line 572 "printing.pcc"
1739 #line 572 "printing.pcc"
1742 #line 726 "printing.pcc"
1743 #line 726 "printing.pcc"
1745 return f;
1748 ///////////////////////////////////////////////////////////////////////////////
1750 // Method to print an inheritance type.
1752 ///////////////////////////////////////////////////////////////////////////////
1753 std::ostream& operator << (std::ostream& f, Inherit i)
1754 { if (i->qualifiers & QUALvirtual) f << "virtual ";
1755 return f << i->scope << ' ' << i->super_class;
1758 ///////////////////////////////////////////////////////////////////////////////
1760 // Method to print a class inheritance list.
1762 ///////////////////////////////////////////////////////////////////////////////
1763 std::ostream& operator << (std::ostream& f, Inherits i)
1764 { for ( ;i; i = i->_2) {
1765 f << i->_1;
1766 if (i->_2) f << ", ";
1768 return f;
1771 ///////////////////////////////////////////////////////////////////////////////
1773 // Method to print a cost expression
1775 ///////////////////////////////////////////////////////////////////////////////
1776 std::ostream& operator << (std::ostream& f, Cost c)
1778 #line 759 "printing.pcc"
1779 #line 762 "printing.pcc"
1781 if (c) {
1782 if (untagp(c)) {
1784 #line 762 "printing.pcc"
1785 f << " \\ " << ((Cost_INTcost *)derefp(c))->INTcost;
1786 #line 762 "printing.pcc"
1787 } else {
1789 #line 761 "printing.pcc"
1790 f << " \\ " << ((Cost_EXPcost *)c)->_1;
1791 #line 761 "printing.pcc"
1793 } else {}
1795 #line 763 "printing.pcc"
1796 #line 763 "printing.pcc"
1798 return f;
1801 ///////////////////////////////////////////////////////////////////////////////
1803 // Method to print a qualified identifier.
1805 ///////////////////////////////////////////////////////////////////////////////
1806 std::ostream& operator << (std::ostream& f, QualId id)
1808 #line 773 "printing.pcc"
1809 #line 776 "printing.pcc"
1811 if (untagp(id)) {
1813 if (
1814 #line 775 "printing.pcc"
1815 isalpha(((QualId_SIMPLEid *)derefp(id))->SIMPLEid[0])
1816 #line 775 "printing.pcc"
1819 #line 775 "printing.pcc"
1820 f << ((QualId_SIMPLEid *)derefp(id))->SIMPLEid;
1821 #line 775 "printing.pcc"
1822 } else {
1824 #line 776 "printing.pcc"
1825 f << "operator " << ((QualId_SIMPLEid *)derefp(id))->SIMPLEid;
1826 #line 776 "printing.pcc"
1828 } else {
1830 #line 774 "printing.pcc"
1831 f << ((QualId_NESTEDid *)id)->_1 << "::" << ((QualId_NESTEDid *)id)->_2;
1832 #line 774 "printing.pcc"
1835 #line 777 "printing.pcc"
1836 #line 777 "printing.pcc"
1838 return f;
1841 ///////////////////////////////////////////////////////////////////////////////
1842 // Method to print a pattern match rule.
1843 ///////////////////////////////////////////////////////////////////////////////
1844 std::ostream& operator << (std::ostream& f, MatchRule mr)
1846 #line 785 "printing.pcc"
1847 #line 794 "printing.pcc"
1849 #line 787 "printing.pcc"
1850 Bool save = pretty_print_exp;
1851 pretty_print_exp = true;
1852 if (mr->_1) f << mr->_1 << " -> ";
1853 f << mr->_2;
1854 if (mr->_3 != NOexp) f << " | " << mr->_3;
1855 f << mr->_4 << ": ...";
1856 pretty_print_exp = save;
1858 #line 794 "printing.pcc"
1860 #line 795 "printing.pcc"
1861 #line 795 "printing.pcc"
1863 return f;
1866 ///////////////////////////////////////////////////////////////////////////////
1868 // Method to pretty print a decision tree.
1870 ///////////////////////////////////////////////////////////////////////////////
1871 std::ostream& operator << (std::ostream& f, Match m)
1873 #line 805 "printing.pcc"
1874 #line 861 "printing.pcc"
1876 if (boxed(m)) {
1877 switch (m->tag__) {
1878 case a_Match::tag_SUCCESSmatch: {
1879 #line 809 "printing.pcc"
1880 f << ((Match_SUCCESSmatch *)m)->_1;
1881 #line 809 "printing.pcc"
1882 } break;
1883 case a_Match::tag_SUCCESSESmatch: {
1884 #line 812 "printing.pcc"
1885 f << '{';
1886 Bool comma = false;
1887 for (int i = 0; i < ((Match_SUCCESSESmatch *)m)->_1; i++)
1888 if ((*((Match_SUCCESSESmatch *)m)->_2)[i]) {
1889 if (comma) f << ", ";
1890 f << i;
1891 comma = true;
1893 f << '}';
1895 #line 821 "printing.pcc"
1896 } break;
1897 case a_Match::tag_COSTmatch: {
1898 #line 823 "printing.pcc"
1899 f << '{';
1900 Bool comma = false;
1901 for (int i = 0; i < ((Match_COSTmatch *)m)->_1; i++)
1902 if ((*((Match_COSTmatch *)m)->_3)[i]) {
1903 if (comma) f << ", ";
1904 f << ((Match_COSTmatch *)m)->_2[i] << " = " << i;
1905 comma = true;
1907 f << '}';
1909 #line 832 "printing.pcc"
1910 } break;
1911 case a_Match::tag_GUARDmatch: {
1912 #line 810 "printing.pcc"
1913 f << ((Match_GUARDmatch *)m)->_1 << '(' << ((Match_GUARDmatch *)m)->_2 << ',' << ((Match_GUARDmatch *)m)->_3 << ')';
1914 #line 810 "printing.pcc"
1915 } break;
1916 case a_Match::tag_LITERALmatch: {
1917 switch (((Match_LITERALmatch *)m)->_3[0]->tag__) {
1918 case a_Literal::tag_REGEXPlit: {
1919 #line 838 "printing.pcc"
1920 f << "[\n";
1921 for (int i = 0; i < ((Match_LITERALmatch *)m)->_4; i++)
1922 { f << " {" << i << "}" << ((Match_LITERALmatch *)m)->_3[i] << " => " << ((Match_LITERALmatch *)m)->_5[i] << ",\n";
1924 f << ((Match_LITERALmatch *)m)->_6 << ']';
1926 #line 843 "printing.pcc"
1927 } break;
1928 default: {
1929 #line 845 "printing.pcc"
1930 f << '[';
1931 for (int i = 0; i < ((Match_LITERALmatch *)m)->_4; i++)
1932 { f << ((Match_LITERALmatch *)m)->_3[i] << ':' << ((Match_LITERALmatch *)m)->_5[i] << ", "; }
1933 f << ((Match_LITERALmatch *)m)->_6 << ']';
1935 #line 849 "printing.pcc"
1936 } break;
1938 } break;
1939 case a_Match::tag_RANGEmatch: {
1940 #line 860 "printing.pcc"
1941 f << '[' << ((Match_RANGEmatch *)m)->_3 << ".." << ((Match_RANGEmatch *)m)->_4 << ": " << ((Match_RANGEmatch *)m)->_5 << ", " << ((Match_RANGEmatch *)m)->_6 << ']';
1942 #line 860 "printing.pcc"
1943 } break;
1944 case a_Match::tag_CONSmatch: {
1945 if (((Match_CONSmatch *)m)->_4) {
1946 switch (((Match_CONSmatch *)m)->_4->tag__) {
1947 case a_Ty::tag_TYCONty: {
1948 if (boxed(((Ty_TYCONty *)((Match_CONSmatch *)m)->_4)->_1)) {
1949 switch (((Ty_TYCONty *)((Match_CONSmatch *)m)->_4)->_1->tag__) {
1950 case a_TyCon::tag_DATATYPEtycon: {
1951 #line 851 "printing.pcc"
1952 f << ((TyCon_DATATYPEtycon *)((Ty_TYCONty *)((Match_CONSmatch *)m)->_4)->_1)->id << '[';
1953 for (int i = 0; i < ((Match_CONSmatch *)m)->_5; i++) {
1954 f << ((Match_CONSmatch *)m)->_6[i];
1955 if (i < ((Match_CONSmatch *)m)->_5 - 1) f << ", ";
1957 if (((TyCon_DATATYPEtycon *)((Ty_TYCONty *)((Match_CONSmatch *)m)->_4)->_1)->qualifiers & QUALextensible) f << ", " << ((Match_CONSmatch *)m)->_7;
1958 f << ']';
1960 #line 858 "printing.pcc"
1961 } break;
1962 default: {
1963 L22:;
1964 #line 861 "printing.pcc"
1965 bug("operator << (std::ostream&, Match);");
1966 #line 861 "printing.pcc"
1967 } break;
1969 } else { goto L22; }
1970 } break;
1971 default: { goto L22; } break;
1973 } else { goto L22; }
1974 } break;
1975 case a_Match::tag_TREECOSTmatch: {
1976 #line 834 "printing.pcc"
1977 f << "TREE{" << *((Match_TREECOSTmatch *)m)->_2 << "} => " << ((Match_TREECOSTmatch *)m)->_1;
1978 #line 834 "printing.pcc"
1979 } break;
1980 case a_Match::tag_TREELABELmatch: {
1981 #line 836 "printing.pcc"
1982 f << "LABEL{" << ((Match_TREELABELmatch *)m)->_2 << "(" << ((Match_TREELABELmatch *)m)->_4 << ")} => " << ((Match_TREELABELmatch *)m)->_1;
1983 #line 836 "printing.pcc"
1984 } break;
1985 default: {
1986 #line 808 "printing.pcc"
1987 f << '<' << ((Match_BACKEDGEmatch *)m)->_2 << '>';
1988 #line 808 "printing.pcc"
1989 } break;
1991 } else {
1992 if (m) {
1994 #line 807 "printing.pcc"
1995 f << '-';
1996 #line 807 "printing.pcc"
1997 } else {
1999 #line 806 "printing.pcc"
2000 f << '_';
2001 #line 806 "printing.pcc"
2005 #line 862 "printing.pcc"
2006 #line 862 "printing.pcc"
2008 return f;
2010 #line 865 "printing.pcc"
2012 ------------------------------- Statistics -------------------------------
2013 Merge matching rules = yes
2014 Number of DFA nodes merged = 4392
2015 Number of ifs generated = 77
2016 Number of switches generated = 31
2017 Number of labels = 22
2018 Number of gotos = 47
2019 Adaptive matching = enabled
2020 Fast string matching = disabled
2021 Inline downcasts = enabled
2022 --------------------------------------------------------------------------