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