7
|
1 /* vim: set cin ts=4 sw=4 : */
|
|
2
|
|
3 Test for 'cindent'
|
|
4
|
|
5 STARTTEST
|
|
6 :so small.vim
|
|
7 :set nocompatible viminfo+=nviminfo
|
|
8 :edit " read modeline
|
|
9 /start of AUTO
|
|
10 =/end of AUTO
|
|
11 ENDTEST
|
|
12
|
|
13 /* start of AUTO matically checked */
|
|
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 {
|
|
302 yes = 0,
|
|
303 no,
|
|
304 maybe
|
|
305 };
|
|
306
|
|
307 typedef enum soppie
|
|
308 {
|
|
309 yes = 0,
|
|
310 no,
|
|
311 maybe
|
|
312 };
|
|
313
|
|
314 {
|
|
315 int a,
|
|
316 b;
|
|
317 }
|
|
318
|
|
319 {
|
|
320 struct Type
|
|
321 {
|
|
322 int i;
|
|
323 char *str;
|
|
324 } var[] =
|
|
325 {
|
|
326 0, "zero",
|
|
327 1, "one",
|
|
328 2, "two",
|
|
329 3, "three"
|
|
330 };
|
|
331
|
|
332 float matrix[3][3] =
|
|
333 {
|
|
334 {
|
|
335 0,
|
|
336 1,
|
|
337 2
|
|
338 },
|
|
339 {
|
|
340 3,
|
|
341 4,
|
|
342 5
|
|
343 },
|
|
344 {
|
|
345 6,
|
|
346 7,
|
|
347 8
|
|
348 }
|
|
349 };
|
|
350 }
|
|
351
|
|
352 {
|
|
353 /* blah ( blah */
|
|
354 /* where does this go? */
|
|
355
|
|
356 /* blah ( blah */
|
|
357 cmd;
|
|
358
|
|
359 func(arg1,
|
|
360 /* comment */
|
|
361 arg2);
|
|
362 a;
|
|
363 {
|
|
364 b;
|
|
365 {
|
|
366 c; /* Hey, NOW it indents?! */
|
|
367 }
|
|
368 }
|
|
369
|
|
370 {
|
|
371 func(arg1,
|
|
372 arg2,
|
|
373 arg3);
|
|
374 /* Hey, what am I doing here? Is this coz of the ","? */
|
|
375 }
|
|
376 }
|
|
377
|
|
378 main ()
|
|
379 {
|
|
380 if (cond)
|
|
381 {
|
|
382 a = b;
|
|
383 }
|
|
384 if (cond) {
|
|
385 a = c;
|
|
386 }
|
|
387 if (cond)
|
|
388 a = d;
|
|
389 return;
|
|
390 }
|
|
391
|
|
392 {
|
|
393 case 2: if (asdf &&
|
|
394 asdfasdf)
|
|
395 aasdf;
|
|
396 a = 9;
|
|
397 case 3: if (asdf)
|
|
398 aasdf;
|
|
399 a = 9;
|
|
400 case 4: x = 1;
|
|
401 y = 2;
|
|
402
|
|
403 label: if (asdf)
|
|
404 here;
|
|
405
|
|
406 label: if (asdf &&
|
|
407 asdfasdf)
|
|
408 {
|
|
409 }
|
|
410
|
|
411 label: if (asdf &&
|
|
412 asdfasdf) {
|
|
413 there;
|
|
414 }
|
|
415
|
|
416 label: if (asdf &&
|
|
417 asdfasdf)
|
|
418 there;
|
|
419 }
|
|
420
|
|
421 {
|
|
422 /*
|
|
423 hello with ":set comments= cino=c5"
|
|
424 */
|
|
425
|
|
426 /*
|
|
427 hello with ":set comments= cino="
|
|
428 */
|
|
429 }
|
|
430
|
|
431
|
|
432 {
|
|
433 if (a < b) {
|
|
434 a = a + 1;
|
|
435 } else
|
|
436 a = a + 2;
|
|
437
|
|
438 if (a)
|
|
439 do {
|
|
440 testing;
|
|
441 } while (asdfasdf);
|
|
442 a = b + 1;
|
|
443 asdfasdf
|
|
444 }
|
|
445
|
|
446 class bob
|
|
447 {
|
|
448 int foo() {return 1;}
|
|
449 int bar;
|
|
450 }
|
|
451
|
|
452 main()
|
|
453 {
|
|
454 while(1)
|
|
455 if (foo)
|
|
456 {
|
|
457 bar;
|
|
458 }
|
|
459 else {
|
|
460 asdf;
|
|
461 }
|
|
462 misplacedline;
|
|
463 }
|
|
464
|
|
465 {
|
|
466 if (clipboard.state == SELECT_DONE
|
|
467 && ((row == clipboard.start.lnum
|
|
468 && col >= clipboard.start.col)
|
|
469 || row > clipboard.start.lnum))
|
|
470 }
|
|
471
|
|
472 {
|
|
473 if (1) {i += 4;}
|
|
474 where_am_i;
|
|
475 return 0;
|
|
476 }
|
|
477
|
|
478 {
|
|
479 {
|
|
480 } // sdf(asdf
|
|
481 if (asdf)
|
|
482 asd;
|
|
483 }
|
|
484
|
|
485 {
|
|
486 label1:
|
|
487 label2:
|
|
488 }
|
|
489
|
|
490 {
|
|
491 int fooRet = foo(pBar1, false /*fKB*/,
|
|
492 true /*fPTB*/, 3 /*nT*/, false /*fDF*/);
|
|
493 f() {
|
|
494 for ( i = 0;
|
|
495 i < m;
|
|
496 /* c */ i++ ) {
|
|
497 a = b;
|
|
498 }
|
|
499 }
|
|
500 }
|
|
501
|
|
502 {
|
|
503 f1(/*comment*/);
|
|
504 f2();
|
|
505 }
|
|
506
|
|
507 {
|
|
508 do {
|
|
509 if (foo) {
|
|
510 } else
|
|
511 ;
|
|
512 } while (foo);
|
|
513 foo(); // was wrong
|
|
514 }
|
|
515
|
|
516 int x; // no extra indent because of the ;
|
|
517 void func()
|
|
518 {
|
|
519 }
|
|
520
|
|
521 char *tab[] = {"aaa",
|
|
522 "};", /* }; */ NULL}
|
|
523 int indented;
|
|
524 {}
|
|
525
|
|
526 char *a[] = {"aaa", "bbb",
|
|
527 "ccc", NULL};
|
|
528 // here
|
|
529
|
|
530 char *tab[] = {"aaa",
|
|
531 "xx", /* xx */}; /* asdf */
|
|
532 int not_indented;
|
|
533
|
|
534 {
|
|
535 do {
|
|
536 switch (bla)
|
|
537 {
|
|
538 case 1: if (foo)
|
|
539 bar;
|
|
540 }
|
|
541 } while (boo);
|
|
542 wrong;
|
|
543 }
|
|
544
|
|
545 int foo,
|
|
546 bar;
|
|
547 int foo;
|
|
548
|
|
549 #if defined(foo) \
|
|
550 && defined(bar)
|
|
551 char * xx = "asdf\
|
|
552 foo\
|
|
553 bor";
|
|
554 int x;
|
|
555
|
|
556 char *foo = "asdf\
|
|
557 asdf\
|
|
558 asdf",
|
|
559 *bar;
|
|
560
|
|
561 void f()
|
|
562 {
|
|
563 #if defined(foo) \
|
|
564 && defined(bar)
|
|
565 char *foo = "asdf\
|
|
566 asdf\
|
|
567 asdf",
|
|
568 *bar;
|
|
569 {
|
|
570 int i;
|
|
571 char *foo = "asdf\
|
|
572 asdf\
|
|
573 asdf",
|
|
574 *bar;
|
|
575 }
|
|
576 #endif
|
|
577 }
|
|
578 #endif
|
|
579
|
|
580 int y; // comment
|
|
581 // comment
|
|
582
|
|
583 // comment
|
|
584
|
|
585 {
|
|
586 Constructor(int a,
|
|
587 int b ) : BaseClass(a)
|
|
588 {
|
|
589 }
|
|
590 }
|
|
591
|
|
592 void foo()
|
|
593 {
|
|
594 char one,
|
|
595 two;
|
|
596 struct bla piet,
|
|
597 jan;
|
|
598 enum foo kees,
|
|
599 jannie;
|
|
600 static unsigned sdf,
|
|
601 krap;
|
|
602 unsigned int piet,
|
|
603 jan;
|
|
604 int
|
|
605 kees,
|
|
606 jan;
|
|
607 }
|
|
608
|
|
609 {
|
|
610 t(int f,
|
|
611 int d); // )
|
|
612 d();
|
|
613 }
|
|
614
|
|
615 Constructor::Constructor(int a,
|
|
616 int b
|
|
617 ) :
|
|
618 BaseClass(a,
|
|
619 b,
|
|
620 c),
|
|
621 mMember(b),
|
|
622 {
|
|
623 }
|
|
624
|
|
625 Constructor::Constructor(int a,
|
|
626 int b ) :
|
|
627 BaseClass(a)
|
|
628 {
|
|
629 }
|
|
630
|
|
631 Constructor::Constructor(int a,
|
|
632 int b ) /*x*/ : /*x*/ BaseClass(a),
|
|
633 member(b)
|
|
634 {
|
|
635 }
|
|
636
|
|
637 class CAbc :
|
|
638 public BaseClass1,
|
|
639 protected BaseClass2
|
|
640 {
|
|
641 int Test() { return FALSE; }
|
|
642 int Test1() { return TRUE; }
|
|
643
|
|
644 CAbc(int a, int b ) :
|
|
645 BaseClass(a)
|
|
646 {
|
|
647 switch(xxx)
|
|
648 {
|
|
649 case abc:
|
|
650 asdf();
|
|
651 break;
|
|
652
|
|
653 case 999:
|
|
654 baer();
|
|
655 break;
|
|
656 }
|
|
657 }
|
|
658
|
|
659 public: // <-- this was incoreectly indented before!!
|
|
660 void testfall();
|
|
661 protected:
|
|
662 void testfall();
|
|
663 };
|
|
664
|
|
665 class CAbc : public BaseClass1,
|
|
666 protected BaseClass2
|
|
667 {
|
|
668 };
|
|
669
|
|
670 static struct
|
|
671 {
|
|
672 int a;
|
|
673 int b;
|
|
674 } variable[COUNT] =
|
|
675 {
|
|
676 {
|
|
677 123,
|
|
678 456
|
|
679 },
|
|
680 {
|
|
681 123,
|
|
682 456
|
|
683 }
|
|
684 };
|
|
685
|
|
686 static struct
|
|
687 {
|
|
688 int a;
|
|
689 int b;
|
|
690 } variable[COUNT] =
|
|
691 {
|
|
692 { 123, 456 },
|
|
693 { 123, 456 }
|
|
694 };
|
|
695
|
|
696 void asdf() /* ind_maxparen may cause trouble here */
|
|
697 {
|
|
698 if ((0
|
|
699 && 1
|
|
700 && 1
|
|
701 && 1
|
|
702 && 1
|
|
703 && 1
|
|
704 && 1
|
|
705 && 1
|
|
706 && 1
|
|
707 && 1
|
|
708 && 1
|
|
709 && 1
|
|
710 && 1
|
|
711 && 1
|
|
712 && 1
|
|
713 && 1
|
|
714 && 1
|
|
715 && 1
|
|
716 && 1
|
|
717 && 1
|
|
718 && 1
|
|
719 && 1
|
|
720 && 1
|
|
721 && 1
|
|
722 && 1
|
|
723 && 1)) break;
|
|
724 }
|
|
725
|
|
726 /* end of AUTO */
|
|
727
|
|
728 STARTTEST
|
|
729 :set tw=0 wm=60 columns=80 noai fo=croq
|
|
730 /serious/e
|
|
731 a about life, the universe, and the rest
|
|
732 ENDTEST
|
|
733
|
|
734 {
|
|
735
|
|
736 /* this is
|
|
737 * a real serious important big
|
|
738 * comment
|
|
739 */
|
|
740 /* insert " about life, the universe, and the rest" after "serious" */
|
|
741 }
|
|
742
|
|
743 STARTTEST
|
|
744 :set nocin
|
|
745 /comments
|
|
746 joabout life/happens
|
|
747 jothere/below
|
|
748 oline/this
|
|
749 Ohello
|
|
750 ENDTEST
|
|
751
|
|
752 {
|
|
753 /*
|
|
754 * Testing for comments, without 'cin' set
|
|
755 */
|
|
756
|
|
757 /*
|
|
758 * what happens here?
|
|
759 */
|
|
760
|
|
761 /*
|
|
762 the end of the comment, try inserting a line below */
|
|
763
|
|
764 /* how about
|
|
765 this one */
|
|
766 }
|
|
767
|
|
768 STARTTEST
|
|
769 :set cin
|
|
770 /vec2
|
|
771 ==
|
|
772 ENDTEST
|
|
773
|
|
774 {
|
|
775 var = this + that + vec[0] * vec[0]
|
|
776 + vec[1] * vec[1]
|
|
777 + vec2[2] * vec[2];
|
|
778 }
|
|
779
|
|
780 STARTTEST
|
|
781 :set cin
|
|
782 :set cino=}4
|
|
783 /testing1
|
|
784 k2==/testing2
|
|
785 k2==
|
|
786 ENDTEST
|
|
787
|
|
788 {
|
|
789 asdf asdflkajds f;
|
|
790 if (tes & ting) {
|
|
791 asdf asdf asdf ;
|
|
792 asdfa sdf asdf;
|
|
793 }
|
|
794 testing1;
|
|
795 if (tes & ting)
|
|
796 {
|
|
797 asdf asdf asdf ;
|
|
798 asdfa sdf asdf;
|
|
799 }
|
|
800 testing2;
|
|
801 }
|
|
802
|
|
803 STARTTEST
|
|
804 :set cin
|
|
805 :set cino=(0,)20
|
|
806 /main
|
|
807 =][
|
|
808 ENDTEST
|
|
809
|
|
810 main ( int first_par, /*
|
|
811 * Comment for
|
|
812 * first par
|
|
813 */
|
|
814 int second_par /*
|
|
815 * Comment for
|
|
816 * second par
|
|
817 */
|
|
818 )
|
|
819 {
|
|
820 func( first_par, /*
|
|
821 * Comment for
|
|
822 * first par
|
|
823 */
|
|
824 second_par /*
|
|
825 * Comment for
|
|
826 * second par
|
|
827 */
|
|
828 );
|
|
829
|
|
830 }
|
|
831
|
|
832 STARTTEST
|
|
833 :set cin
|
|
834 :set cino=
|
|
835 ]]=][
|
|
836 ENDTEST
|
|
837
|
|
838 {
|
|
839 do
|
|
840 {
|
|
841 if ()
|
|
842 {
|
|
843 if ()
|
|
844 asdf;
|
|
845 else
|
|
846 asdf;
|
|
847 }
|
|
848 } while ();
|
|
849 cmd; /* this should go under the } */
|
|
850 }
|
|
851
|
|
852 STARTTEST
|
|
853 ]]=][
|
|
854 ENDTEST
|
|
855
|
|
856 void f()
|
|
857 {
|
|
858 if ( k() ) {
|
|
859 l();
|
|
860
|
|
861 } else { /* Start (two words) end */
|
|
862 m();
|
|
863 }
|
|
864
|
|
865 n();
|
|
866 }
|
|
867
|
|
868 STARTTEST
|
|
869 :set cino={s,e-s
|
|
870 ]]=][
|
|
871 ENDTEST
|
|
872
|
|
873 void f()
|
|
874 {
|
|
875 if ( k() )
|
|
876 {
|
|
877 l();
|
|
878 } else { /* Start (two words) end */
|
|
879 m();
|
|
880 }
|
|
881 n(); /* should be under the if () */
|
|
882 }
|
|
883
|
|
884 STARTTEST
|
|
885 :set cino={s,fs
|
|
886 ]]=/ foo
|
|
887 ENDTEST
|
|
888
|
|
889 void bar(void)
|
|
890 {
|
|
891 static array[2][2] =
|
|
892 {
|
|
893 { 1, 2 },
|
|
894 { 3, 4 },
|
|
895 }
|
|
896
|
|
897 while (a)
|
|
898 {
|
|
899 foo(&a);
|
|
900 }
|
|
901
|
|
902 {
|
|
903 int a;
|
|
904 {
|
|
905 a = a + 1;
|
|
906 }
|
|
907 }
|
|
908 b = a;
|
|
909 }
|
|
910
|
|
911 void func(void)
|
|
912 {
|
|
913 a = 1;
|
|
914 {
|
|
915 b = 2;
|
|
916 }
|
|
917 c = 3;
|
|
918 d = 4;
|
|
919 }
|
|
920 /* foo */
|
|
921
|
|
922 STARTTEST
|
|
923 :set cino=
|
|
924 /while
|
|
925 ohere
|
|
926 ENDTEST
|
|
927
|
|
928 a()
|
|
929 {
|
|
930 do {
|
|
931 a = a +
|
|
932 a;
|
|
933 } while ( a ); /* add text under this line */
|
|
934 if ( a )
|
|
935 a;
|
|
936 }
|
|
937
|
|
938 STARTTEST
|
|
939 :set cino= com=
|
|
940 /comment
|
|
941 olabel2: b();
label3 /* post */:
/* pre */ label4:
f(/*com*/);
if (/*com*/)
cmd();
|
|
942 ENDTEST
|
|
943
|
|
944 a()
|
|
945 {
|
|
946 label1:
|
|
947 /* hmm */
|
|
948 // comment
|
|
949 }
|
|
950
|
|
951 STARTTEST
|
|
952 :set comments& comments^=s:/*,m:**,ex:*/
|
|
953 /simple
|
|
954 =5j
|
|
955 ENDTEST
|
|
956
|
|
957 /*
|
|
958 * A simple comment
|
|
959 */
|
|
960
|
|
961 /*
|
|
962 ** A different comment
|
|
963 */
|
|
964
|
|
965 STARTTEST
|
|
966 :set cino=c0
|
|
967 :set comments& comments-=s1:/* comments^=s0:/*
|
|
968 2kdd]]=][
|
|
969 ENDTEST
|
|
970
|
|
971 void f()
|
|
972 {
|
|
973
|
|
974 /*********
|
|
975 A comment.
|
|
976 *********/
|
|
977 }
|
|
978
|
|
979 STARTTEST
|
|
980 :set cino=c0,C1
|
|
981 :set comments& comments-=s1:/* comments^=s0:/*
|
|
982 2kdd]]=][
|
|
983 ENDTEST
|
|
984
|
|
985 void f()
|
|
986 {
|
|
987
|
|
988 /*********
|
|
989 A comment.
|
|
990 *********/
|
|
991 }
|
|
992
|
|
993 STARTTEST
|
|
994 :set cino=
|
|
995 ]]=][
|
|
996 ENDTEST
|
|
997
|
|
998 void f()
|
|
999 {
|
|
1000 c = c1 &&
|
|
1001 (
|
|
1002 c2 ||
|
|
1003 c3
|
|
1004 ) && c4;
|
|
1005 }
|
|
1006
|
|
1007 STARTTEST
|
|
1008 :set cino=(s
|
|
1009 2kdd]]=][
|
|
1010 ENDTEST
|
|
1011
|
|
1012 void f()
|
|
1013 {
|
|
1014 c = c1 &&
|
|
1015 (
|
|
1016 c2 ||
|
|
1017 c3
|
|
1018 ) && c4;
|
|
1019 }
|
|
1020
|
|
1021 STARTTEST
|
|
1022 :set cino=(s,U1
|
|
1023 2kdd]]=][
|
|
1024 ENDTEST
|
|
1025
|
|
1026 void f()
|
|
1027 {
|
|
1028 c = c1 &&
|
|
1029 (
|
|
1030 c2 ||
|
|
1031 c3
|
|
1032 ) && c4;
|
|
1033 }
|
|
1034
|
|
1035 STARTTEST
|
|
1036 :set cino=(0
|
|
1037 2kdd]]=][
|
|
1038 ENDTEST
|
|
1039
|
|
1040 void f()
|
|
1041 {
|
|
1042 if ( c1
|
|
1043 && ( c2
|
|
1044 || c3))
|
|
1045 foo;
|
|
1046 }
|
|
1047
|
|
1048 STARTTEST
|
|
1049 :set cino=(0,w1
|
|
1050 2kdd]]=][
|
|
1051 ENDTEST
|
|
1052
|
|
1053 void f()
|
|
1054 {
|
|
1055 if ( c1
|
|
1056 && ( c2
|
|
1057 || c3))
|
|
1058 foo;
|
|
1059 }
|
|
1060
|
|
1061 STARTTEST
|
|
1062 :set cino=(s
|
|
1063 2kdd]]=][
|
|
1064 ENDTEST
|
|
1065
|
|
1066 void f()
|
|
1067 {
|
|
1068 c = c1 && (
|
|
1069 c2 ||
|
|
1070 c3
|
|
1071 ) && c4;
|
|
1072 if (
|
|
1073 c1 && c2
|
|
1074 )
|
|
1075 foo;
|
|
1076 }
|
|
1077
|
|
1078 STARTTEST
|
|
1079 :set cino=(s,m1
|
|
1080 2kdd]]=][
|
|
1081 ENDTEST
|
|
1082
|
|
1083 void f()
|
|
1084 {
|
|
1085 c = c1 && (
|
|
1086 c2 ||
|
|
1087 c3
|
|
1088 ) && c4;
|
|
1089 if (
|
|
1090 c1 && c2
|
|
1091 )
|
|
1092 foo;
|
|
1093 }
|
|
1094
|
|
1095 STARTTEST
|
|
1096 :set cino=b1
|
|
1097 2kdd]]=][
|
|
1098 ENDTEST
|
|
1099
|
|
1100 void f()
|
|
1101 {
|
|
1102 switch (x)
|
|
1103 {
|
|
1104 case 1:
|
|
1105 a = b;
|
|
1106 break;
|
|
1107 default:
|
|
1108 a = 0;
|
|
1109 break;
|
|
1110 }
|
|
1111 }
|
|
1112
|
|
1113 STARTTEST
|
|
1114 :set cino=(0,W5
|
|
1115 2kdd]]=][
|
|
1116 ENDTEST
|
|
1117
|
|
1118 void f()
|
|
1119 {
|
|
1120 invokeme(
|
|
1121 argu,
|
|
1122 ment);
|
|
1123 invokeme(
|
|
1124 argu,
|
|
1125 ment
|
|
1126 );
|
|
1127 invokeme(argu,
|
|
1128 ment
|
|
1129 );
|
|
1130 }
|
|
1131
|
|
1132 STARTTEST
|
|
1133 :set cino=/6
|
|
1134 2kdd]]=][
|
|
1135 ENDTEST
|
|
1136
|
|
1137 void f()
|
|
1138 {
|
|
1139 statement;
|
|
1140 // comment 1
|
|
1141 // comment 2
|
|
1142 }
|
|
1143
|
|
1144 STARTTEST
|
|
1145 :set cino=
|
|
1146 2kdd]]/comment 1/+1
|
|
1147 ==
|
|
1148 ENDTEST
|
|
1149
|
|
1150 void f()
|
|
1151 {
|
|
1152 statement;
|
|
1153 // comment 1
|
|
1154 // comment 2
|
|
1155 }
|
|
1156
|
|
1157 STARTTEST
|
|
1158 :set cino=g0
|
|
1159 2kdd]]=][
|
|
1160 ENDTEST
|
|
1161
|
|
1162 class CAbc
|
|
1163 {
|
|
1164 int Test() { return FALSE; }
|
|
1165
|
|
1166 public: // comment
|
|
1167 void testfall();
|
|
1168 protected:
|
|
1169 void testfall();
|
|
1170 };
|
|
1171
|
|
1172 STARTTEST
|
|
1173 :set cino=(0,W2s
|
|
1174 2kdd]]=][
|
|
1175 ENDTEST
|
|
1176
|
|
1177 {
|
|
1178 averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd(
|
|
1179 asdasdf,
|
|
1180 func(asdf,
|
|
1181 asdfadsf),
|
|
1182 asdfasdf
|
|
1183 );
|
|
1184
|
|
1185 /* those are ugly, but consequent */
|
|
1186
|
|
1187 func()->asd(asdasdf,
|
|
1188 averylongfunctionname(
|
|
1189 abc,
|
|
1190 dec)->averylongfunctionname(
|
|
1191 asdfadsf,
|
|
1192 asdfasdf,
|
|
1193 asdfasdf,
|
|
1194 ),
|
|
1195 func(asdfadf,
|
|
1196 asdfasdf
|
|
1197 ),
|
|
1198 asdasdf
|
|
1199 );
|
|
1200
|
|
1201 averylongfunctionnameaverylongfunctionnameavery()->asd(fasdf(
|
|
1202 abc,
|
|
1203 dec)->asdfasdfasdf(
|
|
1204 asdfadsf,
|
|
1205 asdfasdf,
|
|
1206 asdfasdf,
|
|
1207 ),
|
|
1208 func(asdfadf,
|
|
1209 asdfasdf),
|
|
1210 asdasdf
|
|
1211 );
|
|
1212 }
|
|
1213
|
|
1214 STARTTEST
|
|
1215 :g/^STARTTEST/.,/^ENDTEST/d
|
|
1216 :1;/start of AUTO/,$wq! test.out
|
|
1217 ENDTEST
|