829
|
1 /* start of AUTO matically checked vim: set ts=4 : */
|
7
|
2 {
|
|
3 if (test)
|
|
4 cmd1;
|
|
5 cmd2;
|
|
6 }
|
|
7
|
|
8 {
|
|
9 if (test)
|
|
10 cmd1;
|
|
11 else
|
|
12 cmd2;
|
|
13 }
|
|
14
|
|
15 {
|
|
16 if (test)
|
|
17 {
|
|
18 cmd1;
|
|
19 cmd2;
|
|
20 }
|
|
21 }
|
|
22
|
|
23 {
|
|
24 if (test)
|
|
25 {
|
|
26 cmd1;
|
|
27 else
|
|
28 }
|
|
29 }
|
|
30
|
|
31 {
|
|
32 while (this)
|
|
33 if (test)
|
|
34 cmd1;
|
|
35 cmd2;
|
|
36 }
|
|
37
|
|
38 {
|
|
39 while (this)
|
|
40 if (test)
|
|
41 cmd1;
|
|
42 else
|
|
43 cmd2;
|
|
44 }
|
|
45
|
|
46 {
|
|
47 if (test)
|
|
48 {
|
|
49 cmd;
|
|
50 }
|
|
51
|
|
52 if (test)
|
|
53 cmd;
|
|
54 }
|
|
55
|
|
56 {
|
|
57 if (test) {
|
|
58 cmd;
|
|
59 }
|
|
60
|
|
61 if (test) cmd;
|
|
62 }
|
|
63
|
|
64 {
|
|
65 cmd1;
|
|
66 for (blah)
|
|
67 while (this)
|
|
68 if (test)
|
|
69 cmd2;
|
|
70 cmd3;
|
|
71 }
|
|
72
|
|
73 {
|
|
74 cmd1;
|
|
75 for (blah)
|
|
76 while (this)
|
|
77 if (test)
|
|
78 cmd2;
|
|
79 cmd3;
|
|
80
|
|
81 if (test)
|
|
82 {
|
|
83 cmd1;
|
|
84 cmd2;
|
|
85 cmd3;
|
|
86 }
|
|
87 }
|
|
88
|
|
89
|
|
90 /* Test for 'cindent' do/while mixed with if/else: */
|
|
91
|
|
92 {
|
|
93 do
|
|
94 if (asdf)
|
|
95 asdfasd;
|
|
96 while (cond);
|
|
97
|
|
98 do
|
|
99 if (asdf)
|
|
100 while (asdf)
|
|
101 asdf;
|
|
102 while (asdf);
|
|
103 }
|
|
104
|
|
105 /* Test for 'cindent' with two ) on a continuation line */
|
|
106 {
|
|
107 if (asdfasdf;asldkfj asdlkfj as;ldkfj sal;d
|
|
108 aal;sdkjf ( ;asldfkja;sldfk
|
|
109 al;sdjfka ;slkdf ) sa;ldkjfsa dlk;)
|
|
110 line up here;
|
|
111 }
|
|
112
|
|
113
|
|
114 /* C++ tests: */
|
|
115
|
|
116 // foo() these three lines should remain in column 0
|
|
117 // {
|
|
118 // }
|
|
119
|
|
120 /* Test for continuation and unterminated lines: */
|
|
121 {
|
|
122 i = 99 + 14325 +
|
|
123 21345 +
|
|
124 21345 +
|
|
125 21345 + ( 21345 +
|
|
126 21345) +
|
|
127 2345 +
|
|
128 1234;
|
|
129 c = 1;
|
|
130 }
|
|
131
|
|
132 /*
|
|
133 testje for indent with empty line
|
|
134
|
|
135 here */
|
|
136
|
|
137 {
|
|
138 if (testing &&
|
|
139 not a joke ||
|
|
140 line up here)
|
|
141 hay;
|
|
142 if (testing &&
|
|
143 (not a joke || testing
|
|
144 )line up here)
|
|
145 hay;
|
|
146 if (testing &&
|
|
147 (not a joke || testing
|
|
148 line up here))
|
|
149 hay;
|
|
150 }
|
|
151
|
|
152
|
|
153 {
|
|
154 switch (c)
|
|
155 {
|
|
156 case xx:
|
|
157 do
|
|
158 if (asdf)
|
|
159 do
|
|
160 asdfasdf;
|
|
161 while (asdf);
|
|
162 else
|
|
163 asdfasdf;
|
|
164 while (cond);
|
|
165 case yy:
|
|
166 case xx:
|
|
167 case zz:
|
|
168 testing;
|
|
169 }
|
|
170 }
|
|
171
|
|
172 {
|
|
173 if (cond) {
|
|
174 foo;
|
|
175 }
|
|
176 else
|
|
177 {
|
|
178 bar;
|
|
179 }
|
|
180 }
|
|
181
|
|
182 {
|
|
183 if (alskdfj ;alsdkfjal;skdjf (;sadlkfsa ;dlkf j;alksdfj ;alskdjf
|
|
184 alsdkfj (asldk;fj
|
|
185 awith cino=(0 ;lf this one goes to below the paren with ==
|
|
186 ;laksjfd ;lsakdjf ;alskdf asd)
|
|
187 asdfasdf;)))
|
|
188 asdfasdf;
|
|
189 }
|
|
190
|
|
191 int
|
|
192 func(a, b)
|
|
193 int a;
|
|
194 int c;
|
|
195 {
|
|
196 if (c1 && (c2 ||
|
|
197 c3))
|
|
198 foo;
|
|
199 if (c1 &&
|
|
200 (c2 || c3)
|
|
201 )
|
|
202 }
|
|
203
|
|
204 {
|
|
205 while (asd)
|
|
206 {
|
|
207 if (asdf)
|
|
208 if (test)
|
|
209 if (that)
|
|
210 {
|
|
211 if (asdf)
|
|
212 do
|
|
213 cdasd;
|
|
214 while (as
|
|
215 df);
|
|
216 }
|
|
217 else
|
|
218 if (asdf)
|
|
219 asdf;
|
|
220 else
|
|
221 asdf;
|
|
222 asdf;
|
|
223 }
|
|
224 }
|
|
225
|
|
226 {
|
|
227 s = "/*"; b = ';'
|
|
228 s = "/*"; b = ';';
|
|
229 a = b;
|
|
230 }
|
|
231
|
|
232 {
|
|
233 switch (a)
|
|
234 {
|
|
235 case a:
|
|
236 switch (t)
|
|
237 {
|
|
238 case 1:
|
|
239 cmd;
|
|
240 break;
|
|
241 case 2:
|
|
242 cmd;
|
|
243 break;
|
|
244 }
|
|
245 cmd;
|
|
246 break;
|
|
247 case b:
|
|
248 {
|
|
249 int i;
|
|
250 cmd;
|
|
251 }
|
|
252 break;
|
|
253 case c: {
|
|
254 int i;
|
|
255 cmd;
|
|
256 }
|
|
257 case d: if (cond &&
|
|
258 test) { /* this line doesn't work right */
|
|
259 int i;
|
|
260 cmd;
|
|
261 }
|
|
262 break;
|
|
263 }
|
|
264 }
|
|
265
|
|
266 {
|
|
267 if (!(vim_strchr(p_cpo, CPO_BUFOPTGLOB) != NULL && entering) &&
|
|
268 (bp_to->b_p_initialized ||
|
|
269 (!entering && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))
|
|
270 return;
|
|
271 label :
|
|
272 asdf = asdf ?
|
|
273 asdf : asdf;
|
|
274 asdf = asdf ?
|
|
275 asdf: asdf;
|
|
276 }
|
|
277
|
|
278 /* Special Comments : This function has the added complexity (compared */
|
|
279 /* : to addtolist) of having to check for a detail */
|
|
280 /* : texture and add that to the list first. */
|
|
281
|
|
282 char *(array[100]) = {
|
|
283 "testje",
|
|
284 "foo",
|
|
285 "bar",
|
|
286 }
|
|
287
|
|
288 enum soppie
|
|
289 {
|
|
290 yes = 0,
|
|
291 no,
|
|
292 maybe
|
|
293 };
|
|
294
|
|
295 typedef enum soppie
|
|
296 {
|
|
297 yes = 0,
|
|
298 no,
|
|
299 maybe
|
|
300 };
|
|
301
|
3218
|
302 static enum
|
|
303 {
|
|
304 yes = 0,
|
|
305 no,
|
|
306 maybe
|
|
307 } soppie;
|
|
308
|
4187
|
309 public static enum
|
|
310 {
|
|
311 yes = 0,
|
|
312 no,
|
|
313 maybe
|
|
314 } soppie;
|
|
315
|
|
316 static private enum
|
|
317 {
|
|
318 yes = 0,
|
|
319 no,
|
|
320 maybe
|
|
321 } soppie;
|
|
322
|
7
|
323 {
|
|
324 int a,
|
|
325 b;
|
|
326 }
|
|
327
|
|
328 {
|
|
329 struct Type
|
|
330 {
|
|
331 int i;
|
|
332 char *str;
|
|
333 } var[] =
|
|
334 {
|
|
335 0, "zero",
|
|
336 1, "one",
|
|
337 2, "two",
|
|
338 3, "three"
|
|
339 };
|
|
340
|
|
341 float matrix[3][3] =
|
|
342 {
|
|
343 {
|
|
344 0,
|
|
345 1,
|
|
346 2
|
|
347 },
|
|
348 {
|
|
349 3,
|
|
350 4,
|
|
351 5
|
|
352 },
|
|
353 {
|
|
354 6,
|
|
355 7,
|
|
356 8
|
|
357 }
|
|
358 };
|
|
359 }
|
|
360
|
|
361 {
|
|
362 /* blah ( blah */
|
|
363 /* where does this go? */
|
|
364
|
|
365 /* blah ( blah */
|
|
366 cmd;
|
|
367
|
|
368 func(arg1,
|
|
369 /* comment */
|
|
370 arg2);
|
|
371 a;
|
|
372 {
|
|
373 b;
|
|
374 {
|
|
375 c; /* Hey, NOW it indents?! */
|
|
376 }
|
|
377 }
|
|
378
|
|
379 {
|
|
380 func(arg1,
|
|
381 arg2,
|
|
382 arg3);
|
|
383 /* Hey, what am I doing here? Is this coz of the ","? */
|
|
384 }
|
|
385 }
|
|
386
|
|
387 main ()
|
|
388 {
|
|
389 if (cond)
|
|
390 {
|
|
391 a = b;
|
|
392 }
|
|
393 if (cond) {
|
|
394 a = c;
|
|
395 }
|
|
396 if (cond)
|
|
397 a = d;
|
|
398 return;
|
|
399 }
|
|
400
|
|
401 {
|
|
402 case 2: if (asdf &&
|
|
403 asdfasdf)
|
|
404 aasdf;
|
|
405 a = 9;
|
|
406 case 3: if (asdf)
|
|
407 aasdf;
|
|
408 a = 9;
|
|
409 case 4: x = 1;
|
|
410 y = 2;
|
|
411
|
|
412 label: if (asdf)
|
|
413 here;
|
|
414
|
|
415 label: if (asdf &&
|
|
416 asdfasdf)
|
|
417 {
|
|
418 }
|
|
419
|
|
420 label: if (asdf &&
|
|
421 asdfasdf) {
|
|
422 there;
|
|
423 }
|
|
424
|
|
425 label: if (asdf &&
|
|
426 asdfasdf)
|
|
427 there;
|
|
428 }
|
|
429
|
|
430 {
|
|
431 /*
|
|
432 hello with ":set comments= cino=c5"
|
|
433 */
|
|
434
|
|
435 /*
|
|
436 hello with ":set comments= cino="
|
|
437 */
|
|
438 }
|
|
439
|
|
440
|
|
441 {
|
|
442 if (a < b) {
|
|
443 a = a + 1;
|
|
444 } else
|
|
445 a = a + 2;
|
|
446
|
|
447 if (a)
|
|
448 do {
|
|
449 testing;
|
|
450 } while (asdfasdf);
|
|
451 a = b + 1;
|
|
452 asdfasdf
|
|
453 }
|
|
454
|
|
455 class bob
|
|
456 {
|
|
457 int foo() {return 1;}
|
|
458 int bar;
|
|
459 }
|
|
460
|
|
461 main()
|
|
462 {
|
|
463 while(1)
|
|
464 if (foo)
|
|
465 {
|
|
466 bar;
|
|
467 }
|
|
468 else {
|
|
469 asdf;
|
|
470 }
|
|
471 misplacedline;
|
|
472 }
|
|
473
|
|
474 {
|
|
475 if (clipboard.state == SELECT_DONE
|
|
476 && ((row == clipboard.start.lnum
|
|
477 && col >= clipboard.start.col)
|
|
478 || row > clipboard.start.lnum))
|
|
479 }
|
|
480
|
|
481 {
|
|
482 if (1) {i += 4;}
|
|
483 where_am_i;
|
|
484 return 0;
|
|
485 }
|
|
486
|
|
487 {
|
|
488 {
|
|
489 } // sdf(asdf
|
|
490 if (asdf)
|
|
491 asd;
|
|
492 }
|
|
493
|
|
494 {
|
|
495 label1:
|
|
496 label2:
|
|
497 }
|
|
498
|
|
499 {
|
|
500 int fooRet = foo(pBar1, false /*fKB*/,
|
|
501 true /*fPTB*/, 3 /*nT*/, false /*fDF*/);
|
|
502 f() {
|
|
503 for ( i = 0;
|
|
504 i < m;
|
|
505 /* c */ i++ ) {
|
|
506 a = b;
|
|
507 }
|
|
508 }
|
|
509 }
|
|
510
|
|
511 {
|
|
512 f1(/*comment*/);
|
|
513 f2();
|
|
514 }
|
|
515
|
|
516 {
|
|
517 do {
|
|
518 if (foo) {
|
|
519 } else
|
|
520 ;
|
|
521 } while (foo);
|
|
522 foo(); // was wrong
|
|
523 }
|
|
524
|
|
525 int x; // no extra indent because of the ;
|
|
526 void func()
|
|
527 {
|
|
528 }
|
|
529
|
|
530 char *tab[] = {"aaa",
|
|
531 "};", /* }; */ NULL}
|
|
532 int indented;
|
|
533 {}
|
|
534
|
|
535 char *a[] = {"aaa", "bbb",
|
|
536 "ccc", NULL};
|
|
537 // here
|
|
538
|
|
539 char *tab[] = {"aaa",
|
|
540 "xx", /* xx */}; /* asdf */
|
|
541 int not_indented;
|
|
542
|
|
543 {
|
|
544 do {
|
|
545 switch (bla)
|
|
546 {
|
|
547 case 1: if (foo)
|
|
548 bar;
|
|
549 }
|
|
550 } while (boo);
|
|
551 wrong;
|
|
552 }
|
|
553
|
|
554 int foo,
|
|
555 bar;
|
|
556 int foo;
|
|
557
|
|
558 #if defined(foo) \
|
|
559 && defined(bar)
|
|
560 char * xx = "asdf\
|
|
561 foo\
|
|
562 bor";
|
|
563 int x;
|
|
564
|
|
565 char *foo = "asdf\
|
|
566 asdf\
|
|
567 asdf",
|
|
568 *bar;
|
|
569
|
|
570 void f()
|
|
571 {
|
|
572 #if defined(foo) \
|
|
573 && defined(bar)
|
|
574 char *foo = "asdf\
|
|
575 asdf\
|
|
576 asdf",
|
|
577 *bar;
|
|
578 {
|
|
579 int i;
|
|
580 char *foo = "asdf\
|
|
581 asdf\
|
|
582 asdf",
|
|
583 *bar;
|
|
584 }
|
|
585 #endif
|
|
586 }
|
|
587 #endif
|
|
588
|
|
589 int y; // comment
|
|
590 // comment
|
|
591
|
|
592 // comment
|
|
593
|
|
594 {
|
|
595 Constructor(int a,
|
|
596 int b ) : BaseClass(a)
|
|
597 {
|
|
598 }
|
|
599 }
|
|
600
|
|
601 void foo()
|
|
602 {
|
|
603 char one,
|
|
604 two;
|
|
605 struct bla piet,
|
|
606 jan;
|
|
607 enum foo kees,
|
|
608 jannie;
|
|
609 static unsigned sdf,
|
|
610 krap;
|
|
611 unsigned int piet,
|
|
612 jan;
|
|
613 int
|
|
614 kees,
|
|
615 jan;
|
|
616 }
|
|
617
|
|
618 {
|
|
619 t(int f,
|
|
620 int d); // )
|
|
621 d();
|
|
622 }
|
|
623
|
|
624 Constructor::Constructor(int a,
|
|
625 int b
|
|
626 ) :
|
|
627 BaseClass(a,
|
|
628 b,
|
|
629 c),
|
|
630 mMember(b),
|
|
631 {
|
|
632 }
|
|
633
|
|
634 Constructor::Constructor(int a,
|
|
635 int b ) :
|
|
636 BaseClass(a)
|
|
637 {
|
|
638 }
|
|
639
|
|
640 Constructor::Constructor(int a,
|
|
641 int b ) /*x*/ : /*x*/ BaseClass(a),
|
828
|
642 member(b)
|
7
|
643 {
|
|
644 }
|
|
645
|
|
646 class CAbc :
|
|
647 public BaseClass1,
|
|
648 protected BaseClass2
|
|
649 {
|
|
650 int Test() { return FALSE; }
|
|
651 int Test1() { return TRUE; }
|
|
652
|
|
653 CAbc(int a, int b ) :
|
|
654 BaseClass(a)
|
|
655 {
|
|
656 switch(xxx)
|
|
657 {
|
|
658 case abc:
|
|
659 asdf();
|
|
660 break;
|
|
661
|
|
662 case 999:
|
|
663 baer();
|
|
664 break;
|
|
665 }
|
|
666 }
|
|
667
|
|
668 public: // <-- this was incoreectly indented before!!
|
|
669 void testfall();
|
|
670 protected:
|
|
671 void testfall();
|
|
672 };
|
|
673
|
|
674 class CAbc : public BaseClass1,
|
828
|
675 protected BaseClass2
|
7
|
676 {
|
|
677 };
|
|
678
|
|
679 static struct
|
|
680 {
|
|
681 int a;
|
|
682 int b;
|
|
683 } variable[COUNT] =
|
|
684 {
|
|
685 {
|
|
686 123,
|
|
687 456
|
|
688 },
|
|
689 {
|
|
690 123,
|
|
691 456
|
|
692 }
|
|
693 };
|
|
694
|
|
695 static struct
|
|
696 {
|
|
697 int a;
|
|
698 int b;
|
|
699 } variable[COUNT] =
|
|
700 {
|
|
701 { 123, 456 },
|
|
702 { 123, 456 }
|
|
703 };
|
|
704
|
|
705 void asdf() /* ind_maxparen may cause trouble here */
|
|
706 {
|
|
707 if ((0
|
|
708 && 1
|
|
709 && 1
|
|
710 && 1
|
|
711 && 1
|
|
712 && 1
|
|
713 && 1
|
|
714 && 1
|
|
715 && 1
|
|
716 && 1
|
|
717 && 1
|
|
718 && 1
|
|
719 && 1
|
|
720 && 1
|
|
721 && 1
|
|
722 && 1
|
|
723 && 1
|
|
724 && 1
|
|
725 && 1
|
|
726 && 1
|
|
727 && 1
|
|
728 && 1
|
|
729 && 1
|
|
730 && 1
|
|
731 && 1
|
|
732 && 1)) break;
|
|
733 }
|
|
734
|
827
|
735 foo()
|
|
736 {
|
|
737 a = cond ? foo() : asdf
|
|
738 + asdf;
|
|
739
|
|
740 a = cond ?
|
|
741 foo() : asdf
|
|
742 + asdf;
|
|
743 }
|
|
744
|
|
745 int main(void)
|
|
746 {
|
|
747 if (a)
|
|
748 if (b)
|
|
749 2;
|
|
750 else 3;
|
|
751 next_line_of_code();
|
|
752 }
|
|
753
|
828
|
754 barry()
|
|
755 {
|
|
756 Foo::Foo (int one,
|
|
757 int two)
|
|
758 : something(4)
|
|
759 {}
|
|
760 }
|
|
761
|
|
762 barry()
|
|
763 {
|
|
764 Foo::Foo (int one, int two)
|
|
765 : something(4)
|
|
766 {}
|
|
767 }
|
|
768
|
|
769 Constructor::Constructor(int a,
|
|
770 int b
|
|
771 ) :
|
|
772 BaseClass(a,
|
|
773 b,
|
|
774 c),
|
|
775 mMember(b)
|
|
776 {
|
|
777 }
|
829
|
778 int main ()
|
|
779 {
|
|
780 if (lala)
|
|
781 do
|
|
782 ++(*lolo);
|
|
783 while (lili
|
|
784 && lele);
|
|
785 lulu;
|
|
786 }
|
828
|
787
|
829
|
788 int main ()
|
|
789 {
|
|
790 switch (c)
|
|
791 {
|
|
792 case 'c': if (cond)
|
|
793 {
|
|
794 }
|
|
795 }
|
|
796 }
|
|
797
|
|
798 main()
|
|
799 {
|
|
800 (void) MyFancyFuasdfadsfnction(
|
|
801 argument);
|
|
802 }
|
|
803
|
|
804 main()
|
|
805 {
|
|
806 char foo[] = "/*";
|
|
807 /* as
|
|
808 df */
|
|
809 hello
|
|
810 }
|
2857
|
811
|
|
812 /* valid namespaces with normal indent */
|
|
813 namespace
|
|
814 {
|
|
815 {
|
|
816 111111111111;
|
|
817 }
|
|
818 }
|
|
819 namespace /* test */
|
|
820 {
|
|
821 11111111111111111;
|
|
822 }
|
|
823 namespace // test
|
|
824 {
|
|
825 111111111111111111;
|
|
826 }
|
|
827 namespace
|
|
828 {
|
|
829 111111111111111111;
|
|
830 }
|
|
831 namespace test
|
|
832 {
|
|
833 111111111111111111;
|
|
834 }
|
|
835 namespace{
|
|
836 111111111111111111;
|
|
837 }
|
|
838 namespace test{
|
|
839 111111111111111111;
|
|
840 }
|
|
841 namespace {
|
|
842 111111111111111111;
|
|
843 }
|
|
844 namespace test {
|
|
845 111111111111111111;
|
|
846 namespace test2 {
|
|
847 22222222222222222;
|
|
848 }
|
|
849 }
|
|
850
|
|
851 /* invalid namespaces use block indent */
|
|
852 namespace test test2 {
|
|
853 111111111111111111111;
|
|
854 }
|
|
855 namespace11111111111 {
|
|
856 111111111111;
|
|
857 }
|
|
858 namespace() {
|
|
859 1111111111111;
|
|
860 }
|
|
861 namespace()
|
|
862 {
|
|
863 111111111111111111;
|
|
864 }
|
|
865 namespace test test2
|
|
866 {
|
|
867 1111111111111111111;
|
|
868 }
|
|
869 namespace111111111
|
|
870 {
|
|
871 111111111111111111;
|
|
872 }
|
|
873
|
7
|
874 /* end of AUTO */
|
|
875
|
|
876
|
|
877 {
|
|
878
|
|
879 /* this is
|
|
880 * a real serious
|
|
881 * about life, the
|
|
882 * universe, and the
|
|
883 * rest important big
|
|
884 * comment
|
|
885 */
|
|
886 /* insert " about life, the universe, and the rest" after "serious" */
|
|
887 }
|
|
888
|
|
889
|
|
890 {
|
|
891 /*
|
|
892 * Testing for comments, without 'cin' set
|
|
893 */
|
|
894 about life
|
|
895
|
|
896 /*
|
|
897 * what happens here?
|
|
898 */
|
|
899 there
|
|
900
|
|
901 /*
|
|
902 the end of the comment, try inserting a line below */
|
|
903 line
|
|
904
|
|
905 /* how about
|
|
906 hello
|
|
907 this one */
|
|
908 }
|
|
909
|
|
910
|
|
911 {
|
|
912 var = this + that + vec[0] * vec[0]
|
|
913 + vec[1] * vec[1]
|
|
914 + vec2[2] * vec[2];
|
|
915 }
|
|
916
|
|
917
|
|
918 {
|
|
919 asdf asdflkajds f;
|
|
920 if (tes & ting) {
|
|
921 asdf asdf asdf ;
|
|
922 asdfa sdf asdf;
|
|
923 }
|
|
924 testing1;
|
|
925 if (tes & ting)
|
|
926 {
|
|
927 asdf asdf asdf ;
|
|
928 asdfa sdf asdf;
|
|
929 }
|
|
930 testing2;
|
|
931 }
|
|
932
|
|
933
|
|
934 main ( int first_par, /*
|
|
935 * Comment for
|
|
936 * first par
|
|
937 */
|
|
938 int second_par /*
|
|
939 * Comment for
|
|
940 * second par
|
|
941 */
|
|
942 )
|
|
943 {
|
|
944 func( first_par, /*
|
|
945 * Comment for
|
|
946 * first par
|
|
947 */
|
|
948 second_par /*
|
|
949 * Comment for
|
|
950 * second par
|
|
951 */
|
|
952 );
|
|
953
|
|
954 }
|
|
955
|
|
956
|
3578
|
957 main(void)
|
|
958 {
|
|
959 /* Make sure that cino=X0s is not parsed like cino=Xs. */
|
|
960 if (cond)
|
|
961 foo();
|
|
962 else
|
|
963 {
|
|
964 bar();
|
|
965 }
|
|
966 }
|
|
967
|
|
968
|
7
|
969 {
|
|
970 do
|
|
971 {
|
|
972 if ()
|
|
973 {
|
|
974 if ()
|
|
975 asdf;
|
|
976 else
|
|
977 asdf;
|
|
978 }
|
|
979 } while ();
|
|
980 cmd; /* this should go under the } */
|
|
981 }
|
|
982
|
|
983
|
|
984 void f()
|
|
985 {
|
|
986 if ( k() ) {
|
|
987 l();
|
|
988
|
|
989 } else { /* Start (two words) end */
|
|
990 m();
|
|
991 }
|
|
992
|
|
993 n();
|
|
994 }
|
|
995
|
|
996
|
|
997 void f()
|
|
998 {
|
|
999 if ( k() )
|
|
1000 {
|
|
1001 l();
|
|
1002 } else { /* Start (two words) end */
|
|
1003 m();
|
|
1004 }
|
|
1005 n(); /* should be under the if () */
|
|
1006 }
|
|
1007
|
|
1008
|
|
1009 void bar(void)
|
|
1010 {
|
|
1011 static array[2][2] =
|
|
1012 {
|
|
1013 { 1, 2 },
|
|
1014 { 3, 4 },
|
|
1015 }
|
|
1016
|
|
1017 while (a)
|
|
1018 {
|
|
1019 foo(&a);
|
|
1020 }
|
|
1021
|
|
1022 {
|
|
1023 int a;
|
|
1024 {
|
|
1025 a = a + 1;
|
|
1026 }
|
|
1027 }
|
|
1028 b = a;
|
|
1029 }
|
|
1030
|
|
1031 void func(void)
|
|
1032 {
|
|
1033 a = 1;
|
|
1034 {
|
|
1035 b = 2;
|
|
1036 }
|
|
1037 c = 3;
|
|
1038 d = 4;
|
|
1039 }
|
|
1040 /* foo */
|
|
1041
|
|
1042
|
|
1043 a()
|
|
1044 {
|
|
1045 do {
|
|
1046 a = a +
|
|
1047 a;
|
|
1048 } while ( a ); /* add text under this line */
|
|
1049 here
|
|
1050 if ( a )
|
|
1051 a;
|
|
1052 }
|
|
1053
|
|
1054
|
|
1055 a()
|
|
1056 {
|
|
1057 label1:
|
|
1058 /* hmm */
|
|
1059 // comment
|
|
1060 label2: b();
|
|
1061 label3 /* post */:
|
|
1062 /* pre */ label4:
|
|
1063 f(/*com*/);
|
|
1064 if (/*com*/)
|
|
1065 cmd();
|
|
1066 }
|
|
1067
|
|
1068
|
|
1069 /*
|
|
1070 * A simple comment
|
|
1071 */
|
|
1072
|
|
1073 /*
|
|
1074 ** A different comment
|
|
1075 */
|
|
1076
|
|
1077
|
|
1078 void f()
|
|
1079 {
|
|
1080
|
|
1081 /*********
|
|
1082 A comment.
|
|
1083 *********/
|
|
1084 }
|
|
1085
|
|
1086
|
|
1087 void f()
|
|
1088 {
|
|
1089
|
|
1090 /*********
|
|
1091 A comment.
|
|
1092 *********/
|
|
1093 }
|
|
1094
|
|
1095
|
|
1096 void f()
|
|
1097 {
|
|
1098 c = c1 &&
|
|
1099 (
|
|
1100 c2 ||
|
|
1101 c3
|
|
1102 ) && c4;
|
|
1103 }
|
|
1104
|
|
1105
|
|
1106 void f()
|
|
1107 {
|
|
1108 c = c1 &&
|
|
1109 (
|
|
1110 c2 ||
|
|
1111 c3
|
|
1112 ) && c4;
|
|
1113 }
|
|
1114
|
|
1115
|
|
1116 void f()
|
|
1117 {
|
|
1118 c = c1 &&
|
|
1119 (
|
|
1120 c2 ||
|
|
1121 c3
|
|
1122 ) && c4;
|
|
1123 }
|
|
1124
|
|
1125
|
|
1126 void f()
|
|
1127 {
|
|
1128 if ( c1
|
|
1129 && ( c2
|
|
1130 || c3))
|
|
1131 foo;
|
|
1132 }
|
|
1133
|
|
1134
|
|
1135 void f()
|
|
1136 {
|
|
1137 if ( c1
|
|
1138 && ( c2
|
|
1139 || c3))
|
|
1140 foo;
|
|
1141 }
|
|
1142
|
|
1143
|
|
1144 void f()
|
|
1145 {
|
|
1146 c = c1 && (
|
|
1147 c2 ||
|
|
1148 c3
|
|
1149 ) && c4;
|
|
1150 if (
|
|
1151 c1 && c2
|
|
1152 )
|
|
1153 foo;
|
|
1154 }
|
|
1155
|
|
1156
|
|
1157 void f()
|
|
1158 {
|
|
1159 c = c1 && (
|
|
1160 c2 ||
|
|
1161 c3
|
|
1162 ) && c4;
|
|
1163 if (
|
|
1164 c1 && c2
|
|
1165 )
|
|
1166 foo;
|
|
1167 }
|
|
1168
|
|
1169
|
|
1170 void f()
|
|
1171 {
|
|
1172 switch (x)
|
|
1173 {
|
|
1174 case 1:
|
|
1175 a = b;
|
|
1176 break;
|
|
1177 default:
|
|
1178 a = 0;
|
|
1179 break;
|
|
1180 }
|
|
1181 }
|
|
1182
|
|
1183
|
|
1184 void f()
|
|
1185 {
|
|
1186 invokeme(
|
|
1187 argu,
|
|
1188 ment);
|
|
1189 invokeme(
|
|
1190 argu,
|
|
1191 ment
|
|
1192 );
|
|
1193 invokeme(argu,
|
|
1194 ment
|
|
1195 );
|
|
1196 }
|
|
1197
|
|
1198
|
|
1199 void f()
|
|
1200 {
|
|
1201 statement;
|
|
1202 // comment 1
|
|
1203 // comment 2
|
|
1204 }
|
|
1205
|
|
1206
|
|
1207 void f()
|
|
1208 {
|
|
1209 statement;
|
|
1210 // comment 1
|
|
1211 // comment 2
|
|
1212 }
|
|
1213
|
|
1214
|
|
1215 class CAbc
|
|
1216 {
|
|
1217 int Test() { return FALSE; }
|
|
1218
|
|
1219 public: // comment
|
|
1220 void testfall();
|
|
1221 protected:
|
|
1222 void testfall();
|
|
1223 };
|
|
1224
|
|
1225
|
3123
|
1226 class Foo : public Bar
|
|
1227 {
|
|
1228 public:
|
|
1229 virtual void method1(void) = 0;
|
|
1230 virtual void method2(int arg1,
|
|
1231 int arg2,
|
|
1232 int arg3) = 0;
|
|
1233 };
|
|
1234
|
|
1235
|
828
|
1236 void
|
|
1237 foo()
|
|
1238 {
|
|
1239 if (a)
|
|
1240 {
|
|
1241 } else
|
|
1242 asdf;
|
|
1243 }
|
|
1244
|
|
1245
|
7
|
1246 {
|
|
1247 averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd(
|
|
1248 asdasdf,
|
|
1249 func(asdf,
|
|
1250 asdfadsf),
|
|
1251 asdfasdf
|
|
1252 );
|
|
1253
|
|
1254 /* those are ugly, but consequent */
|
|
1255
|
|
1256 func()->asd(asdasdf,
|
|
1257 averylongfunctionname(
|
|
1258 abc,
|
|
1259 dec)->averylongfunctionname(
|
|
1260 asdfadsf,
|
|
1261 asdfasdf,
|
|
1262 asdfasdf,
|
|
1263 ),
|
|
1264 func(asdfadf,
|
|
1265 asdfasdf
|
|
1266 ),
|
|
1267 asdasdf
|
|
1268 );
|
|
1269
|
|
1270 averylongfunctionnameaverylongfunctionnameavery()->asd(fasdf(
|
|
1271 abc,
|
|
1272 dec)->asdfasdfasdf(
|
|
1273 asdfadsf,
|
|
1274 asdfasdf,
|
|
1275 asdfasdf,
|
|
1276 ),
|
|
1277 func(asdfadf,
|
|
1278 asdfasdf),
|
|
1279 asdasdf
|
|
1280 );
|
|
1281 }
|
|
1282
|
829
|
1283
|
|
1284 int main ()
|
|
1285 {
|
|
1286 if (cond1 &&
|
|
1287 cond2
|
|
1288 )
|
|
1289 foo;
|
|
1290 }
|
|
1291
|
2776
|
1292
|
|
1293 void func(int a
|
|
1294 #if defined(FOO)
|
|
1295 , int b
|
|
1296 , int c
|
|
1297 #endif
|
|
1298 )
|
|
1299 {
|
|
1300 }
|
|
1301
|
|
1302
|
|
1303 void
|
|
1304 func(int a
|
|
1305 #if defined(FOO)
|
|
1306 , int b
|
|
1307 , int c
|
|
1308 #endif
|
|
1309 )
|
|
1310 {
|
|
1311 }
|
|
1312
|
2805
|
1313
|
|
1314 void func(void)
|
|
1315 {
|
|
1316 if(x==y)
|
|
1317 if(y==z)
|
|
1318 foo=1;
|
|
1319 else { bar=1;
|
|
1320 baz=2;
|
|
1321 }
|
|
1322 printf("Foo!\n");
|
|
1323 }
|
|
1324
|
2843
|
1325 void func1(void)
|
|
1326 {
|
|
1327 char* tab[] = {"foo", "bar",
|
|
1328 "baz", "quux",
|
|
1329 "this line used", "to be indented incorrectly"};
|
|
1330 foo();
|
|
1331 }
|
|
1332
|
|
1333 void func2(void)
|
|
1334 {
|
|
1335 int tab[] =
|
|
1336 {1, 2,
|
|
1337 3, 4,
|
|
1338 5, 6};
|
|
1339
|
|
1340 printf("This line used to be indented incorrectly.\n");
|
|
1341 }
|
|
1342
|
3186
|
1343 int foo[]
|
|
1344 #ifdef BAR
|
|
1345
|
|
1346 = { 1, 2, 3,
|
|
1347 4, 5, 6 }
|
|
1348
|
|
1349 #endif
|
|
1350 ;
|
|
1351 int baz;
|
|
1352
|
2843
|
1353 void func3(void)
|
|
1354 {
|
|
1355 int tab[] = {
|
|
1356 1, 2,
|
|
1357 3, 4,
|
|
1358 5, 6};
|
|
1359
|
3220
|
1360 printf("Don't you dare indent this line incorrectly!\n");
|
|
1361 }
|
|
1362
|
|
1363 void
|
|
1364 func4(a, b,
|
|
1365 c)
|
|
1366 int a;
|
|
1367 int b;
|
|
1368 int c;
|
|
1369 {
|
|
1370 }
|
|
1371
|
|
1372 void
|
|
1373 func5(
|
|
1374 int a,
|
|
1375 int b)
|
|
1376 {
|
|
1377 }
|
|
1378
|
|
1379 void
|
|
1380 func6(
|
|
1381 int a)
|
|
1382 {
|
2843
|
1383 }
|
|
1384
|
2807
|
1385
|
|
1386 void func(void)
|
|
1387 {
|
2953
|
1388 int tab[] =
|
|
1389 {
|
|
1390 1, 2, 3,
|
|
1391 4, 5, 6};
|
|
1392
|
|
1393 printf("Indent this line correctly!\n");
|
|
1394
|
|
1395 switch (foo)
|
|
1396 {
|
|
1397 case bar:
|
|
1398 printf("bar");
|
|
1399 break;
|
|
1400 case baz: {
|
|
1401 printf("baz");
|
|
1402 break;
|
|
1403 }
|
|
1404 case quux:
|
|
1405 printf("But don't break the indentation of this instruction\n");
|
|
1406 break;
|
|
1407 }
|
|
1408 }
|
|
1409
|
|
1410
|
|
1411 void func(void)
|
|
1412 {
|
2807
|
1413 cout << "a"
|
|
1414 << "b"
|
|
1415 << ") :"
|
|
1416 << "c";
|
|
1417 }
|
|
1418
|
2809
|
1419
|
|
1420 void func(void)
|
|
1421 {
|
|
1422 /*
|
|
1423 * This is a comment.
|
|
1424 */
|
|
1425 foo();
|
|
1426 }
|
|
1427
|
2855
|
1428
|
|
1429 void func(void)
|
|
1430 {
|
|
1431 for (int i = 0; i < 10; ++i)
|
|
1432 if (i & 1) {
|
|
1433 foo(1);
|
|
1434 } else
|
|
1435 foo(0);
|
|
1436 baz();
|
|
1437 }
|
|
1438
|
2857
|
1439
|
3454
|
1440 void func(void)
|
|
1441 {
|
|
1442 if (condition1
|
|
1443 && condition2)
|
|
1444 action();
|
|
1445 function(argument1
|
|
1446 && argument2);
|
|
1447
|
|
1448 if (c1 && (c2 ||
|
|
1449 c3))
|
|
1450 foo;
|
|
1451 if (c1 &&
|
|
1452 (c2 || c3))
|
|
1453 {
|
|
1454 }
|
|
1455
|
|
1456 if ( c1
|
|
1457 && ( c2
|
|
1458 || c3))
|
|
1459 foo;
|
|
1460 func( c1
|
|
1461 && ( c2
|
|
1462 || c3))
|
|
1463 foo;
|
|
1464 }
|
|
1465
|
|
1466
|
|
1467 void func(void)
|
|
1468 {
|
|
1469 if (condition1
|
|
1470 && condition2)
|
|
1471 action();
|
|
1472 function(argument1
|
|
1473 && argument2);
|
|
1474
|
|
1475 if (c1 && (c2 ||
|
|
1476 c3))
|
|
1477 foo;
|
|
1478 if (c1 &&
|
|
1479 (c2 || c3))
|
|
1480 {
|
|
1481 }
|
|
1482
|
|
1483 if ( c1
|
|
1484 && ( c2
|
|
1485 || c3))
|
|
1486 foo;
|
|
1487 func( c1
|
|
1488 && ( c2
|
|
1489 || c3))
|
|
1490 foo;
|
|
1491 }
|
|
1492
|
|
1493
|
|
1494 void func(void)
|
|
1495 {
|
|
1496 if (condition1
|
|
1497 && condition2)
|
|
1498 action();
|
|
1499 function(argument1
|
|
1500 && argument2);
|
|
1501
|
|
1502 if (c1 && (c2 ||
|
|
1503 c3))
|
|
1504 foo;
|
|
1505 if (c1 &&
|
|
1506 (c2 || c3))
|
|
1507 {
|
|
1508 }
|
|
1509 if (c123456789
|
|
1510 && (c22345
|
|
1511 || c3))
|
|
1512 printf("foo\n");
|
|
1513
|
|
1514 c = c1 &&
|
|
1515 (
|
|
1516 c2 ||
|
|
1517 c3
|
|
1518 ) && c4;
|
|
1519 }
|
|
1520
|
|
1521
|
|
1522 void func(void)
|
|
1523 {
|
|
1524 if (condition1
|
|
1525 && condition2)
|
|
1526 action();
|
|
1527 function(argument1
|
|
1528 && argument2);
|
|
1529
|
|
1530 if (c1 && (c2 ||
|
|
1531 c3))
|
|
1532 foo;
|
|
1533 if (c1 &&
|
|
1534 (c2 || c3))
|
|
1535 {
|
|
1536 }
|
|
1537 if (c123456789
|
|
1538 && (c22345
|
|
1539 || c3))
|
|
1540 printf("foo\n");
|
|
1541
|
|
1542 if ( c1
|
|
1543 && ( c2
|
|
1544 || c3))
|
|
1545 foo;
|
|
1546
|
|
1547 a_long_line(
|
|
1548 argument,
|
|
1549 argument);
|
|
1550 a_short_line(argument,
|
|
1551 argument);
|
|
1552 }
|
|
1553
|
|
1554
|
|
1555 void func(void)
|
|
1556 {
|
|
1557 if (condition1
|
|
1558 && condition2)
|
|
1559 action();
|
|
1560 function(argument1
|
|
1561 && argument2);
|
|
1562
|
|
1563 if (c1 && (c2 ||
|
|
1564 c3))
|
|
1565 foo;
|
|
1566 if (c1 &&
|
|
1567 (c2 || c3))
|
|
1568 {
|
|
1569 }
|
|
1570 if (c123456789
|
|
1571 && (c22345
|
|
1572 || c3))
|
|
1573 printf("foo\n");
|
|
1574 }
|
|
1575
|
|
1576
|
|
1577 void func(void)
|
|
1578 {
|
|
1579 if (condition1
|
|
1580 && condition2)
|
|
1581 action();
|
|
1582 function(argument1
|
|
1583 && argument2);
|
|
1584
|
|
1585 if (c1 && (c2 ||
|
|
1586 c3))
|
|
1587 foo;
|
|
1588 if (c1 &&
|
|
1589 (c2 || c3))
|
|
1590 {
|
|
1591 }
|
|
1592 if (c123456789
|
|
1593 && (c22345
|
|
1594 || c3))
|
|
1595 printf("foo\n");
|
|
1596
|
|
1597 if ( c1
|
|
1598 && ( c2
|
|
1599 || c3))
|
|
1600 foo;
|
|
1601 func( c1
|
|
1602 && ( c2
|
|
1603 || c3))
|
|
1604 foo;
|
|
1605 }
|
|
1606
|
|
1607
|
|
1608 void func(void)
|
|
1609 {
|
|
1610 if (condition1
|
|
1611 && condition2)
|
|
1612 action();
|
|
1613 function(argument1
|
|
1614 && argument2);
|
|
1615
|
|
1616 if (c1 && (c2 ||
|
|
1617 c3))
|
|
1618 foo;
|
|
1619 if (c1 &&
|
|
1620 (c2 || c3))
|
|
1621 {
|
|
1622 }
|
|
1623 }
|
|
1624
|
|
1625
|
2879
|
1626 NAMESPACESTART
|
2857
|
1627 /* valid namespaces with normal indent */
|
|
1628 namespace
|
|
1629 {
|
|
1630 {
|
|
1631 111111111111;
|
|
1632 }
|
|
1633 }
|
|
1634 namespace /* test */
|
|
1635 {
|
|
1636 11111111111111111;
|
|
1637 }
|
|
1638 namespace // test
|
|
1639 {
|
|
1640 111111111111111111;
|
|
1641 }
|
|
1642 namespace
|
|
1643 {
|
|
1644 111111111111111111;
|
|
1645 }
|
|
1646 namespace test
|
|
1647 {
|
|
1648 111111111111111111;
|
|
1649 }
|
|
1650 namespace{
|
|
1651 111111111111111111;
|
|
1652 }
|
|
1653 namespace test{
|
|
1654 111111111111111111;
|
|
1655 }
|
|
1656 namespace {
|
|
1657 111111111111111111;
|
|
1658 }
|
|
1659 namespace test {
|
|
1660 111111111111111111;
|
|
1661 namespace test2 {
|
|
1662 22222222222222222;
|
|
1663 }
|
|
1664 }
|
|
1665
|
|
1666 /* invalid namespaces use block indent */
|
|
1667 namespace test test2 {
|
|
1668 111111111111111111111;
|
|
1669 }
|
|
1670 namespace11111111111 {
|
|
1671 111111111111;
|
|
1672 }
|
|
1673 namespace() {
|
|
1674 1111111111111;
|
|
1675 }
|
|
1676 namespace()
|
|
1677 {
|
|
1678 111111111111111111;
|
|
1679 }
|
|
1680 namespace test test2
|
|
1681 {
|
|
1682 1111111111111111111;
|
|
1683 }
|
|
1684 namespace111111111
|
|
1685 {
|
|
1686 111111111111111111;
|
|
1687 }
|
|
1688 NAMESPACEEND
|
|
1689
|
|
1690
|
2879
|
1691
|
|
1692 JSSTART
|
|
1693 var bar = {
|
|
1694 foo: {
|
|
1695 that: this,
|
|
1696 some: ok,
|
|
1697 },
|
|
1698 "bar":{
|
|
1699 a : 2,
|
|
1700 b: "123abc",
|
|
1701 x: 4,
|
|
1702 "y": 5
|
|
1703 }
|
|
1704 }
|
|
1705 JSEND
|
|
1706
|
2968
|
1707
|
|
1708 JSSTART
|
|
1709 var foo = [
|
6030
|
1710 1,
|
2968
|
1711 2,
|
|
1712 3
|
6030
|
1713 ];
|
2968
|
1714 JSEND
|
|
1715
|
|
1716
|
|
1717 JSSTART
|
|
1718 function bar() {
|
|
1719 var foo = [
|
|
1720 1,
|
|
1721 2,
|
|
1722 3
|
6030
|
1723 ];
|
2968
|
1724 }
|
|
1725 JSEND
|
|
1726
|
|
1727
|
|
1728 JSSTART
|
|
1729 (function($){
|
|
1730
|
6020
|
1731 if (cond &&
|
|
1732 cond) {
|
|
1733 stmt;
|
|
1734 }
|
6030
|
1735 window.something.left =
|
|
1736 (width - 50 + offset) + "px";
|
2968
|
1737 var class_name='myclass';
|
|
1738
|
|
1739 function private_method() {
|
|
1740 }
|
|
1741
|
|
1742 var public_method={
|
|
1743 method: function(options,args){
|
|
1744 private_method();
|
|
1745 }
|
|
1746 }
|
|
1747
|
|
1748 function init(options) {
|
|
1749
|
|
1750 $(this).data(class_name+'_public',$.extend({},{
|
|
1751 foo: 'bar',
|
6030
|
1752 bar: 2,
|
|
1753 foobar: [
|
|
1754 1,
|
|
1755 2,
|
|
1756 3
|
2968
|
1757 ],
|
6030
|
1758 callback: function(){
|
|
1759 return true;
|
|
1760 }
|
2968
|
1761 }, options||{}));
|
|
1762 }
|
|
1763
|
|
1764 $.fn[class_name]=function() {
|
|
1765
|
|
1766 var _arguments=arguments;
|
|
1767 return this.each(function(){
|
|
1768
|
|
1769 var options=$(this).data(class_name+'_public');
|
|
1770 if (!options) {
|
|
1771 init.apply(this,_arguments);
|
|
1772
|
|
1773 } else {
|
|
1774 var method=public_method[_arguments[0]];
|
|
1775
|
|
1776 if (typeof(method)!='function') {
|
|
1777 console.log(class_name+' has no method "'+_arguments[0]+'"');
|
|
1778 return false;
|
|
1779 }
|
|
1780 _arguments[0]=options;
|
|
1781 method.apply(this,_arguments);
|
|
1782 }
|
|
1783 });
|
|
1784 }
|
|
1785
|
|
1786 })(jQuery);
|
|
1787 JSEND
|
|
1788
|
|
1789
|
|
1790 JSSTART
|
|
1791 function init(options) {
|
|
1792 $(this).data(class_name+'_public',$.extend({},{
|
|
1793 foo: 'bar',
|
|
1794 bar: 2,
|
|
1795 foobar: [
|
6030
|
1796 1,
|
|
1797 2,
|
|
1798 3
|
2968
|
1799 ],
|
|
1800 callback: function(){
|
|
1801 return true;
|
|
1802 }
|
|
1803 }, options||{}));
|
|
1804 }
|
|
1805 JSEND
|
|
1806
|
|
1807
|
|
1808 JSSTART
|
|
1809 (function($){
|
|
1810 function init(options) {
|
|
1811 $(this).data(class_name+'_public',$.extend({},{
|
|
1812 foo: 'bar',
|
6030
|
1813 bar: 2,
|
|
1814 foobar: [
|
|
1815 1,
|
|
1816 2,
|
|
1817 3
|
2968
|
1818 ],
|
6030
|
1819 callback: function(){
|
|
1820 return true;
|
|
1821 }
|
2968
|
1822 }, options||{}));
|
|
1823 }
|
|
1824 })(jQuery);
|
|
1825 JSEND
|
|
1826
|