source: tests/generator/.expect/fmtLines.txt@ cb69fba

ADT ast-experimental
Last change on this file since cb69fba was dfa4360, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Added several tests for generators

  • Property mode set to 100644
File size: 2.4 KB
Line 
1//// Cfo rall Ver sion
2 1.0 .0 C opyr ight (C)
3 201 7 Un iver sity of
4Wate rloo //// The con
5tent s of thi s fi le a
6re c over ed u nder the
7 lic ence agr eeme nt i
8n th e// file "LI CENC
9E" d istr ibut ed w ith
10Cfor all. //// fmt Line
11s.cc --/ /// Auth or
12 : P eter A.
13Buhr // C reat ed O n
14 : Su n Se p 17 21:
1556:1 5 20 17// Las t Mo
16difi ed B y : Pete r A.
17 Buh r// Last Mod ifie
18d On : F ri M ar 2 2 13
19:41: 03 2 019/ / Up date
20 Cou nt : 33/ /#in
21clud e <f stre am.h fa>#
22incl ude <cor outi ne.h
23fa>c orou tine For mat
24{ ch ar c h;
25 // used for com muni
26cati on i nt g , b;
27 / / gl obal bec
28ause use d in des truc
29tor} ;voi d ?{ }( F orma
30t & fmt ) { r esum
31e( f mt ) ; /
32/ st art coro utin e}vo
33id ^ ?{}( For mat & fm
34t ) { if ( fm t.g
35!= 0 || fmt. b != 0 )
36 sou t | nl;} void mai
37n( F orma t & fmt ) {
38for ( ;; ) {
39 // for as many cha
40ract ers for ( f mt.g
41 = 0 ; fm t.g < 5; fmt
42.g + = 1 ) { // grou
43ps o f 5 bloc ks for
44 ( f mt.b = 0 ; fm t.b
45< 4; fmt .b + = 1 ) {
46// b lock s of 4 c hara
47cter s for ( ; ; )
48{ // f or n ewli
49ne c hara cter s su
50spen d; i f ( fmt.
51ch ! = '\ n' ) bre ak;
52 // igno re n ewli ne
53 } // f or so ut |
54 fmt .ch; / / pr
55int char acte r } //
56 for s out | " ";
57 / / pr int bloc
58k se para tor } / / fo
59r s out | nl ;
60 // pri nt g roup sep
61arat or } // for} //
62main void prt ( Fo rmat
63 & f mt, char ch ) {
64 f mt.c h = ch; r
65esum e( f mt ) ;} / / pr
66tint mai n() { Fo rmat
67 fmt ; ch ar c h; f or (
68 ;; ) { sin | c h;
69 // r ead one
70char acte r if ( eof
71( si n ) ) br eak;
72 / / eo f ? prt ( fm
73t, c h ); } / / fo r} /
74/ ma in// Loc al V aria
75bles : // // t ab-w idth
76: 4 //// com pile -com
77mand : "c fa f mtLi nes.
78cfa" /// / En d: / /
Note: See TracBrowser for help on using the repository browser.