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