~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// kate: space-indent on; indent-width 3; replace-tabs on; remove-trailing-spaces all;
2
 
// kate: syntax pascal; indent-mode pascal;
3
 
 
4
 
(**********************************************   // check: indent OK?
5
 
 *                                            *
6
 
 *       Commment to test alignment           *
7
 
 *                                            *
8
 
 *                                            *
9
 
 **********************************************)
10
 
 
11
 
 (*************************************************************************
12
 
 Another Comment
13
 
 
14
 
 Relative alignment should be kept ...
15
 
       After indent, first character of this line should
16
 
       still remain under the 'v' in relative
17
 
 
18
 
 *************************************************************************)
19
 
 
20
 
program fred;
21
 
 
22
 
uses bbb;
23
 
 
24
 
label fred001;
25
 
var   i: integer;
26
 
 
27
 
const const0 = 0;
28
 
   c33 = 12;
29
 
   const1 = 17;
30
 
   const2 = 18.4;
31
 
 
32
 
type x = record a: real; c : char end;
33
 
 
34
 
   // r = record ... vs unfinished typedef
35
 
   rType = record  // cr here ==> type def
36
 
              a: aType;       // this can be realigned manually
37
 
              b: bType;       // should follow line above
38
 
              c: cType
39
 
           end;
40
 
 
41
 
   colourType =
42
 
      { unfinished type declaration }
43
 
      ( red,    // CHECK: everything should line up below this
44
 
        orange, // this must follow line above
45
 
        green,
46
 
        blue,
47
 
        indigo,
48
 
        yellow,
49
 
        violet
50
 
        // CHECK: the comments should line up as well
51
 
        // closing paren should align to list when it's left shifted
52
 
        //                            to opening paren otherwise
53
 
      );
54
 
 
55
 
   otherTypeDef = integer;
56
 
 
57
 
// CHECK: next line should keep its relative alignment
58
 
         {next}
59
 
   ant = RECORD CASE F: BOOLEAN OF
60
 
                   TRUE: ( fred : REAL;
61
 
                           joe  : INTEGER;
62
 
                         );  // parens should line up
63
 
                   FALSE: (  ted : ARRAY[
64
 
                                           1..16
65
 
                                        ] OF BOOLEAN;
66
 
                             moe: CHAR;
67
 
                          );
68
 
                END; // 'case' + 'record' share same 'end'
69
 
 
70
 
 
71
 
 
72
 
var a: real;
73
 
 
74
 
   RW:  ARRAY [AASY..ZZSY]
75
 
           OF   (*RESERVED WORDS*)   PACKED ARRAY [1..RWLENGTH,
76
 
                                                   2..66 ]     // CHECK: this line should be indented
77
 
                                               OF CHAR;    // CHECK: this line should be indented from array
78
 
 
79
 
   RW:  ARRAY [AASY..ZZSY] OF   (*RESERVED WORDS*)
80
 
           PACKED ARRAY [1..RWLENGTH] OF CHAR;
81
 
 
82
 
var
83
 
   sym : keysymbol;
84
 
   pos : hashIndex;
85
 
   len : charLenType;
86
 
 
87
 
 
88
 
type tR = record
89
 
             i: integer;   // CHECK: can be aligned manually, but default indented from record
90
 
             r: real;      // should align with line immediately above
91
 
             a: array[1..11] of char;
92
 
 
93
 
             case boolean of
94
 
                true: ( fred : real;
95
 
                        joe  : integer;
96
 
                      );  // parens should line up
97
 
                false: (  ted : array[
98
 
                                        1..16
99
 
                                     ] of boolean;
100
 
                          moe: char;
101
 
                       );
102
 
          end; // 'case' + 'record' share same 'end'
103
 
 
104
 
   tArray = array[0..17] of real; // should indent wrt 'type'
105
 
 
106
 
type    colourType = (
107
 
              red,    // CHECK: this line can be adjusted manually
108
 
              orange, // this must follow line above
109
 
              green,
110
 
              blue,
111
 
              indigo,
112
 
              yellow,
113
 
              violet
114
 
              // CHECK: the comments should line up as well
115
 
              // closing paren should align to list when it's left shifted
116
 
              //                            to opening paren otherwise
117
 
              );
118
 
 
119
 
   blah = char;  // should align after type
120
 
 
121
 
   optionset = set of options;
122
 
 
123
 
var
124
 
   r1: record
125
 
          i:    integer;
126
 
          r:    real;                   // should line up with first member
127
 
          a:    array[0..7] of char;
128
 
       end;  // CHECK: end is outdented relative to first member
129
 
 
130
 
   optionset : set of options;
