Warning, /frameworks/ktexteditor/autotests/input/indent/pascal/longtest4/expected is written in an unsupported language. File is not indexed.
0001 // kate: space-indent on; indent-width 4; replace-tabs on; remove-trailing-spaces all; 0002 // kate: syntax pascal; indent-mode pascal; 0003 0004 // these variables are understood by the pascal indenter ... 0005 // kate: cfgIndentCase false; // indent elements in a case statement 0006 // kate: cfgIndentBegin 0; // indent 'begin' this many spaces 0007 // kate: debugMode false; // show how indent is determined 0008 // kate: cfgAutoInsertStar true; // auto insert '*' in (* ... *)-comments 0009 // kate: cfgSnapParen true; // snap '* )' to '*)' in comments 0010 0011 begin {main program } 0012 0013 if f1 > 0 then result := f1-1 0014 else begin 0015 f1 := -23; 0016 end; 0017 0018 case e012 of 0019 2: 0020 if eeeeeeeeeeeeeeeeee 0021 or e33333333333 0022 then 0023 a := 12 0024 else 0025 for iiiiiiiiiii := 12 0026 to 89 // CHECK 89 lines up with 12 0027 do begin 0028 if very_long_expression 0029 or another_very_long_expression 0030 and yet_another_very_long_expression then 0031 s1; 0032 s11; 0033 end; 0034 1: 0035 if e 0036 +e2 0037 +e3 0038 +e2 0039 or 75 // CHECK: follows first continue line 0040 then 0041 for i := 1 0042 to 89 0043 do begin 0044 a := 12 + 24 0045 3 + // CHECK 3 lines up with 24 above 0046 19 + 0047 25; 0048 s1 := e1 0049 + e2; 0050 end; 0051 5: 0052 f32verylongfunctionnamezzzzzzzzzzzzzzz( 0053 z, // user can realign this anywhere 0054 a,b, // this should line up with 'z''' 0055 c, 0056 d, 0057 e 0058 ); 0059 0060 3: begin 0061 s0; 0062 s3; // bad code, 'end' is missing 0063 //end; // missing end, so next few case values interpreted as labels 0064 5: 0065 if q then z; 0066 0067 s3; // code error - case value belongs here, not statement 0068 5: 0069 if c2 then s2; 0070 0071 16: 0072 if c2 then 0073 s1; 0074 17: 0075 if c2 then begin s1; s2 end; 0076 0077 4: 0078 if a then begin 0079 s2; 0080 s3 // no trailing semi, but it indents 0081 end; 0082 end; { ** bad code ** } // crossed begin/end - matches '3: begin' above 0083 0084 0085 2: s2; 0086 3: while c4 0087 and e3 do // CHECK: should indent beyond while 0088 s8; 0089 1: s1; 0090 { 0091 23: 0092 } 0093 23: s1; 0094 s2: 0095 begin 0096 s2 0097 s3 // no trailing semi in line above, but it indents correctly 0098 end; // need ';' to force alignment with new case value 0099 otherwise if a then b; 0100 if c0 then begin 0101 if c1 then begin 0102 // it does!! 0103 if c3 then 0104 write( // CHECK: deeply nested levels of parens 0105 f(5.5), 0106 'test', // should be aligned 0107 notCaseValue:4, 0108 f1(8,8), 0109 ff( a, 0110 b( f(13), 0111 12, 0112 x 0113 ), 0114 c( g(55) ), 0115 0116 )); 0117 0118 end else // statement unfinished 0119 otherwise // duplicate eotherwise 0120 if a then begin 0121 b 0122 end else if a1 then begin 0123 c; 0124 c; 0125 if a 0126 and a1 then 0127 b 0128 else 0129 c; { CHECK: outdents only when 'c' is followed by ';' } 0130 if a then begin 0131 b; 0132 b1; 0133 end else 0134 s3; 0135 if a then b else c; 0136 if a then 0137 b 0138 else 0139 c; 0140 if a then b 0141 else f( arg, 0142 arg2, 0143 a1, 0144 a2 0145 # this is a pp line!! // bug! silly place to put a pp line 0146 f( a, 0147 b 0148 )); 0149 0150 if a then 0151 b 0152 else if c1 then 0153 s1; 0154 if c2 then begin 0155 s33; 0156 s34 0157 end; { !!! classic error, shouldn't be a semi colon here } 0158 else if c3 then begin 0159 s44; 0160 s45 0161 end else begin 0162 s; 0163 s; 0164 end 0165 0166 end else if c1 then begin // comment 0167 s3 0168 end; 0169 0170 while c3 do 0171 s4; 0172 end; // spurious end 0173 0174 s0; 0175 s1; 0176 s2; 0177 s3; 0178 end // case e012 of 0179 else if c2 then begin // spurious else 0180 0181 ss; 0182 0183 if c1 then begin 0184 write( 'test', 0185 notCaseValue:4 0186 ) 0187 end else // this else has no statement 0188 end else begin { should still be in sync } 0189 0190 s1; 0191 0192 s1; 0193 0194 0195 0196 s2 0197 end; 0198 0199 f( a, 0200 b, 0201 ) 0202 0203 ff( a, 0204 b, 0205 c 0206 ) 0207 )) 0208 0209 writeln( 'this is a string ', n:1, ' ', ' ', r:10:2 ); 0210 0211 with p do 0212 begin 0213 0214 end; 0215 0216 with p065 do 0217 begin 0218 x := 2; 0219 end; 0220 case e07 of 0221 0: 0222 1: s1; 0223 2: begin 0224 s2; 0225 s3; 0226 end; 0227 3: s3; 0228 12: 0229 0230 15: 0231 4,5,6..9: begin s1; end; 0232 otherwise 0233 s6; 0234 0235 0236 s3; 0237 s1; 0238 0239 s2; 0240 0241 while e and 0242 e2 DO begin { comment } 0243 s0; 0244 s33; 0245 s44; 0246 end; 0247 0248 if e97 then begin 0249 s3; 0250 label: 0251 while c103 do begin 0252 s4; 0253 q := 0; 0254 case e of 0255 12,13..16,20: begin 0256 s2; 0257 s3; 0258 end; 0259 8: writeln( 'test', 0260 x, 0261 r:4 0262 ); 0263 9: 0264 0265 end; 0266 while c1 0267 and c2 do begin 0268 s5; 0269 s9; 0270 end; 0271 0272 s; 0273 s; 0274 s1; 0275 if e105 then 0276 if c2 then begin 0277 0278 s3; 0279 end; // if 0280 0281 case e11 of 0282 2..4,5: begin 0283 s1; 0284 s2 0285 end; 0286 0287 0288 3: a:= 13; 0289 0290 0291 89: 0292 0293 case e12 of 0294 2,3: 0295 a:=13; 0296 2: begin 0297 a:= 13 0298 end; 0299 5,6, 0300 7: 0301 otherwise 0302 0303 s3; 0304 s4; 0305 end; // case e12 of 0306 0307 otherwise 0308 0309 0310 s4; 0311 s5; 0312 if c2 then 0313 s5 0314 end; // case e11 of 0315 0316 s3; 0317 0318 end; // while c103 0319 0320 end; // if e97 0321 0322 repeat 0323 s3; 0324 s4; 0325 until c1; 0326 0327 s0; 0328 s1; 0329 0330 if e then begin 0331 s3; 0332 s4; 0333 s0; 0334 0335 s1; 0336 0337 s1; 0338 s1; 0339 end; 0340 0341 repeat 0342 ss; 0343 s2; 0344 if e then 0345 ss; 0346 s3; 0347 s1; 0348 until e; 0349 0350 if e then begin 0351 s1; 0352 s3; 0353 if e then begin 0354 s3; 0355 s5; 0356 end; 0357 s6; 0358 s2; 0359 end; 0360 0361 0362 of:=2; // more bad code 0363 0364 repeat 0365 s1 0366 until c; 0367 0368 0369 a := 123456789; 0370 IF (e1) or (* comment *) 0371 (e2) then 0372 0373 begin // CHECK: the begin should follow 'if' line, not 'then' line 0374 0375 if e then begin s end 0376 else begin 0377 s1; 0378 s2; 0379 end; 0380 0381 if e then 0382 s0; 0383 if e then begin 0384 s1; 0385 s2; ( // unattached parens 0386 0387 ) 0388 s; // problem caused by unattached parens 0389 end 0390 123456 0391 { comment } 0392 0393 if e4 then 0394 while e5 do begin 0395 (* ... 0396 * CHECK: stars should line up 0397 * 0398 * 0399 *) 0400 (aa) 0401 if a then b; (* qwe 0402 *rty *) 0403 cc; 0404 s; 0405 // comment 0406 0407 end; 0408 0409 0410 f( a, b) 0411 0412 case e of 0413 12,13: a:=12; 0414 1,2,3,4..6: writeln( 0415 a, 'TODO:', b ); 0416 0417 567: 0418 s2; 0419 0420 88: writeln( 'zzzzzzzzzz', 0421 a:12, 0422 b 0423 ); 0424 99: writeln( 0425 z:13, 0426 b 0427 ); 0428 13: begin 0429 // no statement 0430 end; 0431 0432 0433 0434 0: f( a, 0435 b 0436 ); 0437 12: ff ( a, 0438 b 0439 ); 0440 (13+12): f( a, 0441 37,508.18 0442 ); 0443 0444 0445 0446 2: if a = 12 then 0447 s1; 0448 else begin 0449 s2; 0450 end; 0451 0452 0: writeln( 'zzzzzzzzz', 0453 0454 a:3, 0455 b:4, 0456 'xxxxxxxxxx' 0457 0458 ); 0459 0460 1: s1; 0461 3: 0462 0463 0464 0465 2: begin 0466 0467 s1; 0468 s2; 0469 s3; 0470 end; 0471 0472 5 : 0473 writeln( 'this is ', 0474 'multiline arg list' 0475 ); 0476 0477 0478 0479 0480 5: 0481 6: 0482 s1; 0483 0484 9: 0485 c := 13; 0486 0487 c2,3,4..7: begin 0488 0489 s4; 0490 sl; 0491 a := 13; 0492 0493 label: // this is a label, not case value 0494 cc; 0495 0496 b := 17; 0497 0498 writeln( 'strrrrrr', a:4 ); 0499 0500 end; 0501 c9 : 0502 s1; 0503 0504 end; { case e of } 0505 // comment 0506 ff( a, // this line aligns with 'end' 0507 b, // CHECK: keep relative indent 0508 c 0509 ) 0510 ; 0511 0512 end; // begin CHECK: 0513 0514 ggggg: 0515 0516 0517 f( 0518 a, 0519 b, 0520 c 0521 ); 0522 0523 0524 writeln( a, 0525 0526 b, 0527 0528 b, { check indent after cr here } 0529 ); 0530 0531 f(13); 0532 end; // case e07 0533 0534 end. // main