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