~ubuntu-branches/ubuntu/trusty/kate/trusty

« back to all changes in this revision

Viewing changes to tests/data/indent/pascal/test2/expected

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-12-18 16:28:23 UTC
  • mfrom: (1.1.38)
  • Revision ID: package-import@ubuntu.com-20131218162823-nea1os5bnvlya9km
Tags: 4:4.12.0-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// kate: space-indent on; indent-width 4; replace-tabs on; remove-trailing-spaces all;
2
 
// kate: syntax pascal; indent-mode pascal;
3
 
 
4
 
// these variables are understood by the pascal indenter ...
5
 
// kate: cfgIndentCase false;          // indent elements in a case statement
6
 
// kate: cfgIndentBegin 2;            // indent 'begin' this many spaces
7
 
// kate: debugMode false;              // show how indent is determined
8
 
// kate: cfgAutoInsertStar true;      // auto insert '*' in (* ... *)-comments
9
 
// kate: cfgSnapParen true;           // snap ')' to '*)' in comments
10
 
 
11
 
(**********************************************   // check: indent OK?
12
 
 *                                            *
13
 
 *       Commment to test alignment           *
14
 
 *                                            *
15
 
 *                                            *
16
 
 **********************************************)
17
 
 
18
 
 (*************************************************************************
19
 
 Another Comment
20
 
 
21
 
 Relative alignment should be kept ...
22
 
       After indent, first character of this line should 
23
 
       still remain under the 'v' in relative
24
 
 
25
 
 *************************************************************************)
26
 
 
27
 
program fred;
28
 
 
29
 
uses bbb;
30
 
 
31
 
label fred001;
32
 
var   i: integer;
33
 
 
34
 
const const0 = 0;
35
 
    c33 = 12;
36
 
    const1 = 17;
37
 
    const2 = 18.4;
38
 
 
39
 
type x = record a: real; c : char end;
40
 
 
41
 
   // r = record ... vs unfinished typedef
42
 
    rType = record  // cr here ==> type def
43
 
                a: aType;       // this can be realigned manually
44
 
                b: bType;       // should follow line above
45
 
                c: cType
46
 
            end;
47
 
 
48
 
    colourType =
49
 
       { unfinished type declaration }
50
 
        ( red,    // CHECK: everything should line up below this
51
 
          orange, // this must follow line above
52
 
          green,
53
 
          blue,
54
 
          indigo,
55
 
          yellow,
56
 
          violet
57
 
          // CHECK: the comments should line up as well
58
 
          // closing paren should align to list when it's left shifted
59
 
          //                            to opening paren otherwise
60
 
        );
61
 
 
62
 
    otherTypeDef = integer;
63
 
 
64
 
// CHECK: next line should keep its relative alignment
65
 
   {ant}
66
 
    ant = RECORD CASE F: BOOLEAN OF
67
 
                 TRUE: ( fred : REAL;
68
 
                         joe  : INTEGER;
69
 
                       );  // parens should line up
70
 
                 FALSE: (  ted : ARRAY[
71
 
                                          1..16
72
 
                                      ] OF BOOLEAN;
73
 
                           moe: CHAR;
74
 
                        );
75
 
             END; // 'case' + 'record' share same 'end'
76
 
 
77
 
 
78
 
 
79
 
var a: real;
80
 
 
81
 
    RW:  ARRAY [AASY..ZZSY]
82
 
             OF   (*RESERVED WORDS*)   PACKED ARRAY [1..RWLENGTH,
83
 
                                                     2..66 ]     // CHECK: this line should be indented
84
 
                                                  OF CHAR;    // CHECK: this line should be indented from array
85
 
 
86
 
    RW:  ARRAY [AASY..ZZSY] OF   (*RESERVED WORDS*)
87
 
             PACKED ARRAY [1..RWLENGTH] OF CHAR;
88
 
 
89
 
var
90
 
    sym : keysymbol;
91
 
    pos : hashIndex;
92
 
    len : charLenType;
93
 
 
94
 
 
95
 
type tR = record
96
 
             i: integer;   // CHECK: can be aligned manually, but default indented from record
97
 
             r: real;      // should align with line immediately above
98
 
             a: array[1..11] of char;
99
 
 
100
 
             case boolean of
101
 
             true: ( fred : real;
102
 
                     joe  : integer;
103
 
                   );  // parens should line up
104
 
             false: (  ted : array[
105
 
                                     1..16
106
 
                                  ] of boolean;
107
 
                       moe: char;
108
 
                    );
109
 
         end; // 'case' + 'record' share same 'end'
110
 
 
111
 
    tArray = array[0..17] of real; // should indent wrt 'type'
112
 
 
113
 
type    colourType = (
114
 
              red,    // CHECK: this line can be adjusted manually
115
 
              orange, // this must follow line above
116
 
              green,
117
 
              blue,
118
 
              indigo,
119
 
              yellow,
120
 
              violet
121
 
              // CHECK: the comments should line up as well
122
 
              // closing paren should align to list when it's left shifted
123
 
              //                            to opening paren otherwise
124
 
              );
125
 
 
126
 
    blah = char;  // should align after type
127
 
 
128
 
    optionset = set of options;
129
 
 
130
 
var
131
 
    r1: record
132
 
           i:    integer;
133
 
           r:    real;                   // should line up with first member
134
 
           a:    array[0..7] of char;
135
 
       end;  // CHECK: end is outdented relative to first member
136
 
 
137
 
    optionset : set of options;
138
 
 
139
 
    options : (    crsupp,crbefore,blinbefore,
140
 
                   dindonkey,dindent,spbef,
141
 
                   spaft,gobsym,
142
 
                   inbytab,   { indent current margin (was indent from symbol pos) }
143
 
                   crafter,
144
 
                   finl            { force symbol to follow on same line as previous symbol }
145
 
              );
146
 
 
147
 
    optionset = set of options;
148
 
 
149
 
    aa: array[   1..9, // should be indented after cr
150
 
                 3..22 ]
151
 
            of ( crsupp,crbefore,blinbefore,
152
 
                 dindonkey,dindent,spbef,
153
 
                 spaft,gobsym,
154
 
                 inbytab,   { indent current margin (was indent from symbol pos) }
155
 
                 crafter,
156
 
                 finl            { force symbol to follow on same line as previous symbol }
157
 
               );
158
 
 
159
 
    aaa: array[ 1..3,
160
 
                4..5,
161
 
                12..11 ]
162
 
             of record // cr after here should indent from record
163
 
                    a: array[1..6] of char;
164
 
                    i: integer;
165
 
                end;
