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