131
 
 
132
 
   options : (    crsupp,crbefore,blinbefore,
133
 
                  dindonkey,dindent,spbef,
134
 
                  spaft,gobsym,
135
 
                  inbytab,   { indent current margin (was indent from symbol pos) }
136
 
                  crafter,
137
 
                  finl            { force symbol to follow on same line as previous symbol }
138
 
             );
139
 
 
140
 
   optionset = set of options;
141
 
 
142
 
   aa: array[   1..9, // should be indented after cr
143
 
                3..22 ]
144
 
          of ( crsupp,crbefore,blinbefore,
145
 
               dindonkey,dindent,spbef,
146
 
               spaft,gobsym,
147
 
               inbytab,   { indent current margin (was indent from symbol pos) }
148
 
               crafter,
149
 
               finl            { force symbol to follow on same line as previous symbol }
150
 
             );
151
 
 
152
 
   aaa: array[ 1..3,
153
 
               4..5,
154
 
               12..11 ]
155
 
           of record // cr after here should indent from record
156
 
                 a: array[1..6] of char;
157
 
                 i: integer;
158
 
              end;
159
 
 
160
 
               { CHECK: following text should keep indent relative to open/close brace
161
 
                        when annotating, behavior of "external", "end" and possibly other keywords
162
 
                        depends on whether we are in procedure declaration,
163
 
                        item (var/const/type) declaration, or statements
164
 
               }
165
 
 
166
 
 
167
 
procedure AVeryVeryLongFunctionName(const A : tRealArrayType;
168
 
                                    N : tIntegerType;
169
 
                                    var H : tRealArrayType); forward;
170
 
 
171
 
(*************************************************************************
172
 
CHECK:   comment is correctly aligned with precedinging statement
173
 
 
174
 
Input parameters:
175
 
A       -   description
176
 
 
177
 
N       -   longer description, but
178
 
            still preserving relative format
179
 
 
180
 
Output parameters:
181
 
H       - other meaningful description
182
 
 
183
 
Result:
184
 
   True, if successful
185
 
   False, otherwise
186
 
*************************************************************************)
187
 
 
188
 
var size : (small, medium, large);
189
 
   fred : real;
190
 
 
191
 
var   r : record i: integer; c: char end;
192
 
 
193
 
   a: array[ 1..9,    // should be indented after var
194
 
             'a'..'z'        // non-code, should line up with opening arg
195
 
           ] of integer;
196
 
 
197
 
begin (* AVeryVeryLongFunctionName *)
198
 
 
199
 
   if a then begin
200
 
      s1;
201
 
16:
202
 
      f(32);  //CHECK: label forced to margin, statement is on new line with comment
203
 
   end;
204
 
 
205
 
   for i := 0 to 100 do
206
 
   begin
207
 
      with p^ do
208
 
         begin s1; s2; s3 end
209
 
   end;
210
 
 
211
 
   with p^ do
212
 
      begin s1; s2; s3 end;
213
 
 
214
 
   for i := firstCh to lastCh do chtype[chr(i)] := none;
215
 
   value['0'] := 0; value['1'] := 1; value['2'] := 2;
216
 
   value['3'] := 3; value['4'] := 4; value['5'] := 5;
217
 
   value['6'] := 6; value['7'] := 7; value['8'] := 8;
218
 
   value['9'] := 9;
219
 
   value['A'] := 10; value['B'] := 11; value['C'] := 12;
220
 
   value['D'] := 13; value['E'] := 14; value['F'] := 15;
221
 
   value['a'] := 10; value['b'] := 11; value['c'] := 12;
222
 
   value['d'] := 13; value['e'] := 14; value['f'] := 15;
223
 
 
224
 
   IF NOT (CH IN ['{','}']) THEN
225
 
   // comment
226
 
   BEGIN  IF CH <= 'Z' THEN CMDCH := CH ELSE CMDCH := CHR(ORD(CH)-ORD('a')+ORD('A') );
227
 
      NEXTCH;
228
 
      IF CMDCH = 'L' THEN
229
 
         COMMAND(LISTON)
230
 
      ELSE IF CMDCH = 'T' THEN
231
 
         COMMAND(TRACEON)
232
 
      ELSE IF CMDCH = 'I' THEN
233
 
         COMMAND(INCLUDE)
234
 
      ELSE IF CMDCH = 'Z' THEN
235
 
         REPEAT
236
 
            BEGIN
237
 
               www.fred.com;
238
 
               REPEAT commandIn UNTIL numRem = 0;
239
 
               s1;
240
 
               s2;
241
 
            END;
242
 
         UNTIL False
243
 
      ELSE IF CMDCH = 'Q' THEN begin
244
 
         COMMAND(QUIET)
245
 
      end ELSE IF CMDCH = 'V' THEN
