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
|
6971
|
894 void getstring() {
|
|
895 /* Raw strings */
|
|
896 const char* s = R"(
|
|
897 test {
|
|
898 # comment
|
|
899 field: 123
|
|
900 }
|
|
901 )";
|
|
902 }
|
|
903
|
|
904 void getstring() {
|
|
905 const char* s = R"foo(
|
|
906 test {
|
|
907 # comment
|
|
908 field: 123
|
|
909 }
|
|
910 )foo";
|
|
911 }
|
|
912
|
7
|
913 /* end of AUTO */
|
|
914
|
|
915 STARTTEST
|
|
916 :set tw=0 wm=60 columns=80 noai fo=croq
|
|
917 /serious/e
|
|
918 a about life, the universe, and the rest
|
|
919 ENDTEST
|
|
920
|
|
921 {
|
|
922
|
|
923 /* this is
|
|
924 * a real serious important big
|
|
925 * comment
|
|
926 */
|
|
927 /* insert " about life, the universe, and the rest" after "serious" */
|
|
928 }
|
|
929
|
|
930 STARTTEST
|
|
931 :set nocin
|
|
932 /comments
|
|
933 joabout life/happens
|
|
934 jothere/below
|
|
935 oline/this
|
|
936 Ohello
|
|
937 ENDTEST
|
|
938
|
|
939 {
|
|
940 /*
|
|
941 * Testing for comments, without 'cin' set
|
|
942 */
|
|
943
|
|
944 /*
|
|
945 * what happens here?
|
|
946 */
|
|
947
|
|
948 /*
|
|
949 the end of the comment, try inserting a line below */
|
|
950
|
|
951 /* how about
|
|
952 this one */
|
|
953 }
|
|
954
|
|
955 STARTTEST
|
|
956 :set cin
|
|
957 /vec2
|
|
958 ==
|
|
959 ENDTEST
|
|
960
|
|
961 {
|
|
962 var = this + that + vec[0] * vec[0]
|
|
963 + vec[1] * vec[1]
|
|
964 + vec2[2] * vec[2];
|
|
965 }
|
|
966
|
|
967 STARTTEST
|
|
968 :set cin
|
|
969 :set cino=}4
|
|
970 /testing1
|
|
971 k2==/testing2
|
|
972 k2==
|
|
973 ENDTEST
|
|
974
|
|
975 {
|
|
976 asdf asdflkajds f;
|
|
977 if (tes & ting) {
|
|
978 asdf asdf asdf ;
|
|
979 asdfa sdf asdf;
|
|
980 }
|
|
981 testing1;
|
|
982 if (tes & ting)
|
|
983 {
|
|
984 asdf asdf asdf ;
|
|
985 asdfa sdf asdf;
|
|
986 }
|
|
987 testing2;
|
|
988 }
|
|
989
|
|
990 STARTTEST
|
|
991 :set cin
|
|
992 :set cino=(0,)20
|
|
993 /main
|
|
994 =][
|
|
995 ENDTEST
|
|
996
|
|
997 main ( int first_par, /*
|
|
998 * Comment for
|
|
999 * first par
|
|
1000 */
|
|
1001 int second_par /*
|
|
1002 * Comment for
|
|
1003 * second par
|
|
1004 */
|
|
1005 )
|
|
1006 {
|
|
1007 func( first_par, /*
|
|
1008 * Comment for
|
|
1009 * first par
|
|
1010 */
|
|
1011 second_par /*
|
|
1012 * Comment for
|
|
1013 * second par
|
|
1014 */
|
|
1015 );
|
|
1016
|
|
1017 }
|
|
1018
|
|
1019 STARTTEST
|
|
1020 :set cin
|
3578
|
1021 :set cino=es,n0s
|
|
1022 /main
|
|
1023 =][
|
|
1024 ENDTEST
|
|
1025
|
|
1026 main(void)
|
|
1027 {
|
|
1028 /* Make sure that cino=X0s is not parsed like cino=Xs. */
|
|
1029 if (cond)
|
|
1030 foo();
|
|
1031 else
|
|
1032 {
|
|
1033 bar();
|
|
1034 }
|
|
1035 }
|
|
1036
|
|
1037 STARTTEST
|
|
1038 :set cin
|
7
|
1039 :set cino=
|
|
1040 ]]=][
|
|
1041 ENDTEST
|
|
1042
|
|
1043 {
|
|
1044 do
|
|
1045 {
|
|
1046 if ()
|
|
1047 {
|
|
1048 if ()
|
|
1049 asdf;
|
|
1050 else
|
|
1051 asdf;
|
|
1052 }
|
|
1053 } while ();
|
|
1054 cmd; /* this should go under the } */
|
|
1055 }
|
|
1056
|
|
1057 STARTTEST
|
|
1058 ]]=][
|
|
1059 ENDTEST
|
|
1060
|
|
1061 void f()
|
|
1062 {
|
|
1063 if ( k() ) {
|
|
1064 l();
|
|
1065
|
|
1066 } else { /* Start (two words) end */
|
|
1067 m();
|
|
1068 }
|
|
1069
|
|
1070 n();
|
|
1071 }
|
|
1072
|
|
1073 STARTTEST
|
|
1074 :set cino={s,e-s
|
|
1075 ]]=][
|
|
1076 ENDTEST
|
|
1077
|
|
1078 void f()
|
|
1079 {
|
|
1080 if ( k() )
|
|
1081 {
|
|
1082 l();
|
|
1083 } else { /* Start (two words) end */
|
|
1084 m();
|
|
1085 }
|
|
1086 n(); /* should be under the if () */
|
|
1087 }
|
|
1088
|
|
1089 STARTTEST
|
|
1090 :set cino={s,fs
|
|
1091 ]]=/ foo
|
|
1092 ENDTEST
|
|
1093
|
|
1094 void bar(void)
|
|
1095 {
|
|
1096 static array[2][2] =
|
|
1097 {
|
|
1098 { 1, 2 },
|
|
1099 { 3, 4 },
|
|
1100 }
|
|
1101
|
|
1102 while (a)
|
|
1103 {
|
|
1104 foo(&a);
|
|
1105 }
|
|
1106
|
|
1107 {
|
|
1108 int a;
|
|
1109 {
|
|
1110 a = a + 1;
|
|
1111 }
|
|
1112 }
|
|
1113 b = a;
|
|
1114 }
|
|
1115
|
|
1116 void func(void)
|
|
1117 {
|
|
1118 a = 1;
|
|
1119 {
|
|
1120 b = 2;
|
|
1121 }
|
|
1122 c = 3;
|
|
1123 d = 4;
|
|
1124 }
|
|
1125 /* foo */
|
|
1126
|
|
1127 STARTTEST
|
|
1128 :set cino=
|
|
1129 /while
|
|
1130 ohere
|
|
1131 ENDTEST
|
|
1132
|
|
1133 a()
|
|
1134 {
|
|
1135 do {
|
|
1136 a = a +
|
|
1137 a;
|
|
1138 } while ( a ); /* add text under this line */
|
|
1139 if ( a )
|
|
1140 a;
|
|
1141 }
|
|
1142
|
|
1143 STARTTEST
|
|
1144 :set cino= com=
|
|
1145 /comment
|
|
1146 olabel2: b();
label3 /* post */:
/* pre */ label4:
f(/*com*/);
if (/*com*/)
cmd();
|
|
1147 ENDTEST
|
|
1148
|
|
1149 a()
|
|
1150 {
|
|
1151 label1:
|
|
1152 /* hmm */
|
|
1153 // comment
|
|
1154 }
|
|
1155
|
|
1156 STARTTEST
|
|
1157 :set comments& comments^=s:/*,m:**,ex:*/
|
|
1158 /simple
|
|
1159 =5j
|
|
1160 ENDTEST
|
|
1161
|
|
1162 /*
|
|
1163 * A simple comment
|
|
1164 */
|
|
1165
|
|
1166 /*
|
|
1167 ** A different comment
|
|
1168 */
|
|
1169
|
|
1170 STARTTEST
|
|
1171 :set cino=c0
|
|
1172 :set comments& comments-=s1:/* comments^=s0:/*
|
|
1173 2kdd]]=][
|
|
1174 ENDTEST
|
|
1175
|
|
1176 void f()
|
|
1177 {
|
|
1178
|
|
1179 /*********
|
|
1180 A comment.
|
|
1181 *********/
|
|
1182 }
|
|
1183
|
|
1184 STARTTEST
|
|
1185 :set cino=c0,C1
|
|
1186 :set comments& comments-=s1:/* comments^=s0:/*
|
|
1187 2kdd]]=][
|
|
1188 ENDTEST
|
|
1189
|
|
1190 void f()
|
|
1191 {
|
|
1192
|
|
1193 /*********
|
|
1194 A comment.
|
|
1195 *********/
|
|
1196 }
|
|
1197
|
|
1198 STARTTEST
|
|
1199 :set cino=
|
|
1200 ]]=][
|
|
1201 ENDTEST
|
|
1202
|
|
1203 void f()
|
|
1204 {
|
|
1205 c = c1 &&
|
|
1206 (
|
|
1207 c2 ||
|
|
1208 c3
|
|
1209 ) && c4;
|
|
1210 }
|
|
1211
|
|
1212 STARTTEST
|
|
1213 :set cino=(s
|
|
1214 2kdd]]=][
|
|
1215 ENDTEST
|
|
1216
|
|
1217 void f()
|
|
1218 {
|
|
1219 c = c1 &&
|
|
1220 (
|
|
1221 c2 ||
|
|
1222 c3
|
|
1223 ) && c4;
|
|
1224 }
|
|
1225
|
|
1226 STARTTEST
|
|
1227 :set cino=(s,U1
|
|
1228 2kdd]]=][
|
|
1229 ENDTEST
|
|
1230
|
|
1231 void f()
|
|
1232 {
|
|
1233 c = c1 &&
|
|
1234 (
|
|
1235 c2 ||
|
|
1236 c3
|
|
1237 ) && c4;
|
|
1238 }
|
|
1239
|
|
1240 STARTTEST
|
|
1241 :set cino=(0
|
|
1242 2kdd]]=][
|
|
1243 ENDTEST
|
|
1244
|
|
1245 void f()
|
|
1246 {
|
|
1247 if ( c1
|
|
1248 && ( c2
|
|
1249 || c3))
|
|
1250 foo;
|
|
1251 }
|
|
1252
|
|
1253 STARTTEST
|
|
1254 :set cino=(0,w1
|
|
1255 2kdd]]=][
|
|
1256 ENDTEST
|
|
1257
|
|
1258 void f()
|
|
1259 {
|
|
1260 if ( c1
|
|
1261 && ( c2
|
|
1262 || c3))
|
|
1263 foo;
|
|
1264 }
|
|
1265
|
|
1266 STARTTEST
|
|
1267 :set cino=(s
|
|
1268 2kdd]]=][
|
|
1269 ENDTEST
|
|
1270
|
|
1271 void f()
|
|
1272 {
|
|
1273 c = c1 && (
|
|
1274 c2 ||
|
|
1275 c3
|
|
1276 ) && c4;
|
|
1277 if (
|
|
1278 c1 && c2
|
|
1279 )
|
|
1280 foo;
|
|
1281 }
|
|
1282
|
|
1283 STARTTEST
|
|
1284 :set cino=(s,m1
|
|
1285 2kdd]]=][
|
|
1286 ENDTEST
|
|
1287
|
|
1288 void f()
|
|
1289 {
|
|
1290 c = c1 && (
|
|
1291 c2 ||
|
|
1292 c3
|
|
1293 ) && c4;
|
|
1294 if (
|
|
1295 c1 && c2
|
|
1296 )
|
|
1297 foo;
|
|
1298 }
|
|
1299
|
|
1300 STARTTEST
|
|
1301 :set cino=b1
|
|
1302 2kdd]]=][
|
|
1303 ENDTEST
|
|
1304
|
|
1305 void f()
|
|
1306 {
|
|
1307 switch (x)
|
|
1308 {
|
|
1309 case 1:
|
|
1310 a = b;
|
|
1311 break;
|
|
1312 default:
|
|
1313 a = 0;
|
|
1314 break;
|
|
1315 }
|
|
1316 }
|
|
1317
|
|
1318 STARTTEST
|
|
1319 :set cino=(0,W5
|
|
1320 2kdd]]=][
|
|
1321 ENDTEST
|
|
1322
|
|
1323 void f()
|
|
1324 {
|
|
1325 invokeme(
|
|
1326 argu,
|
|
1327 ment);
|
|
1328 invokeme(
|
|
1329 argu,
|
|
1330 ment
|
|
1331 );
|
|
1332 invokeme(argu,
|
|
1333 ment
|
|
1334 );
|
|
1335 }
|
|
1336
|
|
1337 STARTTEST
|
|
1338 :set cino=/6
|
|
1339 2kdd]]=][
|
|
1340 ENDTEST
|
|
1341
|
|
1342 void f()
|
|
1343 {
|
|
1344 statement;
|
|
1345 // comment 1
|
|
1346 // comment 2
|
|
1347 }
|
|
1348
|
|
1349 STARTTEST
|
|
1350 :set cino=
|
|
1351 2kdd]]/comment 1/+1
|
|
1352 ==
|
|
1353 ENDTEST
|
|
1354
|
|
1355 void f()
|
|
1356 {
|
|
1357 statement;
|
|
1358 // comment 1
|
|
1359 // comment 2
|
|
1360 }
|
|
1361
|
|
1362 STARTTEST
|
|
1363 :set cino=g0
|
|
1364 2kdd]]=][
|
|
1365 ENDTEST
|
|
1366
|
|
1367 class CAbc
|
|
1368 {
|
|
1369 int Test() { return FALSE; }
|
|
1370
|
|
1371 public: // comment
|
|
1372 void testfall();
|
|
1373 protected:
|
|
1374 void testfall();
|
|
1375 };
|
|
1376
|
|
1377 STARTTEST
|
3123
|
1378 :set cino=(0,gs,hs
|
|
1379 2kdd]]=][
|
|
1380 ENDTEST
|
|
1381
|
|
1382 class Foo : public Bar
|
|
1383 {
|
|
1384 public:
|
|
1385 virtual void method1(void) = 0;
|
|
1386 virtual void method2(int arg1,
|
|
1387 int arg2,
|
|
1388 int arg3) = 0;
|
|
1389 };
|
|
1390
|
|
1391 STARTTEST
|
828
|
1392 :set cino=+20
|
|
1393 2kdd]]=][
|
|
1394 ENDTEST
|
|
1395
|
|
1396 void
|
|
1397 foo()
|
|
1398 {
|
|
1399 if (a)
|
|
1400 {
|
|
1401 } else
|
|
1402 asdf;
|
|
1403 }
|
|
1404
|
|
1405 STARTTEST
|
7
|
1406 :set cino=(0,W2s
|
|
1407 2kdd]]=][
|
|
1408 ENDTEST
|
|
1409
|
|
1410 {
|
|
1411 averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd(
|
|
1412 asdasdf,
|
|
1413 func(asdf,
|
|
1414 asdfadsf),
|
|
1415 asdfasdf
|
|
1416 );
|
|
1417
|
|
1418 /* those are ugly, but consequent */
|
|
1419
|
|
1420 func()->asd(asdasdf,
|
|
1421 averylongfunctionname(
|
|
1422 abc,
|
|
1423 dec)->averylongfunctionname(
|
|
1424 asdfadsf,
|
|
1425 asdfasdf,
|
|
1426 asdfasdf,
|
|
1427 ),
|
|
1428 func(asdfadf,
|
|
1429 asdfasdf
|
|
1430 ),
|
|
1431 asdasdf
|
|
1432 );
|
|
1433
|
|
1434 averylongfunctionnameaverylongfunctionnameavery()->asd(fasdf(
|
|
1435 abc,
|
|
1436 dec)->asdfasdfasdf(
|
|
1437 asdfadsf,
|
|
1438 asdfasdf,
|
|
1439 asdfasdf,
|
|
1440 ),
|
|
1441 func(asdfadf,
|
|
1442 asdfasdf),
|
|
1443 asdasdf
|
|
1444 );
|
|
1445 }
|
|
1446
|
|
1447 STARTTEST
|
829
|
1448 :set cino=M1
|
|
1449 2kdd]]=][
|
|
1450 ENDTEST
|
|
1451
|
|
1452 int main ()
|
|
1453 {
|
|
1454 if (cond1 &&
|
|
1455 cond2
|
|
1456 )
|
|
1457 foo;
|
|
1458 }
|
|
1459
|
|
1460 STARTTEST
|
2776
|
1461 :set cino=(0,ts
|
6030
|
1462 2kdd2j=][
|
2776
|
1463 ENDTEST
|
|
1464
|
|
1465 void func(int a
|
|
1466 #if defined(FOO)
|
|
1467 , int b
|
|
1468 , int c
|
|
1469 #endif
|
|
1470 )
|
|
1471 {
|
|
1472 }
|
|
1473
|
|
1474 STARTTEST
|
|
1475 :set cino=(0
|
6030
|
1476 2kdd2j=][
|
2776
|
1477 ENDTEST
|
|
1478
|
|
1479 void
|
|
1480 func(int a
|
|
1481 #if defined(FOO)
|
|
1482 , int b
|
|
1483 , int c
|
|
1484 #endif
|
|
1485 )
|
|
1486 {
|
|
1487 }
|
|
1488
|
|
1489 STARTTEST
|
2805
|
1490 :set cino&
|
6030
|
1491 2kdd2j=7][
|
2805
|
1492 ENDTEST
|
|
1493
|
|
1494 void func(void)
|
|
1495 {
|
|
1496 if(x==y)
|
|
1497 if(y==z)
|
|
1498 foo=1;
|
|
1499 else { bar=1;
|
|
1500 baz=2;
|
|
1501 }
|
|
1502 printf("Foo!\n");
|
|
1503 }
|
|
1504
|
2843
|
1505 void func1(void)
|
|
1506 {
|
|
1507 char* tab[] = {"foo", "bar",
|
|
1508 "baz", "quux",
|
|
1509 "this line used", "to be indented incorrectly"};
|
|
1510 foo();
|
|
1511 }
|
|
1512
|
|
1513 void func2(void)
|
|
1514 {
|
|
1515 int tab[] =
|
|
1516 {1, 2,
|
|
1517 3, 4,
|
|
1518 5, 6};
|
|
1519
|
|
1520 printf("This line used to be indented incorrectly.\n");
|
|
1521 }
|
|
1522
|
3186
|
1523 int foo[]
|
|
1524 #ifdef BAR
|
|
1525
|
|
1526 = { 1, 2, 3,
|
|
1527 4, 5, 6 }
|
|
1528
|
|
1529 #endif
|
|
1530 ;
|
|
1531 int baz;
|
|
1532
|
2843
|
1533 void func3(void)
|
|
1534 {
|
|
1535 int tab[] = {
|
|
1536 1, 2,
|
|
1537 3, 4,
|
|
1538 5, 6};
|
|
1539
|
3220
|
1540 printf("Don't you dare indent this line incorrectly!\n");
|
|
1541 }
|
|
1542
|
|
1543 void
|
|
1544 func4(a, b,
|
|
1545 c)
|
|
1546 int a;
|
|
1547 int b;
|
|
1548 int c;
|
|
1549 {
|
|
1550 }
|
|
1551
|
|
1552 void
|
|
1553 func5(
|
|
1554 int a,
|
|
1555 int b)
|
|
1556 {
|
|
1557 }
|
|
1558
|
|
1559 void
|
|
1560 func6(
|
|
1561 int a)
|
|
1562 {
|
2843
|
1563 }
|
|
1564
|
2805
|
1565 STARTTEST
|
2807
|
1566 :set cino&
|
2953
|
1567 :set cino+=l1
|
6030
|
1568 2kdd2j=][
|
2953
|
1569 ENDTEST
|
|
1570
|
|
1571 void func(void)
|
|
1572 {
|
|
1573 int tab[] =
|
|
1574 {
|
|
1575 1, 2, 3,
|
|
1576 4, 5, 6};
|
|
1577
|
|
1578 printf("Indent this line correctly!\n");
|
|
1579
|
|
1580 switch (foo)
|
|
1581 {
|
|
1582 case bar:
|
|
1583 printf("bar");
|
|
1584 break;
|
|
1585 case baz: {
|
|
1586 printf("baz");
|
|
1587 break;
|
|
1588 }
|
|
1589 case quux:
|
|
1590 printf("But don't break the indentation of this instruction\n");
|
|
1591 break;
|
|
1592 }
|
|
1593 }
|
|
1594
|
|
1595 STARTTEST
|
|
1596 :set cino&
|
6030
|
1597 2kdd2j=][
|
2807
|
1598 ENDTEST
|
|
1599
|
|
1600 void func(void)
|
|
1601 {
|
|
1602 cout << "a"
|
|
1603 << "b"
|
|
1604 << ") :"
|
|
1605 << "c";
|
|
1606 }
|
|
1607
|
|
1608 STARTTEST
|
2809
|
1609 :set com=s1:/*,m:*,ex:*/
|
|
1610 ]]3jofoo();
|
|
1611 ENDTEST
|
|
1612
|
|
1613 void func(void)
|
|
1614 {
|
|
1615 /*
|
|
1616 * This is a comment.
|
|
1617 */
|
|
1618 }
|
|
1619
|
|
1620 STARTTEST
|
2855
|
1621 :set cino&
|
6030
|
1622 2kdd2j=][
|
2855
|
1623 ENDTEST
|
|
1624
|
|
1625 void func(void)
|
|
1626 {
|
|
1627 for (int i = 0; i < 10; ++i)
|
|
1628 if (i & 1) {
|
|
1629 foo(1);
|
|
1630 } else
|
|
1631 foo(0);
|
|
1632 baz();
|
|
1633 }
|
|
1634
|
|
1635 STARTTEST
|
3454
|
1636 :set cino=k2s,(0
|
|
1637 2kdd3j=][
|
|
1638 ENDTEST
|
|
1639
|
|
1640 void func(void)
|
|
1641 {
|
|
1642 if (condition1
|
|
1643 && condition2)
|
|
1644 action();
|
|
1645 function(argument1
|
|
1646 && argument2);
|
|
1647
|
|
1648 if (c1 && (c2 ||
|
|
1649 c3))
|
|
1650 foo;
|
|
1651 if (c1 &&
|
|
1652 (c2 || c3))
|
|
1653 {
|
|
1654 }
|
|
1655
|
|
1656 if ( c1
|
|
1657 && ( c2
|
|
1658 || c3))
|
|
1659 foo;
|
|
1660 func( c1
|
|
1661 && ( c2
|
|
1662 || c3))
|
|
1663 foo;
|
|
1664 }
|
|
1665
|
|
1666 STARTTEST
|
|
1667 :set cino=k2s,(s
|
|
1668 2kdd3j=][
|
|
1669 ENDTEST
|
|
1670
|
|
1671 void func(void)
|
|
1672 {
|
|
1673 if (condition1
|
|
1674 && condition2)
|
|
1675 action();
|
|
1676 function(argument1
|
|
1677 && argument2);
|
|
1678
|
|
1679 if (c1 && (c2 ||
|
|
1680 c3))
|
|
1681 foo;
|
|
1682 if (c1 &&
|
|
1683 (c2 || c3))
|
|
1684 {
|
|
1685 }
|
|
1686
|
|
1687 if ( c1
|
|
1688 && ( c2
|
|
1689 || c3))
|
|
1690 foo;
|
|
1691 func( c1
|
|
1692 && ( c2
|
|
1693 || c3))
|
|
1694 foo;
|
|
1695 }
|
|
1696
|
|
1697 STARTTEST
|
|
1698 :set cino=k2s,(s,U1
|
|
1699 2kdd3j=][
|
|
1700 ENDTEST
|
|
1701
|
|
1702 void func(void)
|
|
1703 {
|
|
1704 if (condition1
|
|
1705 && condition2)
|
|
1706 action();
|
|
1707 function(argument1
|
|
1708 && argument2);
|
|
1709
|
|
1710 if (c1 && (c2 ||
|
|
1711 c3))
|
|
1712 foo;
|
|
1713 if (c1 &&
|
|
1714 (c2 || c3))
|
|
1715 {
|
|
1716 }
|
|
1717 if (c123456789
|
|
1718 && (c22345
|
|
1719 || c3))
|
|
1720 printf("foo\n");
|
|
1721
|
|
1722 c = c1 &&
|
|
1723 (
|
|
1724 c2 ||
|
|
1725 c3
|
|
1726 ) && c4;
|
|
1727 }
|
|
1728
|
|
1729 STARTTEST
|
|
1730 :set cino=k2s,(0,W4
|
|
1731 2kdd3j=][
|
|
1732 ENDTEST
|
|
1733
|
|
1734 void func(void)
|
|
1735 {
|
|
1736 if (condition1
|
|
1737 && condition2)
|
|
1738 action();
|
|
1739 function(argument1
|
|
1740 && argument2);
|
|
1741
|
|
1742 if (c1 && (c2 ||
|
|
1743 c3))
|
|
1744 foo;
|
|
1745 if (c1 &&
|
|
1746 (c2 || c3))
|
|
1747 {
|
|
1748 }
|
|
1749 if (c123456789
|
|
1750 && (c22345
|
|
1751 || c3))
|
|
1752 printf("foo\n");
|
|
1753
|
|
1754 if ( c1
|
|
1755 && ( c2
|
|
1756 || c3))
|
|
1757 foo;
|
|
1758
|
|
1759 a_long_line(
|
|
1760 argument,
|
|
1761 argument);
|
|
1762 a_short_line(argument,
|
|
1763 argument);
|
|
1764 }
|
|
1765
|
|
1766 STARTTEST
|
|
1767 :set cino=k2s,u2
|
|
1768 2kdd3j=][
|
|
1769 ENDTEST
|
|
1770
|
|
1771 void func(void)
|
|
1772 {
|
|
1773 if (condition1
|
|
1774 && condition2)
|
|
1775 action();
|
|
1776 function(argument1
|
|
1777 && argument2);
|
|
1778
|
|
1779 if (c1 && (c2 ||
|
|
1780 c3))
|
|
1781 foo;
|
|
1782 if (c1 &&
|
|
1783 (c2 || c3))
|
|
1784 {
|
|
1785 }
|
|
1786 if (c123456789
|
|
1787 && (c22345
|
|
1788 || c3))
|
|
1789 printf("foo\n");
|
|
1790 }
|
|
1791
|
|
1792 STARTTEST
|
|
1793 :set cino=k2s,(0,w1
|
|
1794 2kdd3j=][
|
|
1795 ENDTEST
|
|
1796
|
|
1797 void func(void)
|
|
1798 {
|
|
1799 if (condition1
|
|
1800 && condition2)
|
|
1801 action();
|
|
1802 function(argument1
|
|
1803 && argument2);
|
|
1804
|
|
1805 if (c1 && (c2 ||
|
|
1806 c3))
|
|
1807 foo;
|
|
1808 if (c1 &&
|
|
1809 (c2 || c3))
|
|
1810 {
|
|
1811 }
|
|
1812 if (c123456789
|
|
1813 && (c22345
|
|
1814 || c3))
|
|
1815 printf("foo\n");
|
|
1816
|
|
1817 if ( c1
|
|
1818 && ( c2
|
|
1819 || c3))
|
|
1820 foo;
|
|
1821 func( c1
|
|
1822 && ( c2
|
|
1823 || c3))
|
|
1824 foo;
|
|
1825 }
|
|
1826
|
|
1827 STARTTEST
|
|
1828 :set cino=k2,(s
|
|
1829 2kdd3j=][
|
|
1830 ENDTEST
|
|
1831
|
|
1832 void func(void)
|
|
1833 {
|
|
1834 if (condition1
|
|
1835 && condition2)
|
|
1836 action();
|
|
1837 function(argument1
|
|
1838 && argument2);
|
|
1839
|
|
1840 if (c1 && (c2 ||
|
|
1841 c3))
|
|
1842 foo;
|
|
1843 if (c1 &&
|
|
1844 (c2 || c3))
|
|
1845 {
|
|
1846 }
|
|
1847 }
|
|
1848
|
|
1849 STARTTEST
|
2857
|
1850 :set cino=N-s
|
2879
|
1851 /^NAMESPACESTART
|
2857
|
1852 =/^NAMESPACEEND
|
|
1853 ENDTEST
|
|
1854
|
2879
|
1855 NAMESPACESTART
|
2857
|
1856 /* valid namespaces with normal indent */
|
|
1857 namespace
|
|
1858 {
|
|
1859 {
|
|
1860 111111111111;
|
|
1861 }
|
|
1862 }
|
|
1863 namespace /* test */
|
|
1864 {
|
|
1865 11111111111111111;
|
|
1866 }
|
|
1867 namespace // test
|
|
1868 {
|
|
1869 111111111111111111;
|
|
1870 }
|
|
1871 namespace
|
|
1872 {
|
|
1873 111111111111111111;
|
|
1874 }
|
|
1875 namespace test
|
|
1876 {
|
|
1877 111111111111111111;
|
|
1878 }
|
|
1879 namespace{
|
|
1880 111111111111111111;
|
|
1881 }
|
|
1882 namespace test{
|
|
1883 111111111111111111;
|
|
1884 }
|
|
1885 namespace {
|
|
1886 111111111111111111;
|
|
1887 }
|
|
1888 namespace test {
|
|
1889 111111111111111111;
|
|
1890 namespace test2 {
|
|
1891 22222222222222222;
|
|
1892 }
|
|
1893 }
|
|
1894
|
|
1895 /* invalid namespaces use block indent */
|
|
1896 namespace test test2 {
|
|
1897 111111111111111111111;
|
|
1898 }
|
|
1899 namespace11111111111 {
|
|
1900 111111111111;
|
|
1901 }
|
|
1902 namespace() {
|
|
1903 1111111111111;
|
|
1904 }
|
|
1905 namespace()
|
|
1906 {
|
|
1907 111111111111111111;
|
|
1908 }
|
|
1909 namespace test test2
|
|
1910 {
|
|
1911 1111111111111111111;
|
|
1912 }
|
|
1913 namespace111111111
|
|
1914 {
|
|
1915 111111111111111111;
|
|
1916 }
|
|
1917 NAMESPACEEND
|
|
1918
|
|
1919
|
|
1920 STARTTEST
|
2968
|
1921 :set cino=j1,J1
|
2879
|
1922 /^JSSTART
|
|
1923 =/^JSEND
|
|
1924 ENDTEST
|
|
1925
|
|
1926 JSSTART
|
|
1927 var bar = {
|
|
1928 foo: {
|
|
1929 that: this,
|
|
1930 some: ok,
|
|
1931 },
|
|
1932 "bar":{
|
|
1933 a : 2,
|
|
1934 b: "123abc",
|
|
1935 x: 4,
|
|
1936 "y": 5
|
|
1937 }
|
|
1938 }
|
|
1939 JSEND
|
|
1940
|
|
1941 STARTTEST
|
2968
|
1942 :set cino=j1,J1
|
|
1943 /^JSSTART
|
|
1944 =/^JSEND
|
|
1945 ENDTEST
|
|
1946
|
|
1947 JSSTART
|
|
1948 var foo = [
|
6030
|
1949 1,
|
2968
|
1950 2,
|
|
1951 3
|
6030
|
1952 ];
|
2968
|
1953 JSEND
|
|
1954
|
|
1955 STARTTEST
|
|
1956 :set cino=j1,J1
|
|
1957 /^JSSTART
|
|
1958 =/^JSEND
|
|
1959 ENDTEST
|
|
1960
|
|
1961 JSSTART
|
|
1962 function bar() {
|
|
1963 var foo = [
|
|
1964 1,
|
|
1965 2,
|
|
1966 3
|
6030
|
1967 ];
|
2968
|
1968 }
|
|
1969 JSEND
|
|
1970
|
|
1971 STARTTEST
|
|
1972 :set cino=j1,J1
|
|
1973 /^JSSTART
|
|
1974 =/^JSEND
|
|
1975 ENDTEST
|
|
1976
|
|
1977 JSSTART
|
|
1978 (function($){
|
|
1979
|
6020
|
1980 if (cond &&
|
|
1981 cond) {
|
|
1982 stmt;
|
|
1983 }
|
6030
|
1984 window.something.left =
|
|
1985 (width - 50 + offset) + "px";
|
2968
|
1986 var class_name='myclass';
|
|
1987
|
|
1988 function private_method() {
|
|
1989 }
|
|
1990
|
|
1991 var public_method={
|
|
1992 method: function(options,args){
|
|
1993 private_method();
|
|
1994 }
|
|
1995 }
|
|
1996
|
|
1997 function init(options) {
|
|
1998
|
|
1999 $(this).data(class_name+'_public',$.extend({},{
|
|
2000 foo: 'bar',
|
6030
|
2001 bar: 2,
|
|
2002 foobar: [
|
|
2003 1,
|
|
2004 2,
|
|
2005 3
|
2968
|
2006 ],
|
6030
|
2007 callback: function(){
|
|
2008 return true;
|
|
2009 }
|
2968
|
2010 }, options||{}));
|
|
2011 }
|
|
2012
|
|
2013 $.fn[class_name]=function() {
|
|
2014
|
|
2015 var _arguments=arguments;
|
|
2016 return this.each(function(){
|
|
2017
|
|
2018 var options=$(this).data(class_name+'_public');
|
|
2019 if (!options) {
|
|
2020 init.apply(this,_arguments);
|
|
2021
|
|
2022 } else {
|
|
2023 var method=public_method[_arguments[0]];
|
|
2024
|
|
2025 if (typeof(method)!='function') {
|
|
2026 console.log(class_name+' has no method "'+_arguments[0]+'"');
|
|
2027 return false;
|
|
2028 }
|
|
2029 _arguments[0]=options;
|
|
2030 method.apply(this,_arguments);
|
|
2031 }
|
|
2032 });
|
|
2033 }
|
|
2034
|
|
2035 })(jQuery);
|
|
2036 JSEND
|
|
2037
|
|
2038 STARTTEST
|
|
2039 :set cino=j1,J1
|
|
2040 /^JSSTART
|
|
2041 =/^JSEND
|
|
2042 ENDTEST
|
|
2043
|
|
2044 JSSTART
|
|
2045 function init(options) {
|
|
2046 $(this).data(class_name+'_public',$.extend({},{
|
|
2047 foo: 'bar',
|
|
2048 bar: 2,
|
|
2049 foobar: [
|
6030
|
2050 1,
|
|
2051 2,
|
|
2052 3
|
2968
|
2053 ],
|
|
2054 callback: function(){
|
|
2055 return true;
|
|
2056 }
|
|
2057 }, options||{}));
|
|
2058 }
|
|
2059 JSEND
|
|
2060
|
|
2061 STARTTEST
|
|
2062 :set cino=j1,J1
|
|
2063 /^JSSTART
|
|
2064 =/^JSEND
|
|
2065 ENDTEST
|
|
2066
|
|
2067 JSSTART
|
|
2068 (function($){
|
|
2069 function init(options) {
|
|
2070 $(this).data(class_name+'_public',$.extend({},{
|
|
2071 foo: 'bar',
|
6030
|
2072 bar: 2,
|
|
2073 foobar: [
|
|
2074 1,
|
|
2075 2,
|
|
2076 3
|
2968
|
2077 ],
|
6030
|
2078 callback: function(){
|
|
2079 return true;
|
|
2080 }
|
2968
|
2081 }, options||{}));
|
|
2082 }
|
|
2083 })(jQuery);
|
|
2084 JSEND
|
|
2085
|
|
2086 STARTTEST
|
6691
|
2087 :set cino=j1,J1,+2
|
|
2088 /^JSSTART
|
|
2089 =/^JSEND
|
|
2090 ENDTEST
|
|
2091
|
|
2092 JSSTART
|
|
2093 // Results of JavaScript indent
|
|
2094 // 1
|
|
2095 (function(){
|
|
2096 var a = [
|
|
2097 'a',
|
|
2098 'b',
|
|
2099 'c',
|
|
2100 'd',
|
|
2101 'e',
|
|
2102 'f',
|
|
2103 'g',
|
|
2104 'h',
|
|
2105 'i'
|
|
2106 ];
|
|
2107 }())
|
|
2108
|
|
2109 // 2
|
|
2110 (function(){
|
|
2111 var a = [
|
|
2112 0 +
|
|
2113 5 *
|
|
2114 9 *
|
|
2115 'a',
|
|
2116 'b',
|
|
2117 0 +
|
|
2118 5 *
|
|
2119 9 *
|
|
2120 'c',
|
|
2121 'd',
|
|
2122 'e',
|
|
2123 'f',
|
|
2124 'g',
|
|
2125 'h',
|
|
2126 'i'
|
|
2127 ];
|
|
2128 }())
|
|
2129
|
|
2130 // 3
|
|
2131 (function(){
|
|
2132 var a = [
|
|
2133 0 +
|
|
2134 // comment 1
|
|
2135 5 *
|
|
2136 /* comment 2 */
|
|
2137 9 *
|
|
2138 'a',
|
|
2139 'b',
|
|
2140 0 +
|
|
2141 5 *
|
|
2142 9 *
|
|
2143 'c',
|
|
2144 'd',
|
|
2145 'e',
|
|
2146 'f',
|
|
2147 'g',
|
|
2148 'h',
|
|
2149 'i'
|
|
2150 ];
|
|
2151 }())
|
|
2152
|
|
2153 // 4
|
|
2154 {
|
|
2155 var a = [
|
|
2156 0,
|
|
2157 1
|
|
2158 ];
|
|
2159 var b;
|
|
2160 var c;
|
|
2161 }
|
|
2162
|
|
2163 // 5
|
|
2164 {
|
|
2165 var a = [
|
|
2166 [
|
|
2167 0
|
|
2168 ],
|
|
2169 2,
|
|
2170 3
|
|
2171 ];
|
|
2172 }
|
|
2173
|
|
2174 // 6
|
|
2175 {
|
|
2176 var a = [
|
|
2177 [
|
|
2178 0,
|
|
2179 1
|
|
2180 ],
|
|
2181 2,
|
|
2182 3
|
|
2183 ];
|
|
2184 }
|
|
2185
|
|
2186 // 7
|
|
2187 {
|
|
2188 var a = [
|
|
2189 // [
|
|
2190 0,
|
|
2191 // 1
|
|
2192 // ],
|
|
2193 2,
|
|
2194 3
|
|
2195 ];
|
|
2196 }
|
|
2197
|
|
2198 // 8
|
|
2199 var x = [
|
|
2200 (function(){
|
|
2201 var a,
|
|
2202 b,
|
|
2203 c,
|
|
2204 d,
|
|
2205 e,
|
|
2206 f,
|
|
2207 g,
|
|
2208 h,
|
|
2209 i;
|
|
2210 })
|
|
2211 ];
|
|
2212
|
|
2213 // 9
|
|
2214 var a = [
|
|
2215 0 +
|
|
2216 5 *
|
|
2217 9 *
|
|
2218 'a',
|
|
2219 'b',
|
|
2220 0 +
|
|
2221 5 *
|
|
2222 9 *
|
|
2223 'c',
|
|
2224 'd',
|
|
2225 'e',
|
|
2226 'f',
|
|
2227 'g',
|
|
2228 'h',
|
|
2229 'i'
|
|
2230 ];
|
|
2231
|
|
2232 // 10
|
|
2233 var a,
|
|
2234 b,
|
|
2235 c,
|
|
2236 d,
|
|
2237 e,
|
|
2238 f,
|
|
2239 g,
|
|
2240 h,
|
|
2241 i;
|
|
2242 JSEND
|
|
2243
|
|
2244 STARTTEST
|
7
|
2245 :g/^STARTTEST/.,/^ENDTEST/d
|
|
2246 :1;/start of AUTO/,$wq! test.out
|
|
2247 ENDTEST
|