166
 
 
167
 
                 { CHECK: following text should keep indent relative to open/close brace
168
 
                          when annotating, behavior of "external", "end" and possibly other keywords
169
 
                          depends on whether we are in procedure declaration,
170
 
                          item (var/const/type) declaration, or statements
171
 
    NOTE:  here we see why it's better to make the comment align with the
172
 
           following line (ie the procedure call) rather than the preceding
173
 
           line (ie the 'end'.  Easy in theory, messy in practice.
174
 
                 }
175
 
 
176
 
 
177
 
procedure AVeryVeryLongFunctionName(const A : tRealArrayType;
178
 
                                    N : tIntegerType;
179
 
                                    var H : tRealArrayType); forward;
180
 
 
181
 
(*************************************************************************
182
 
CHECK:   comment is correctly aligned with precedinging statement
183
 
 
184
 
Input parameters:
185
 
A       -   description
186
 
 
187
 
N       -   longer description, but
188
 
            still preserving relative format
189
 
 
190
 
Output parameters:
191
 
H       - other meaningful description
192
 
 
193
 
Result:
194
 
   True, if successful
195
 
   False, otherwise
196
 
*************************************************************************)
197
 
 
198
 
var size : (small, medium, large);
199
 
    fred : real;
200
 
 
201
 
var   r : record i: integer; c: char end;
202
 
 
203
 
    a: array[ 1..9,    // should be indented after var
204
 
              'a'..'z'        // non-code, should line up with opening arg
205
 
            ] of integer;
206
 
 
207
 
begin (* AVeryVeryLongFunctionName *)
208
 
 
209
 
    if a then
210
 
      begin
211
 
        s1;
212
 
16:
213
 
        f(32);  //CHECK: label forced to margin, statement is on new line with comment
214
 
      end;
215
 
 
216
 
    for i := 0 to 100 do
217
 
      begin
218
 
        with p^ do
219
 
            begin s1; s2; s3 end
220
 
      end;
221
 
 
222
 
    with p^ do
223
 
        begin s1; s2; s3 end;
224
 
 
225
 
    for i := firstCh to lastCh do chtype[chr(i)] := none;
226
 
    value['0'] := 0; value['1'] := 1; value['2'] := 2;
227
 
    value['3'] := 3; value['4'] := 4; value['5'] := 5;
228
 
    value['6'] := 6; value['7'] := 7; value['8'] := 8;
229
 
    value['9'] := 9;
230
 
    value['A'] := 10; value['B'] := 11; value['C'] := 12;
231
 
    value['D'] := 13; value['E'] := 14; value['F'] := 15;
232
 
    value['a'] := 10; value['b'] := 11; value['c'] := 12;
233
 
    value['d'] := 13; value['e'] := 14; value['f'] := 15;
234
 
 
235
 
    IF NOT (CH IN ['{','}']) THEN
236
 
    // comment
237
 
      BEGIN  IF CH <= 'Z' THEN CMDCH := CH ELSE CMDCH := CHR(ORD(CH)-ORD('a')+ORD('A') );
238
 
        NEXTCH;
239
 
        IF CMDCH = 'L' THEN
240
 
            COMMAND(LISTON)
241
 
        ELSE IF CMDCH = 'T' THEN
242
 
            COMMAND(TRACEON)
243
 
        ELSE IF CMDCH = 'I' THEN
244
 
            COMMAND(INCLUDE)
245
 
        ELSE IF CMDCH = 'Z' THEN
246
 
            REPEAT
247
 
                BEGIN
248
 
                  www.fred.com;
249
 
                  REPEAT commandIn UNTIL numRem = 0;
250
 
                  s1;
251
 
                  s2;
252
 
                END;
253
 
            UNTIL False
254
 
        ELSE IF CMDCH = 'Q' THEN begin
255
 
            COMMAND(QUIET)
256
 
        end ELSE IF CMDCH = 'V' THEN
257
 
            COMMAND(VERBOSE)
258
 
        else if COMMAND.STRVAL = 'unknown' then
259
 
          begin
260
 
            IF
261
 
                    (numStr[0] >= 0) AND
262
 
                    (numStr[1] IN ['+', '-', '0' .. '9', '?']) // CHECK: indent
263
 
            THEN
264
 
                Power.Supply := '"AC' ELSE Power.Supply := '"DC'
265
 
          end else  if CommandResult.Str = 'helpIamLost' then begin
266
 
              Power.Supply := SetPowerSupplyCommands(Plus15V.Increase(Amps));
267
 
          end else if (line = 'SHORT') OR (line = 'OPEN') THEN  BEGIN
268
 
              OpenCircuit;
269
 
              {*smoke billows out*}
270
 
              IF SPARKS THEN
271
 
                BEGIN
272
 
                  SPARKS := FALSE;
273
 
                  ShutDown
274
 
                END
275
 
          END ELSE IF
276
 
              (line = 'OPEN') OR (line = 'CLOSED') THEN
277
 
            BEGIN;
278
 
              AddFuse(Low);
279
 
              IF SPARKS THEN
280
 
                BEGIN;
281
 
                  SPARKS := False;
282
 
                  CircuitBreaker(wishfulThinking)
283
 
                END else if cond then
284
 
                    statement;
285
 
            END ELSE IF (line = 'PLUS') OR (line = 'MINUS') THEN Transform(RedPhase)
286
 
        ELSE IF (line = 'RED') OR (line = 'BLACK') THEN Transform(BluePhase)
287
 
        ELSE IF line = 'XX' THEN Transistor
288
 
        ELSE IF line = 'YYYY' THEN SetCurrent(FiveAmps)
289
 
        ELSE IF line = 'QQQQ' THEN SetPower(FiveWatts)
290
 
        ELSE IF line = 'AAAAA' THEN Power(FiveAmps)
291
 
        ELSE IF
292
 
           {* QWERTY COMMENT LLLLLLLLL ####### *}
293
 
           line = 'SSSSS' THEN
294
 
          BEGIN
295
 
            actualphase := YellowPhase;
296
 
            AdjustLinePhase(NewPhase);
297
 
          END
298
 
        ELSE IF
299
 
                line = 'Noisy' THEN Filter
300
 
        ELSE IF line = 'BLUE' THEN
301
 
          BEGIN
302
 
            AdjustLinePhase(XPhase);
303
 
            Erase := True
304
 
          END ELSE IF
305
 
              line = 'RED' THEN BEGIN Swap; Hope END
306
 
        ELSE IF
307
 
           line = '415' THEN iNumPut415
308
 
        ELSE IF
309
 
           // a statement like this has no chance of being correctly indented ...
310
 
           // otoh, it shouldn't turn out catastrophically wrong.
311
 
           line = 'REFL' THEN FOR i := 1 TO numLines DO
312
 
                                       WriteLn('level=', powerLevel[i], ' ', name[i]+'='+power[i])
313
 
        ELSE IF
314
 
           line = 'HIGH' THEN reduce
315
 
        ELSE IF
316
 
           line = 'LOW' THEN increase
317
 
        ELSE IF
318
 
           line = 'END' THEN
319
 
          BEGIN
320
 
            WHILE powerlevel[NumPowers] = level DO NumPowers := NumPowers-1;
321
 
            level := level-1;
322
 
          END
323
 
        ELSE IF
324
 
           line = 'WAIT' THEN
325
 
          BEGIN
326
 
            Z := ReActivate;
327
 
            Z := X*240.0 + i*Y*240;
328
 
            ROTATE(ABS(Z))
329
 
          END
330
 
        ELSE IF line = 'HILD' THEN motor(induction)
331
 
        ELSE IF (line = 'REV') THEN        BEGIN
332
 
            v := YellowPhase;
333
 
            IF (NOT(v IN [#14..#240])) THEN
334
 
                WriteLn(' POWER SUPPLY OUT OF SPEC') ELSE specValue := v;
335
 
            specValidate
336
 
        END
337
 
        ELSE IF (line = 'OK') THEN BEGIN
338
 
            IncomingSupply := True; specValidate END
339
 
        ELSE IF (line = 'NOK') THEN BEGIN IncomingSupply := False; specValidate END
340
 
        else    begin
341
 
            GeneratedPowerLine.IncreasePower(
342
 
                          'Unknown input power "%s"', [SwitchPower.Current]);    // CHECK: string should not cause problems
343
 
        end;
344
 
      END;
345
 
 
346
 
 
347
 
end (* AVeryVeryLongFunctionName *) ;  // check that only necessary work is done to align
348
 
 
349
 
 
350
 
FUNCTION f(
351
 
            alf : real;
352
 
            fred : integer;  // should line up with alf
353
 
            bill : boolean;
354
 
            joe: char;
355
 
          );
356
 
VAR s : string;
357
 
BEGIN s := do; WriteLn(s) END;
358
 
 
359
 
 
360
 
procedure getbyte;   // CHECK: cr after this line is **not** indented
361
 
 
362
 
var  // CHECK: cr after this line **is** indented
363
 
    ch : char;
364
 
 
365
 
begin
366
 
 
367
 
   // need to consider:
368
 
   // if c then begin s1; s2 end; // strip these lines
369
 
   // begin   // normal case
370
 
   // end     // normal case
371
 
   // end else if begin // should be OK since /end/ tested last
372
 
   // need to consider ...
373
 
   //                  if c1 then begin s1; s2 end
374
 
   //                  else s3;
375
 
                                        // <-- align this line
376
 
 
377
 
                                        { checking multi line statements }
378
 
 
379
 
 
380
 
    while aaaaaaaaaaaaaaaaaaaaaaa
381
 
            and bbbbbbbbbbb  do
382
 
        if c1 then begin
383
 
            s1;
384
 
            for i := 1
385
 
                  to 10 do
386
 
                s3
387
 
        end;
388
 
    s4;
389
 
    s5; // the ';' here links to the ';' after the 'case' below
390
 
 
391
 
    if c1 then
392
 
        case e01 of
393
 
        111111111:    s1;
394
 
        23:
395
 
            writeln(x,
396
 
                    'fred',
397
 
                    notCaseValue:4,
398
 
                    x);
399
 
 
400
 
        2:
401
 
            case e05 of
402
 
            1: s1;   // CHECK: cr here should go to new case value!
403
 
            88:
404
 
                s3;
405
 
 
406
 
            2:  begin
407
 
                  s2;
408
 
                  s3;
409
 
                end;
410
 
 
411
 
            3:
412
 
                case e09 of
413
 
                1: s1;   // CHECK: cr here should go to new case value!
414
 
                88:
415
 
                    s3;
416
 
 
417
 
                2:
418
 
                    begin
419
 
                      s2;
420
 
                      s3;
421
 
                    end;
422
 
 
423
 
                3: s3;
424
 
                4,5,6..9: s6;
425
 
 
426
 
                otherwise
427
 
                    writeln('lots');
428
 
                    writeln(' and lots');
429
 
                end; {case}
430
 
 
431
 
            4,5,6..9: s6;
432
 
 
433
 
            otherwise
434
 
                writeln('lots');
435
 
                writeln(' and lots');
436
 
            end; {case}
437
 
 
438
 
        4: if e then
439
 
              begin   // CHECK: should be indented after case value
440
 
                s1;
441
 
                s2
442
 
              end
443
 
            else if ee
444
 
                    and ee1
445
 
            then begin
446
 
                s1;
447
 
                s2;
448
 
            end;
449
 
 
450
 
        99: a:= 13;
451
 
        100: if e then s1;
452
 
 
453
 
        333333: if c then
454
 
              begin // CKECK: should indent one level from case value
455
 
                s3; // CHECK: should be indented another level
456
 
                s4
457
 
              end;
458
 
 
459
 
        30:
460
 
            if c then begin // cr here is OK
461
 
                s3;
462
 
                s4
463
 
            end;
464
 
        4: writeln('fred',
465
 
                   notCaseValue:4,
466
 
                   x
467
 
                  );
468
 
        s4;             // incorrect code, indenter should expect a case value here
469
 
        88:
470
 
            if c1 then
471
 
              begin
472
 
                s6;
473
 
                s7
474
 
            else
475
 
                s8
476
 
              end;     // stress test: else/end crossed over !!
477
 
        end; {case}
478
 
    s6;
479
 
 
480
 
    a := 1;
481
 
    a := 2;
482
 
    a := 3;
483
 
    if c1
484
 
            and c2 then begin // can be aligned manually
485
 
        a := 12;             // should be indented one level from if statement
486
 
        f(x)
487
 
    end;
488
 
    if c1
489
 
            and c2  // can be aligned manually
490
 
    then
491
 
      begin
492
 
        a := 12;             // should be indented one level from if statement
493
 
        f(x)
494
 
      end;
495
 
    if c then
496
 
        if c then
497
 
            if c then
498
 
                repeat s1 until c
499
 
            else
500
 
                a[    i,
501
 
                      j,
502
 
                      zzzzzzzzzz[ a,
503
 
                                  b
504
 
                                ],
505
 
                      vvvvv   // CHECK: indent lines with zzzzzzzzz
506
 
                 ] := x
507
 
                      + 10;
508
 
    if a then
509
 
        if b then
510
 
            if c then begin
511
 
                s1;
512
 
                s2;
513
 
            end; {if}
514
 
    while z do s1;
515
 
 
516
 
 
517
 
    while not (  ((currchar.value = '*') and (nextchar.value = ')'))
518
 
                 or (currchar.value = '}') // args should line up inside parens
519
 
                 or (nextchar.name = endofline)
520
 
                 or ( sym^.length >= maxsymbolsize-2 )
521
 
                 or (nextchar.name = filemark)) do
522
 
        storenextchar(sym^.length,sym^.value);  // should be indented from while
523
 
 
524
 
    while not (currchar.value = '*') and (nextchar.value = ')')
525
 
          or (currchar.value = '}')           // possible to realign first line manually
526
 
          or (nextchar.name = endofline)      // CHECK: other lines should follow first line  // CHECK:: indents line up
527
 
          or ( sym^.length >= maxsymbolsize-2 )
528
 
          or (nextchar.name = filemark) do
529
 
        storenextchar(sym^.length,sym^.value);  // should be indented from while
530
 
 
531
 
    while not (currchar.value = '*') and (nextchar.value = ')')
532
 
          or (currchar.value = '}')           // possible to realign first line manually
533
 
          or (nextchar.name = endofline)      // CHECK: other lines should follow first line  // CHECK:: indents line up
534
 
          or ( sym^.length >= maxsymbolsize-2 )
535
 
          or (nextchar.name = filemark)
536
 
    do
537
 
        storenextchar(sym^.length,sym^.value);  // should be indented from while
538
 
 
539
 
    dblchar[becomes] := ':=';
540
 
    dblchar[opencomment] := '(*';  // not start of comment!
541
 
    sglchar[semicolon] := ';';
542
 
    sglchar[colon]     := ':';
543
 
    sglchar[equals]    := '=';
544
 
    sglchar[openparen] := '(';
545
 
    sglchar[closeparen] := ')';
546
 
    sglchar[period]    := '.';
547
 
    sglchar[opencomment] := '{';
548
 
    sglchar[closecomment] := '}';
549
 
 
550
 
    with nextchar do
551
 
        if eof(infile) then
552
 
          begin
553
 
            name := filemark;
554
 
            if ch in ['0'..'9'] then
555
 
                name := digit
556
 
            else if ch = '''' then begin
557
 
                name := quote
558
 
            end else if (ch = blank) or (ch = chr(tab)) then
559
 
                name := space
560
 
            else name := otherchar
561
 
                value := blank
562
 
          end
563
 
        else if eoln(infile) then
564
 
          begin
565
 
            name := endofline;
566
 
            value := blank;
567
 
            if c1 then begin s1; s2 end
568
 
            else s7;
569
 
            inlines := inlines + 1;
570
 
            readln(infile)
571
 
          end
572
 
        else
573
 
          begin
574
 
            read(infile,ch);
575
 
            value := ch;
576
 
            if ch in ['a'..'z','A'..'Z','_'] then
577
 
                name := letter
578
 
            else
579
 
                if ch in ['0'..'9'] then
580
 
                    name := digit
581
 
                else if ch = '''' then while c do
582
 
                  begin
583
 
                    s1;
584
 
                    name := quote
585
 
                  end;
586
 
                else if (ch = blank) or (ch = chr(tab)) then
587
 
                    name := space
588
 
                else name := otherchar
589
 
          end;
590
 
 
591
 
          { CHECK:
592
 
                    # pp lines go to start of line, unless they are in a comment
593
 
          }
594
 
 
595
 
#if
596
 
#endif
597
 
    cccccc; // CHECK: this aligns with code
598
 
# // CHECK: preprocessor lines go to start of line
599
 
 
600
 
    if c1 then
601
 
        if c2 then while c do
602
 
            s
603
 
        else
604
 
            s2;
605
 
    s3;
606
 
    s4;
607
 
 
608
 
end; { getbyte }
609
 
 
610
 
 
611
 
function f1( var z: integer;
612
 
             var p,q : real;
613
 
             t : boolean           ) : integer; // indentation should line up
614
 
 
615
 
type   tArray = array[0..17] of real;
616
 
 
617
 
    r= record a: integer; c: char; end;
618
 
 
619
 
    // nested variant record - too hard to get right. tough
620
 
    MyRec = Record
621
 
                X : Longint;
622
 
                Case byte of
623
 
                1,2,8 : (Y : Longint;
624
 
                         case byte of
625
 
                         3 : (Z : Longint);   // CHECK: parens inside parens aligned correctly
626
 
                        );
627
 
            end;
628
 
 
629
 
    commands = (    crsupp,crbefore,blinbefore,
630
 
                    dindonkey,dindent,spbef,
631
 
                    spaft,gobsym,
632
 
                    inbytab,   { indent current margin (was indent from symbol pos) }
633
 
                    crafter,
634
 
                    finl            { force symbol to follow on same line as previous symbol }
635
 
               );
636
 
 
637
 
    tR = record
638
 
             i: integer;  // should indent after record
639
 
             r: real;
640
 
             a: array[1..11] of char;
641
 
 
642
 
             case boolean of
643
 
             true:( a: int);
644
 
             dontKnow:
645
 
                 (z: real;
646
 
                  fred : real;       // should be indented after case value
647
 
                  joe  : integer;
648
 
                 );
649
 
             false:
650
 
                 (  ted : array[
651
 
                                   1..16
652
 
                               ] of boolean;
653
 
                    moe: char; // should align to ''ted''
654
 
                 );
655
 
         end; // end of case + end of record
656
 
 
657
 
    commandset = set of commands;       // should be aligned to 'record', not 'case'
658
 
 
659
 
begin { f1 }
660
 
    case currsym^.name of
661
 
 
662
 
       { for procs, etc just record that we have one, wait for name }
663
 
    progsym, procsym, funcsym: begin
664
 
          symbol_seen := procsym;
665
 
          proc_state := proc_header;
666
 
          annotate_push( procsym );
667
 
        end;
668
 
    s1;                   // coding error, a case value should be here
669
 
       { remember we are in the declaraions part }
670
 
    varsym, typesym, constsym, labelsym:
671
 
        proc_state := proc_declarations;
672
 
 
673
 
        { if it's a proc, there will be no begin/end ==> pop info we just saved
674
 
        if it's an external var ==> do nothing  }
675
 
    forwardsym, externalsym:
676
 
        if proc_state = proc_header then
677
 
          begin
678
 
            sym := annotate_pop;
679
 
            tok := annotate_pop_tok;
680
 
            if annotate_trace in traceFlags then
681
 
                writeln( 'undo ', tok.val:tok.len );
682
 
          end;
683
 
 
684
 
          { if a proc has just occurred, this is its name
685
 
          otherwise, remember it, just in case it's a record name }
686
 
    othersym:
687
 
        begin
688
 
          if symbol_seen = procsym then begin
689
 
              tok.val := currsym^.value;
690
 
              tok.len := currsym^.length;
691
 
              annotate_push_tok( tok );
692
 
              symbol_seen := othersym;
693
 
          end
694
 
          else begin
695
 
              annotate_temp_tok.val := currsym^.value;
696
 
              annotate_temp_tok.len := currsym^.length;
697
 
          end;
698
 
        end;
699
 
 
700
 
        { we have the name, push it so the end symbol can get it back }
701
 
    recordsym: begin
702
 
          annotate_push_tok(annotate_temp_tok);
703
 
          annotate_push( recordsym );
704
 
          symbol_seen := recordsym;
705
 
        end;
706
 
 
707
 
        { we must remember these so they can pushed if the begin symbol occurs }
708
 
    ifsym, forsym, whilesym, withsym:
709
 
        begin
710
 
          symbol_seen := currsym^.name;
711
 
        end;
712
 
 
713
 
        { this is the second part of an if statement }
714
 
    elsesym:
715
 
        symbol_seen := ifsym;
716
 
 
717
 
        { if in a declaration ==> ignore
718
 
        if in a statement (assume case statement) ==> prepare for possible begin following }
719
 
    colon:
720
 
        if proc_state = proc_statements then
721
 
            symbol_seen := colon;
722
 
 
723
 
         { reset symbol_seen }
724
 
    semicolon:
725
 
        symbol_seen := semicolon;
726
 
 
727
 
        { could be the begin of a proc
728
 
        ==> get value, leaving it for the corresponding end symbol
729
 
        or it could be part of an if, etc,
730
 
        ==> push the symbol so the end symbol knows what to do  }
731
 
    beginsym: begin
732
 
          proc_state := proc_statements;
733
 
          if symbol_seen in [ifsym, forsym, whilesym, withsym, elsesym, colon] then begin
734
 
              annotate_push( symbol_seen );
735
 
          end
736
 
          else begin
737
 
              sym := annotate_peek;
738
 
              if sym = procsym then begin
739
 
                 { this is a proc begin, add annotation }
740
 
                  annotate_pending_tok := true;
741
 
                  annotate_temp_tok := annotate_peek_tok;
742
 
              end
743
 
              else
744
 
                begin
745
 
                  if annotate_trace in traceFlags then
746
 
                      writeln( infilename,' line ', inlines, ': orphaned begin found' );
747
 
                  annotate_push( nosymbol );
748
 
                end
749
 
          end;
750
 
        end;
751
 
 
752
 
        { push the symbol so the end symbol can get it back }
753
 
    casesym: annotate_push( casesym );
754
 
 
755
 
       { end of proc, end of record  ==> pop name
756
 
       end of if, etc statement    ==> pop symbol
757
 
       end of case item (colon)    ==> ignore
758
 
       end of record ==> check if named record  }
759
 
    endsym:
760
 
        begin
761
 
          symbol_seen := endsym;
762
 
          sym := annotate_pop;
763
 
          if sym = recordsym then begin
764
 
              annotate_temp_tok := annotate_pop_tok;
765
 
              if annotate_temp_tok.val[1] in ['A'..'Z','a'..'z'] then
766
 
                  annotate_pending_tok := true;
767
 
          end
768
 
          else if sym = procsym then
769
 
            begin
770
 
              annotate_pending_tok := true;
771
 
              annotate_temp_tok := annotate_pop_tok;
772
 
            end
773
 
          else if sym = ifsym then begin
774
 
             { if there's an else part, don't do an annotation here }
775
 
              if nextsym^.name <> elsesym then
776
 
                begin
777
 
                  annotate_pending := true;
778
 
                  annotate_temp := sym;
779
 
                end
780
 
          end
781
 
          else if sym in [forsym, whilesym, withsym, casesym] then begin
782
 
              annotate_pending := true;
783
 
              annotate_temp := sym;
784
 
          end
785
 
          else if sym = colon then
786
 
            begin
787
 
              if annotate_trace in traceFlags then
788
 
                  writeln( 'case item not annotated' );
789
 
            end
790
 
          else begin
791
 
              if annotate_trace in traceFlags then
792
 
                  writeln( infilename,' line: ', inlines, ' end symbol found but not handled' );
793
 
          end;
794
 
        end;
795
 
    end; { case }
796
 
 
797
 
    if annotate_pending then begin
798
 
        if nextsym^.crsbefore > 0 then
799
 
          begin
800
 
            { rest of line is empty }
801
 
            insert_annotation(annotate_temp);
802
 
            annotate_pending := false;
803
 
          end else if nextsym^.name in [opencomment,
804
 
                                        closecomment] then
805
 
            begin
806
 
                                          { there's another comment already on the same line }
807
 
              if annotate_trace in traceFlags then
808
 
                  writeln( infilename,' line: ', inlines, ' annotate ', keyword[annotate_temp], ' abandoned' );
809
 
              annotate_pending := false;
810
 
            end
811
 
        else if (nextsym^.name <> semicolon) then begin
812
 
            insert_annotation(annotate_temp);
813
 
            annotate_pending := false;
814
 
        end;
815
 
    end;
816
 
 
817
 
    if annotate_pending_tok then
818
 
      begin
819
 
        if nextsym^.crsbefore > 0 then begin
820
 
           { rest of line is empty }
821
 
            insert_annotation_tok( annotate_temp_tok );
822
 
            annotate_pending_tok := false;
823
 
        end
824
 
        else if nextsym^.name in [opencomment, closecomment] then begin
825
 
           { there's another comment already on the same line }
826
 
            if annotate_trace in traceFlags then
827
 
                writeln( infilename,
828
 
                         ' line: ', inlines,
829
 
                         ' annotate ', annotate_temp_tok.val:annotate_temp_tok.len, ' abandoned'
830
 
                       );
831
 
            annotate_pending_tok := false;
832
 
        end
833
 
        else if not (nextsym^.name in [semicolon, period]) then begin
834
 
            insert_annotation_tok( annotate_temp_tok );
835
 
            annotate_pending_tok := false;
836
 
        end;
837
 
      end;
838
 
end; { f1 }
839
 
 
840
 
 
841
 
function f2( p: boolean;
842
 
             var q: real;
843
 
             var x: ttype;              // should line up with first param
844
 
             var c: char;
845
 
 
846
 
             var i1, i2: integer;
847
 
 
848
 
             ch: char;
849
 
             z: boolean
850
 
           ) : real;
851
 
 
852
 
var
853
 
    a: integer;
854
 
    b: boolean;
855
 
 
856
 
begin { f2 }
857
 
 
858
 
    with floodlePtr^ do
859
 
      begin name := '        '; id := nil; next := nil; floodleAddr := 0;
860
 
        cow := grass + floodle  // should be indented
861
 
      end;
862
 
 
863
 
    case e of
864
 
    1: s1;   // CHECK: cr here should go to new case value!
865
 
    88:
866
 
        s3;
867
 
 
868
 
    2:  begin
869
 
          s2;
870
 
          s3;
871
 
        end;
872
 
 
873
 
    3: s3;
874
 
    4,5,6..9: s6;
875
 
 
876
 
    otherwise
877
 
        writeln('lots');
878
 
        writeln(' and lots');
879
 
    end; {case}
880
 
 
881
 
    if c then begin
882
 
        s1;
883
 
        a := func( 12,
884
 
                   fffff( 89,
885
 
                          t
886
 
                        ),
887
 
                   a // should align with '12'
888
 
                 );
889
 
    end; // this must be aligned to the 'if' statement
890
 
 
891
 
 
892
 
    fredzarmplezzzzzzzzzzzz(       arg1,
893
 
                                   arg1,
894
 
                                   arg2,
895
 
                                   arg3
896
 
                           );
897
 
 
898
 
    x := f(a) + f(b);
899
 
 
900
 
 
901
 
    if (e111) + e2 then fffffffffffff(    func0(  func1(    func2( f3(       arg1,
902
 
 
903
 
 
904
 
                                                                             arg2,
905
 
                                                                             arg3,
906
 
                                                                             arg4
907
 
                                                                     ),
908
 
 
909
 
 
910
 
                                                                   a1,  // should be aligned with arg f3, not '('
911
 
                                                                   a2,
912
 
                                                                   a3,
913
 
                                                                   a4
914
 
                                                                 ),
915
 
 
916
 
                                                            aa2,
917
 
                                                            aa3,
918
 
                                                            aa4,
919
 
                                                            aa5
920
 
                                                       ),
921
 
                                                  bb1,
922
 
                                                  bb2,
923
 
                                                  bb3,
924
 
                                                  bb4
925
 
                                               ),
926
 
                                          cc1,
927
 
                                          cc2,
928
 
                                          cc3,
929
 
                                          cc4
930
 
                                     )
931
 
    else if c1 then begin
932
 
        s1;
933
 
    end;
934
 
 
935
 
    nextStmt := 13;
936
 
 
937
 
    while c1 do
938
 
        if q then
939
 
            s1
940
 
        else if qq then
941
 
          begin
942
 
            s2;
943
 
            s3
944
 
          end;
945
 
 
946
 
 
947
 
    if c1
948
 
            and c2 then begin // this can be aligned manually
949
 
        a := 12;
950
 
        s1;
951
 
        f(x)
952
 
    end;
953
 
 
954
 
    if c1
955
 
            and c2
956
 
    then begin
957
 
        a := 12;
958
 
        s1;
959
 
        f(x)
960
 
    end;
961
 
 
962
 
    if c1
963
 
            and c2 then
964
 
      begin
965
 
        a := 12;
966
 
        s1;
967
 
        f(x)
968
 
      end;
969
 
 
970
 
    if c1
971
 
            and c2
972
 
    then
973
 
      begin
974
 
        a := 12;
975
 
        s1;
976
 
        f(x)
977
 
      end;
978
 
 
979
 
    if cc1 then
980
 
        while c2 do
981
 
            f(x);
982
 
 
983
 
    while c1 do f(  arg1,
984
 
                    arg2  // this should line up with arg1
985
 
                 );
986
 
 
987
 
    if c4 then f( arg1,
988
 
                  arg2
989
 
                );
990
 
 
991
 
    f1        ( arg1,
992
 
                arg2
993
 
              );
994
 
    fred      (  arg1,
995
 
                 arg2
996
 
                 arg3
997
 
                 arg4,
998
 
 
999
 
                 arg5
1000
 
              );
1001
 
 
1002
 
    ff( arg1,
1003
 
        arg2
1004
 
      );
1005
 
 
1006
 
    a[1] := 13;
1007
 
    repeat
1008
 
        s1;
1009
 
        while c3 do begin
1010
 
            s3;
1011
 
            while c2 do
1012
 
              begin
1013
 
                s4;
1014
 
                while c4 do begin
1015
 
                    if c3 then
1016
 
                      begin
1017
 
                        s1;
1018
 
                        s2;
1019
 
                      end else
1020
 
                          s3;
1021
 
                    if c3 then begin
1022
 
                        s1
1023
 
                    end else
1024
 
 
1025
 
                        if a then b
1026
 
                        else
1027
 
                            if c then d
1028
 
                            else
1029
 
 
1030
 
                                s2;
1031
 
                    if c3 then
1032
 
                        if c4 then
1033
 
                            s5;
1034
 
 
1035
 
                    s3
1036
 
                end;
1037
 
              end
1038
 
        end
1039
 
    until c3;
1040
 
 
1041
 
 
1042
 
    s5;
1043
 
 
1044
 
    s3;
1045
 
    while c7 do begin
1046
 
        s3;
1047
 
        s4
1048
 
    end;
1049
 
 
1050
 
    s4
1051
 
end;
1052
 
 
1053
 
s2
1054
 
until c1;  // there is no matching repeat here
1055
 
 
1056
 
end;  { f2 }
1057
 
 
1058
 
 
1059
 
begin {main program }
1060
 
 
1061
 
    if f1 > 0 then result := f1-1
1062
 
    else begin
1063
 
        f1 :=  -23;
1064
 
    end;
1065
 
 
1066
 
    case e012 of
1067
 
    2:
1068
 
        if eeeeeeeeeeeeeeeeee
1069
 
                or e33333333333
1070
 
        then
1071
 
            a := 12
1072
 
        else
1073
 
            for iiiiiiiiiii := 12
1074
 
                            to 89 // CHECK 89 lines up with 12
1075
 
            do begin
1076
 
                if very_long_expression
1077
 
                        or another_very_long_expression
1078
 
                        and yet_another_very_long_expression then
1079
 
                    s1;
1080
 
                s11;
1081
 
            end;
1082
 
    1:
1083
 
        if e
1084
 
                +e2
1085
 
                +e3
1086
 
                +e2
1087
 
                or 75  // CHECK: follows first continue line
1088
 
        then
1089
 
            for i := 1
1090
 
                    to 89
1091
 
            do begin
1092
 
                a := 12 + 24
1093
 
                          3 +  // CHECK 3 lines up with 24 above
1094
 
                          19 +
1095
 
                          25;
1096
 
                s1 := e1
1097
 
                      + e2;
1098
 
            end;
1099
 
    5:
1100
 
        f32verylongfunctionnamezzzzzzzzzzzzzzz(
1101
 
                               z, // user can realign this anywhere
1102
 
                               a,b, // this should line up with 'z'''
1103
 
                               c,
1104
 
                               d,
1105
 
                               e
1106
 
                               );
1107
 
 
1108
 
    3: begin
1109
 
          s0;
1110
 
          s3;        // bad code, 'end' is missing
1111
 
          //end;            // missing end, so next few case values interpreted as labels
1112
 
5:
1113
 
          if q then z;
1114
 
 
1115
 
          s3;              // code error - case value belongs here, not statement
1116
 
5:
1117
 
          if c2 then s2;
1118
 
 
1119
 
16:
1120
 
          if c2 then
1121
 
              s1;
1122
 
17:
1123
 
          if c2 then begin s1; s2 end;
1124
 
 
1125
 
4:
1126
 
          if a then begin
1127
 
              s2;
1128
 
              s3 // no trailing semi, but it indents
1129
 
          end;
1130
 
        end; { ** bad code ** }   // crossed begin/end - matches '3: begin' above
1131
 
 
1132
 
 
1133
 
    2: s2;
1134
 
    3: while c4
1135
 
            and e3  do // CHECK: should indent beyond while
1136
 
            s8;
1137
 
    1: s1;
1138
 
    {
1139
 
    23:
1140
 
    }
1141
 
    23: s1;
1142
 
    s2:
1143
 
        begin
1144
 
          s2
1145
 
          s3 // no trailing semi in line above, but it indents correctly
1146
 
        end;         // need ';' to force alignment with new case value
1147
 
    otherwise if a then b;
1148
 
        if c0 then  begin
1149
 
            if c1 then begin
1150
 
            // it does!!
1151
 
                if c3 then
1152
 
                    write(              // CHECK: deeply nested levels of parens
1153
 
                          f(5.5),
1154
 
                          'test',   // should be aligned
1155
 
                          notCaseValue:4,
1156
 
                          f1(8,8),
1157
 
                          ff( a,
1158
 
                              b( f(13),
1159
 
                                 12,
1160
 
                                 x
1161
 
                               ),
1162
 
                              c( g(55) ),
1163
 
 
1164
 
                            ));
1165
 
 
1166
 
            end else  // statement unfinished
1167
 
    otherwise       // duplicate eotherwise
1168
 
        if a then begin
1169
 
            b
1170
 
        end else if a1 then begin
1171
 
            c;
1172
 
            c;
1173
 
            if a
1174
 
                    and a1 then
1175
 
                b
1176
 
            else
1177
 
                c;   { CHECK: outdents only when 'c' is followed by ';' }
1178
 
            if a then begin
1179
 
                b;
1180
 
                b1;
1181
 
            end else
1182
 
                s3;
1183
 
            if a then b else c;
1184
 
            if a then
1185
 
                b
1186
 
            else
1187
 
                c;
1188
 
            if a then b
1189
 
            else f( arg,
1190
 
                    arg2,
1191
 
                    a1,
1192
 
                    a2
1193
 
                    # this is a pp line!!     // bug! silly place to put a pp line
1194
 
                    f( a,
1195
 
                       b
1196
 
                     ));
1197
 
 
1198
 
            if a then
1199
 
                b
1200
 
            else if c1 then
1201
 
                s1;
1202
 
            if c2 then begin
1203
 
                s33;
1204
 
                s34
1205
 
            end;    { !!! classic error, shouldn't be a semi colon here }
1206
 
            else if c3 then begin
1207
 
                s44;
1208
 
                s45
1209
 
            end else begin
1210
 
                s;
1211
 
                s;
1212
 
            end
1213
 
 
1214
 
        end else if c1 then begin // comment
1215
 
            s3
1216
 
        end;
1217
 
 
1218
 
        while c3 do
1219
 
            s4;
1220
 
        end;     // spurious end
1221
 
 
1222
 
        s0;
1223
 
        s1;
1224
 
        s2;
1225
 
        s3;
1226
 
    end // case e012 of
1227
 
    else if c2 then begin  // spurious else
1228
 
 
1229
 
        ss;
1230
 
 
1231
 
        if c1 then begin
1232
 
            write( 'test',
1233
 
                   notCaseValue:4
1234
 
                 )
1235
 
        end else      // this else has no statement
1236
 
    end    else begin { should still be in sync }
1237
 
 
1238
 
        s1;
1239
 
 
1240
 
        s1;
1241
 
 
1242
 
 
1243
 
 
1244
 
        s2
1245
 
    end;
1246
 
 
1247
 
    f(   a,
1248
 
         b,
1249
 
     )
1250
 
 
1251
 
     ff(  a,
1252
 
          b,
1253
 
          c
1254
 
       )
1255
 
       ))
1256
 
 
1257
 
       writeln( 'this is a string ', n:1, ' ', ' ', r:10:2 );
1258
 
 
1259
 
    with p do
1260
 
      begin
1261
 
 
1262
 
      end;
1263
 
 
1264
 
    with p065 do
1265
 
      begin
1266
 
        x := 2;
1267
 
      end;
1268
 
    case e07 of
1269
 
    0:
1270
 
    1:  s1;
1271
 
    2:  begin
1272
 
          s2;
1273
 
          s3;
1274
 
        end;
1275
 
    3: s3;
1276
 
    12:
1277
 
 
1278
 
    15:
1279
 
    4,5,6..9: begin s1; end;
1280
 
    otherwise
1281
 
        s6;
1282
 
 
1283
 
 
1284
 
        s3;
1285
 
        s1;
1286
 
 
1287
 
        s2;
1288
 
 
1289
 
        while e and
1290
 
                e2 DO begin { comment }
1291
 
            s0;
1292
 
            s33;
1293
 
            s44;
1294
 
        end;
1295
 
 
1296
 
        if e97 then begin
1297
 
            s3;
1298
 
label:
1299
 
            while c103 do begin
1300
 
                s4;
1301
 
                q := 0;
1302
 
                case e of
1303
 
                12,13..16,20: begin
1304
 
                      s2;
1305
 
                      s3;
1306
 
                    end;
1307
 
                8: writeln( 'test',
1308
 
                            x,
1309
 
                            r:4
1310
 
                          );
1311
 
                9:
1312
 
 
1313
 
                end;
1314
 
                while c1
1315
 
                   and c2 do begin
1316
 
                    s5;
1317
 
                    s9;
1318
 
                end;
1319
 
 
1320
 
                s;
1321
 
                s;
1322
 
                s1;
1323
 
                if e105 then
1324
 
                    if c2 then begin
1325
 
 
1326
 
                        s3;
1327
 
                    end; // if
1328
 
 
1329
 
                case e11 of
1330
 
                2..4,5: begin
1331
 
                      s1;
1332
 
                      s2
1333
 
                    end;
1334
 
 
1335
 
 
1336
 
                3: a:= 13;
1337
 
 
1338
 
 
1339
 
                89:
1340
 
 
1341
 
                    case e12 of
1342
 
                    2,3:
1343
 
                        a:=13;
1344
 
                    2: begin
1345
 
                          a:= 13
1346
 
                        end;
1347
 
                    5,6,
1348
 
                    7:
1349
 
                    otherwise
1350
 
 
1351
 
                        s3;
1352
 
                        s4;
1353
 
                    end;  // case e12 of
1354
 
 
1355
 
                otherwise
1356
 
 
1357
 
 
1358
 
                    s4;
1359
 
                    s5;
1360
 
                    if c2 then
1361
 
                        s5
1362
 
                end; // case e11 of
1363
 
 
1364
 
                s3;
1365
 
 
1366
 
            end; // while c103
1367
 
 
1368
 
        end; // if e97
1369
 
 
1370
 
        repeat
1371
 
            s3;
1372
 
            s4;
1373
 
        until c1;
1374
 
 
1375
 
        s0;
1376
 
        s1;
1377
 
 
1378
 
        if e then begin
1379
 
            s3;
1380
 
            s4;
1381
 
            s0;
1382
 
 
1383
 
            s1;
1384
 
 
1385
 
            s1;
1386
 
            s1;
1387
 
        end;
1388
 
 
1389
 
        repeat
1390
 
            ss;
1391
 
            s2;
1392
 
            if e then
1393
 
                ss;
1394
 
            s3;
1395
 
            s1;
1396
 
        until e;
1397
 
 
1398
 
        if e then begin
1399
 
            s1;
1400
 
            s3;
1401
 
            if e then begin
1402
 
                s3;
1403
 
                s5;
1404
 
            end;
1405
 
            s6;
1406
 
            s2;
1407
 
        end;
1408
 
 
1409
 
 
1410
 
        of:=2; // more bad code
1411
 
 
1412
 
        repeat
1413
 
            s1
1414
 
        until c;
1415
 
 
1416
 
 
1417
 
        a := 123456789;
1418
 
        IF (e1) or  (* comment *)
1419
 
                (e2)  then
1420
 
 
1421
 
          begin // CHECK: the begin should follow 'if' line, not 'then' line
1422
 
 
1423
 
            if e then begin s end
1424
 
            else begin
1425
 
                s1;
1426
 
                s2;
1427
 
            end;
1428
 
 
1429
 
            if e then
1430
 
                s0;
1431
 
            if e then begin
1432
 
                s1;
1433
 
                s2;       (  // unattached parens
1434
 
 
1435
 
                          )
1436
 
                          s;  // problem caused by unattached parens
1437
 
            end
1438
 
            123456
1439
 
            { comment }
1440
 
 
1441
 
            if e4 then
1442
 
                while e5 do begin
1443
 
                (* ...
1444
 
                 *  CHECK: stars should line up
1445
 
                 *
1446
 
                 *
1447
 
                 *)
1448
 
                    (aa)
1449
 
                    if a then b;   (* qwe
1450
 
                                    *rty *)
1451
 
                        cc;
1452
 
                    s;
1453
 
                    // comment
1454
 
 
1455
 
                end;
1456
 
 
1457
 
 
1458
 
            f( a, b)
1459
 
 
1460
 
            case e of
1461
 
            12,13: a:=12;
1462
 
            1,2,3,4..6: writeln(
1463
 
                                   a, 'TODO:', b );
1464
 
 
1465
 
            567:
1466
 
                s2;
1467
 
 
1468
 
            88: writeln( 'zzzzzzzzzz',
1469
 
                         a:12,
1470
 
                         b
1471
 
                       );
1472
 
            99: writeln(
1473
 
                           z:13,
1474
 
                           b
1475
 
                       );
1476
 
            13: begin
1477
 
            // no statement
1478
 
                end;
1479
 
 
1480
 
 
1481
 
 
1482
 
            0: f( a,
1483
 
                  b
1484
 
                );
1485
 
            12: ff (  a,
1486
 
                      b
1487
 
                   );
1488
 
            (13+12): f( a,
1489
 
                        37,508.18
1490
 
                      );
1491
 
 
1492
 
 
1493
 
 
1494
 
            2: if a = 12 then
1495
 
                    s1;
1496
 
                else begin
1497
 
                    s2;
1498
 
                end;
1499
 
 
1500
 
            0: writeln( 'zzzzzzzzz',
1501
 
 
1502
 
                        a:3,
1503
 
                        b:4,
1504
 
                        'xxxxxxxxxx'
1505
 
 
1506
 
                      );
1507
 
 
1508
 
            1: s1;
1509
 
            3:
1510
 
 
1511
 
 
1512
 
 
1513
 
            2: begin
1514
 
 
1515
 
                  s1;
1516
 
                  s2;
1517
 
                  s3;
1518
 
                end;
1519
 
 
1520
 
            5 :
1521
 
                writeln( 'this is ',
1522
 
                         'multiline arg list'
1523
 
                       );
1524
 
 
1525
 
 
1526
 
 
1527
 
 
1528
 
            5:
1529
 
            6:
1530
 
                s1;
1531
 
 
1532
 
            9:
1533
 
                c := 13;
1534
 
 
1535
 
            c2,3,4..7: begin
1536
 
 
1537
 
                  s4;
1538
 
                  sl;
1539
 
                  a := 13;
1540
 
 
1541
 
label:  // this is a label, not case value
1542
 
                  cc;
1543
 
 
1544
 
                  b := 17;
1545
 
 
1546
 
                  writeln( 'strrrrrr', a:4 );
1547
 
 
1548
 
                end;
1549
 
            c9 :
1550
 
                s1;
1551
 
 
1552
 
            end; { case e of }
1553
 
                        // comment
1554
 
            ff(   a,      // this line aligns with 'end'
1555
 
                  b,     // CHECK: keep relative indent
1556
 
                  c
1557
 
              )
1558
 
              ;
1559
 
 
1560
 
          end;  // begin CHECK:
1561
 
 
1562
 
ggggg:
1563
 
 
1564
 
 
1565
 
        f(
1566
 
             a,
1567
 
             b,
1568
 
             c
1569
 
         );
1570
 
 
1571
 
 
1572
 
        writeln( a,
1573
 
 
1574
 
                 b,
1575
 
 
1576
 
                 b,    { check indent after cr here }
1577
 
               );
1578
 
 
1579
 
        f(13);
1580
 
    end; // case e07
1581
 
 
1582
 
end. // main