246
 
         COMMAND(VERBOSE)
247
 
      else if COMMAND.STRVAL = 'unknown' then
248
 
      begin
249
 
         IF
250
 
               (numStr[0] >= 0) AND
251
 
               (numStr[1] IN ['+', '-', '0' .. '9', '?']) // CHECK: indent
252
 
         THEN
253
 
            Power.Supply := '"AC' ELSE Power.Supply := '"DC'
254
 
      end else  if CommandResult.Str = 'helpIamLost' then begin
255
 
         Power.Supply := SetPowerSupplyCommands(Plus15V.Increase(Amps));
256
 
      end else if (line = 'SHORT') OR (line = 'OPEN') THEN  BEGIN
257
 
         OpenCircuit;
258
 
         {*smoke billows out*}
259
 
         IF SPARKS THEN
260
 
         BEGIN
261
 
            SPARKS := FALSE;
262
 
            ShutDown
263
 
         END
264
 
      END ELSE IF
265
 
         (line = 'OPEN') OR (line = 'CLOSED') THEN
266
 
      BEGIN;
267
 
         AddFuse(Low);
268
 
         IF SPARKS THEN
269
 
         BEGIN;
270
 
            SPARKS := False;
271
 
            CircuitBreaker(wishfulThinking)
272
 
         END else if cond then
273
 
            statement;
274
 
      END ELSE IF (line = 'PLUS') OR (line = 'MINUS') THEN Transform(RedPhase)
275
 
      ELSE IF (line = 'RED') OR (line = 'BLACK') THEN Transform(BluePhase)
276
 
      ELSE IF line = 'XX' THEN Transistor
277
 
      ELSE IF line = 'YYYY' THEN SetCurrent(FiveAmps)
278
 
      ELSE IF line = 'QQQQ' THEN SetPower(FiveWatts)
279
 
      ELSE IF line = 'AAAAA' THEN Power(FiveAmps)
280
 
      ELSE IF
281
 
         {* QWERTY COMMENT LLLLLLLLL ####### *}
282
 
         line = 'SSSSS' THEN
283
 
      BEGIN
284
 
         actualphase := YellowPhase;
285
 
         AdjustLinePhase(NewPhase);
286
 
      END
287
 
      ELSE IF
288
 
            line = 'Noisy' THEN Filter
289
 
      ELSE IF line = 'BLUE' THEN
290
 
      BEGIN
291
 
         AdjustLinePhase(XPhase);
292
 
         Erase := True
293
 
      END ELSE IF
294
 
         line = 'RED' THEN BEGIN Swap; Hope END
295
 
      ELSE IF
296
 
         line = '415' THEN iNumPut415
297
 
      ELSE IF
298
 
         // a statement like this has no chance of being correctly indented ...
299
 
         // otoh, it shouldn't turn out catastrophically wrong.
300
 
         line = 'REFL' THEN FOR i := 1 TO numLines DO
301
 
                                     WriteLn('level=', powerLevel[i], ' ', name[i]+'='+power[i])
302
 
      ELSE IF
303
 
         line = 'HIGH' THEN reduce
304
 
      ELSE IF
305
 
         line = 'LOW' THEN increase
306
 
      ELSE IF
307
 
         line = 'END' THEN
308
 
      BEGIN
309
 
         WHILE powerlevel[NumPowers] = level DO NumPowers := NumPowers-1;
310
 
         level := level-1;
311
 
      END
312
 
      ELSE IF
313
 
         line = 'WAIT' THEN
314
 
      BEGIN
315
 
         Z := ReActivate;
316
 
         Z := X*240.0 + i*Y*240;
317
 
         ROTATE(ABS(Z))
318
 
      END
319
 
      ELSE IF line = 'HILD' THEN motor(induction)
320
 
      ELSE IF (line = 'REV') THEN        BEGIN
321
 
         v := YellowPhase;
322
 
         IF (NOT(v IN [#14..#240])) THEN
323
 
            WriteLn(' POWER SUPPLY OUT OF SPEC') ELSE specValue := v;
324
 
         specValidate
325
 
      END
326
 
      ELSE IF (line = 'OK') THEN BEGIN
327
 
         IncomingSupply := True; specValidate END
328
 
      ELSE IF (line = 'NOK') THEN BEGIN IncomingSupply := False; specValidate END
329
 
      else    begin
330
 
         GeneratedPowerLine.IncreasePower(
331
 
                       'Unknown input power "%s"', [SwitchPower.Current]);    // CHECK: string should not cause problems
332
 
      end;
333
 
   END;
334
 
 
335
 
 
336
 
end (* AVeryVeryLongFunctionName *) ;  // check that only necessary work is done to align