Home | History | Annotate | Line # | Download | only in indent
lsym_comment.c revision 1.4
      1  1.4  rillig /* $NetBSD: lsym_comment.c,v 1.4 2022/04/24 10:36:37 rillig Exp $ */
      2  1.1  rillig 
      3  1.1  rillig /*
      4  1.1  rillig  * Tests for the token lsym_comment, which starts a comment.
      5  1.1  rillig  *
      6  1.1  rillig  * C11 distinguishes block comments and end-of-line comments.  Indent further
      7  1.1  rillig  * distinguishes box comments that are a special kind of block comments.
      8  1.1  rillig  *
      9  1.1  rillig  * See also:
     10  1.1  rillig  *	opt_fc1.c
     11  1.1  rillig  *	token_comment.c
     12  1.1  rillig  */
     13  1.1  rillig 
     14  1.4  rillig /*-
     15  1.4  rillig  * TODO: systematically test comments
     16  1.4  rillig  *
     17  1.4  rillig  * - starting in column 1, with opt.format_col1_comments (-fc1)
     18  1.4  rillig  * - starting in column 1, without opt.format_col1_comments (-fc1)
     19  1.4  rillig  * - starting in column 9, independent of opt.format_col1_comments (-fc1)
     20  1.4  rillig  * - starting in column 33, the default
     21  1.4  rillig  * - starting in column 65, which is already close to the default right margin
     22  1.4  rillig  * - starting in column 81, spilling into the right margin
     23  1.4  rillig  *
     24  1.4  rillig  * - block comment starting with '/' '*' '-'
     25  1.4  rillig  * - block comment starting with '/' '*' '*'
     26  1.4  rillig  * - block comment starting with '/' '*' '\n'
     27  1.4  rillig  * - end-of-line comment starting with '//'
     28  1.4  rillig  * - end-of-line comment starting with '//x', so without leading space
     29  1.4  rillig  * - block comment starting with '/' '*' 'x', so without leading space
     30  1.4  rillig  *
     31  1.4  rillig  * - block/end-of-line comment to the right of a label
     32  1.4  rillig  * - block/end-of-line comment to the right of code
     33  1.4  rillig  * - block/end-of-line comment to the right of label with code
     34  1.4  rillig  *
     35  1.4  rillig  * - with/without opt.comment_delimiter_on_blankline (-cdb)
     36  1.4  rillig  * - with/without opt.star_comment_cont (-sc)
     37  1.4  rillig  * - with/without opt.format_block_comments (-fbc)
     38  1.4  rillig  * - with varying opt.max_line_length (32, 64, 80, 140)
     39  1.4  rillig  * - with varying opt.unindent_displace (-d0, -d2, -d-5)
     40  1.4  rillig  * - with varying opt.indent_size (3, 4, 8)
     41  1.4  rillig  * - with varying opt.tabsize (3, 4, 8, 16)
     42  1.4  rillig  * - with varying opt.block_comment_max_line_length (-lc60, -lc78, -lc90)
     43  1.4  rillig  * - with varying opt.comment_column (-c0, -c1, -c33, -c80)
     44  1.4  rillig  * - with varying opt.decl_comment_column (-cd0, -cd1, -cd20, -cd33, -cd80)
     45  1.4  rillig  * - with/without ps.decl_on_line
     46  1.4  rillig  * - with/without ps.next_col_1
     47  1.4  rillig  *
     48  1.4  rillig  * - very long comments that overflow the buffer 'com'
     49  1.4  rillig  * - comments that come from save_com
     50  1.4  rillig  * - very long word that already spills over the right margin
     51  1.4  rillig  * - wrap/nowrap comment containing '\n'
     52  1.4  rillig  * - wrap/nowrap comment containing '\f'
     53  1.4  rillig  * - wrap/nowrap comment containing '\t'
     54  1.4  rillig  * - wrap/nowrap comment containing '\b'
     55  1.4  rillig  */
     56  1.4  rillig 
     57  1.4  rillig //indent input
     58  1.4  rillig typedef enum x {
     59  1.4  rillig 	aaaaaaaaaaaaaaaaaaaaaa = 1 << 0,	/* test a */
     60  1.4  rillig 	bbbbbbbbbbbbbbbbb = 1 << 1,	/* test b */
     61  1.4  rillig 	cccccccccccccc = 1 << 1,	/* test c */
     62  1.4  rillig 	dddddddddddddddddddddddddddddd = 1 << 2	/* test d */
     63  1.4  rillig } x;
     64  1.4  rillig //indent end
     65  1.4  rillig 
     66  1.4  rillig //indent run-equals-input -bbb
     67  1.4  rillig 
     68  1.4  rillig 
     69  1.4  rillig //indent input
     70  1.4  rillig /* See FreeBSD r303597, r303598, r309219, and r309343 */
     71  1.4  rillig void
     72  1.4  rillig t(void) {
     73  1.4  rillig 	/*
     74  1.4  rillig 	 * Old indent wrapped the URL near where this sentence ends.
     75  1.4  rillig 	 *
     76  1.4  rillig 	 * https://www.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=FreeBSD+12-current&arch=default&format=html
     77  1.4  rillig 	 */
     78  1.4  rillig 
     79  1.4  rillig 	/*
     80  1.4  rillig 	 * The default maximum line length for comments is 78, and the 'kk' at
     81  1.4  rillig 	 * the end makes the line exactly 78 bytes long.
     82  1.4  rillig 	 *
     83  1.4  rillig 	 * aaaaaa bbbbbb cccccc dddddd eeeeee ffffff ggggg hhhhh iiiii jjjj kk
     84  1.4  rillig 	 */
     85  1.4  rillig 
     86  1.4  rillig 	/*
     87  1.4  rillig 	 * Old indent unnecessarily removed the star comment continuation on the next line.
     88  1.4  rillig 	 *
     89  1.4  rillig 	 * *test*
     90  1.4  rillig 	 */
     91  1.4  rillig 
     92  1.4  rillig 	/* r309219 Go through linked list, freeing from the malloced (t[-1]) address. */
     93  1.4  rillig 
     94  1.4  rillig 	/* r309343	*/
     95  1.4  rillig }
     96  1.4  rillig //indent end
     97  1.4  rillig 
     98  1.4  rillig //indent run -bbb
     99  1.4  rillig /* See FreeBSD r303597, r303598, r309219, and r309343 */
    100  1.4  rillig void
    101  1.4  rillig t(void)
    102  1.4  rillig {
    103  1.4  rillig 	/*
    104  1.4  rillig 	 * Old indent wrapped the URL near where this sentence ends.
    105  1.4  rillig 	 *
    106  1.4  rillig 	 * https://www.freebsd.org/cgi/man.cgi?query=indent&apropos=0&sektion=0&manpath=FreeBSD+12-current&arch=default&format=html
    107  1.4  rillig 	 */
    108  1.4  rillig 
    109  1.4  rillig 	/*
    110  1.4  rillig 	 * The default maximum line length for comments is 78, and the 'kk' at
    111  1.4  rillig 	 * the end makes the line exactly 78 bytes long.
    112  1.4  rillig 	 *
    113  1.4  rillig 	 * aaaaaa bbbbbb cccccc dddddd eeeeee ffffff ggggg hhhhh iiiii jjjj kk
    114  1.4  rillig 	 */
    115  1.4  rillig 
    116  1.4  rillig 	/*
    117  1.4  rillig 	 * Old indent unnecessarily removed the star comment continuation on
    118  1.4  rillig 	 * the next line.
    119  1.4  rillig 	 *
    120  1.4  rillig 	 * *test*
    121  1.4  rillig 	 */
    122  1.4  rillig 
    123  1.4  rillig 	/*
    124  1.4  rillig 	 * r309219 Go through linked list, freeing from the malloced (t[-1])
    125  1.4  rillig 	 * address.
    126  1.4  rillig 	 */
    127  1.4  rillig 
    128  1.4  rillig 	/* r309343	*/
    129  1.4  rillig }
    130  1.4  rillig //indent end
    131  1.4  rillig 
    132  1.4  rillig 
    133  1.4  rillig /*
    134  1.4  rillig  * The first Christmas tree is to the right of the code, therefore the comment
    135  1.4  rillig  * is moved to the code comment column; the follow-up lines of that comment
    136  1.4  rillig  * are moved by the same distance, to preserve the internal layout.
    137  1.4  rillig  *
    138  1.4  rillig  * The other Christmas tree is a standalone block comment, therefore the
    139  1.4  rillig  * comment starts in the code column.
    140  1.4  rillig  *
    141  1.4  rillig  * Since the comments occur between psym_if_expr and the following statement,
    142  1.4  rillig  * they are handled by search_stmt_comment.
    143  1.4  rillig  */
    144  1.4  rillig //indent input
    145  1.4  rillig {
    146  1.4  rillig 	if (1) /*- a Christmas tree  *  search_stmt_comment
    147  1.4  rillig 				    ***
    148  1.4  rillig 				   ***** */
    149  1.4  rillig 		    /*- another one *  search_stmt_comment
    150  1.4  rillig 				   ***
    151  1.4  rillig 				  ***** */
    152  1.4  rillig 		1;
    153  1.4  rillig }
    154  1.4  rillig //indent end
    155  1.4  rillig 
    156  1.4  rillig //indent run -bbb
    157  1.4  rillig {
    158  1.4  rillig 	if (1)			/*- a Christmas tree  *  search_stmt_comment
    159  1.4  rillig 						     ***
    160  1.4  rillig 						    ***** */
    161  1.4  rillig 		/*- another one *  search_stmt_comment
    162  1.4  rillig 			       ***
    163  1.4  rillig 			      ***** */
    164  1.4  rillig 		1;
    165  1.4  rillig }
    166  1.4  rillig //indent end
    167  1.4  rillig 
    168  1.4  rillig 
    169  1.4  rillig /*
    170  1.4  rillig  * The first Christmas tree is to the right of the code, therefore the comment
    171  1.4  rillig  * is moved to the code comment column; the follow-up lines of that comment
    172  1.4  rillig  * are moved by the same distance, to preserve the internal layout.
    173  1.4  rillig  *
    174  1.4  rillig  * The other Christmas tree is a standalone block comment, therefore the
    175  1.4  rillig  * comment starts in the code column.
    176  1.4  rillig  */
    177  1.4  rillig //indent input
    178  1.4  rillig {
    179  1.4  rillig 	if (7) { /*- a Christmas tree  *
    180  1.4  rillig 				      ***
    181  1.4  rillig 				     ***** */
    182  1.4  rillig 		    /*- another one *
    183  1.4  rillig 				   ***
    184  1.4  rillig 				  ***** */
    185  1.4  rillig 		stmt();
    186  1.4  rillig 	}
    187  1.4  rillig }
    188  1.4  rillig //indent end
    189  1.4  rillig 
    190  1.4  rillig //indent run -bbb
    191  1.4  rillig {
    192  1.4  rillig 	if (7) {		/*- a Christmas tree  *
    193  1.4  rillig 					             ***
    194  1.4  rillig 					            ***** */
    195  1.4  rillig 		/*- another one *
    196  1.4  rillig 			       ***
    197  1.4  rillig 			      ***** */
    198  1.4  rillig 		stmt();
    199  1.4  rillig 	}
    200  1.4  rillig }
    201  1.4  rillig //indent end
    202  1.4  rillig 
    203  1.4  rillig 
    204  1.4  rillig //indent input
    205  1.4  rillig int decl;/*-fixed comment
    206  1.4  rillig 	    fixed comment*/
    207  1.4  rillig //indent end
    208  1.4  rillig 
    209  1.4  rillig //indent run -di0
    210  1.4  rillig int decl;			/*-fixed comment
    211  1.4  rillig 			           fixed comment*/
    212  1.4  rillig //indent end
    213  1.4  rillig /*
    214  1.4  rillig  * XXX: The second line of the above comment contains 11 spaces in a row,
    215  1.4  rillig  * instead of using as many tabs as possible.
    216  1.4  rillig  */
    217  1.4  rillig 
    218  1.4  rillig 
    219  1.4  rillig //indent input
    220  1.4  rillig {
    221  1.4  rillig 	if (0)/*-search_stmt_comment   |
    222  1.4  rillig 	   search_stmt_comment         |*/
    223  1.4  rillig 		;
    224  1.4  rillig }
    225  1.4  rillig //indent end
    226  1.4  rillig 
    227  1.4  rillig //indent run -di0
    228  1.4  rillig {
    229  1.4  rillig 	if (0)			/*-search_stmt_comment   |
    230  1.4  rillig 			     search_stmt_comment         |*/
    231  1.4  rillig 		;
    232  1.4  rillig }
    233  1.4  rillig //indent end
    234  1.4  rillig 
    235  1.4  rillig 
    236  1.4  rillig /*
    237  1.4  rillig  * Ensure that all text of the comment is preserved when the comment is moved
    238  1.4  rillig  * to the right.
    239  1.4  rillig  */
    240  1.4  rillig //indent input
    241  1.4  rillig int decl;/*-fixed comment
    242  1.4  rillig 123456789ab fixed comment*/
    243  1.4  rillig //indent end
    244  1.4  rillig 
    245  1.4  rillig //indent run -di0
    246  1.4  rillig int decl;			/*-fixed comment
    247  1.4  rillig 		       123456789ab fixed comment*/
    248  1.4  rillig //indent end
    249  1.4  rillig 
    250  1.4  rillig 
    251  1.4  rillig /*
    252  1.4  rillig  * Ensure that all text of the comment is preserved when the comment is moved
    253  1.4  rillig  * to the right.
    254  1.4  rillig  *
    255  1.4  rillig  * This comment is handled by search_stmt_comment.
    256  1.4  rillig  */
    257  1.4  rillig //indent input
    258  1.4  rillig {
    259  1.4  rillig 	if(0)/*-search_stmt_comment
    260  1.4  rillig 123456789ab search_stmt_comment   |*/
    261  1.4  rillig 	    ;
    262  1.4  rillig }
    263  1.4  rillig //indent end
    264  1.4  rillig 
    265  1.4  rillig //indent run -di0
    266  1.4  rillig {
    267  1.4  rillig 	if (0)			/*-search_stmt_comment
    268  1.4  rillig 		   123456789ab search_stmt_comment   |*/
    269  1.4  rillig 		;
    270  1.4  rillig }
    271  1.4  rillig //indent end
    272  1.4  rillig 
    273  1.4  rillig 
    274  1.4  rillig /*
    275  1.4  rillig  * Ensure that all text of the comment is preserved when the comment is moved
    276  1.4  rillig  * to the left. In this case, the internal layout of the comment cannot be
    277  1.4  rillig  * preserved since the second line already starts in column 1.
    278  1.4  rillig  */
    279  1.4  rillig //indent input
    280  1.4  rillig int decl;					    /*-|fixed comment
    281  1.4  rillig 					| minus 12     |
    282  1.4  rillig 		| tabs inside		|
    283  1.4  rillig 	    |---|
    284  1.4  rillig |-----------|
    285  1.4  rillig tab1+++	tab2---	tab3+++	tab4---	tab5+++	tab6---	tab7+++fixed comment*/
    286  1.4  rillig //indent end
    287  1.4  rillig 
    288  1.4  rillig //indent run -di0
    289  1.4  rillig int decl;			/*-|fixed comment
    290  1.4  rillig 		    | minus 12     |
    291  1.4  rillig | tabs inside		|
    292  1.4  rillig |---|
    293  1.4  rillig |-----------|
    294  1.4  rillig tab1+++	tab2---	tab3+++	tab4---	tab5+++	tab6---	tab7+++fixed comment*/
    295  1.4  rillig //indent end
    296  1.4  rillig 
    297  1.4  rillig 
    298  1.4  rillig /*
    299  1.4  rillig  * Ensure that all text of the comment is preserved when the comment is moved
    300  1.4  rillig  * to the left. In this case, the internal layout of the comment cannot be
    301  1.4  rillig  * preserved since the second line already starts in column 1.
    302  1.4  rillig  *
    303  1.4  rillig  * This comment is processed by search_stmt_comment.
    304  1.4  rillig  */
    305  1.4  rillig //indent input
    306  1.4  rillig {
    307  1.4  rillig 	if(0)					    /*-|search_stmt_comment
    308  1.4  rillig 					| minus 12     |
    309  1.4  rillig 		| tabs inside		|
    310  1.4  rillig 	    |---|
    311  1.4  rillig |-----------|
    312  1.4  rillig tab1+++	tab2---	tab3+++	tab4---	tab5+++	tab6---	tab7+++fixed comment*/
    313  1.4  rillig 		;
    314  1.4  rillig }
    315  1.4  rillig //indent end
    316  1.4  rillig 
    317  1.4  rillig //indent run -di0
    318  1.4  rillig {
    319  1.4  rillig 	if (0)			/*-|search_stmt_comment
    320  1.4  rillig 		    | minus 12     |
    321  1.4  rillig | tabs inside		|
    322  1.4  rillig |---|
    323  1.4  rillig |-----------|
    324  1.4  rillig tab1+++	tab2---	tab3+++	tab4---	tab5+++	tab6---	tab7+++fixed comment*/
    325  1.4  rillig 		;
    326  1.4  rillig }
    327  1.4  rillig //indent end
    328  1.4  rillig 
    329  1.4  rillig 
    330  1.4  rillig /*
    331  1.4  rillig  * Ensure that '{' after a search_stmt_comment is preserved.
    332  1.4  rillig  */
    333  1.4  rillig //indent input
    334  1.4  rillig {
    335  1.4  rillig 	if(0)/*comment*/{
    336  1.4  rillig 	}
    337  1.4  rillig }
    338  1.4  rillig //indent end
    339  1.4  rillig 
    340  1.4  rillig /* The comment in the output has moved to the right of the '{'. */
    341  1.4  rillig //indent run
    342  1.4  rillig {
    343  1.4  rillig 	if (0) {		/* comment */
    344  1.4  rillig 	}
    345  1.4  rillig }
    346  1.4  rillig //indent end
    347  1.4  rillig 
    348  1.4  rillig 
    349  1.4  rillig /*
    350  1.4  rillig  * The following comments test line breaking when the comment ends with a
    351  1.4  rillig  * space.
    352  1.4  rillig  */
    353  1.4  rillig //indent input
    354  1.4  rillig /* 456789 123456789 123456789 12345 */
    355  1.4  rillig /* 456789 123456789 123456789 123456 */
    356  1.4  rillig /* 456789 123456789 123456789 1234567 */
    357  1.4  rillig /* 456789 123456789 123456789 12345678 */
    358  1.4  rillig /* 456789 123456789 123456789 123456789 */
    359  1.4  rillig //indent end
    360  1.4  rillig 
    361  1.4  rillig //indent run -l38
    362  1.4  rillig /* 456789 123456789 123456789 12345 */
    363  1.4  rillig /*
    364  1.4  rillig  * 456789 123456789 123456789 123456
    365  1.4  rillig  */
    366  1.4  rillig /*
    367  1.4  rillig  * 456789 123456789 123456789 1234567
    368  1.4  rillig  */
    369  1.4  rillig /*
    370  1.4  rillig  * 456789 123456789 123456789 12345678
    371  1.4  rillig  */
    372  1.4  rillig /*
    373  1.4  rillig  * 456789 123456789 123456789
    374  1.4  rillig  * 123456789
    375  1.4  rillig  */
    376  1.4  rillig //indent end
    377  1.4  rillig 
    378  1.4  rillig 
    379  1.4  rillig /*
    380  1.4  rillig  * The following comments test line breaking when the comment does not end
    381  1.4  rillig  * with a space. Since indent adds a trailing space to a single-line comment,
    382  1.4  rillig  * this space has to be taken into account when computing the line length.
    383  1.4  rillig  */
    384  1.4  rillig //indent input
    385  1.4  rillig /* x		. line length 35*/
    386  1.4  rillig /* x		.. line length 36*/
    387  1.4  rillig /* x		... line length 37*/
    388  1.4  rillig /* x		.... line length 38*/
    389  1.4  rillig /* x		..... line length 39*/
    390  1.4  rillig /* x		...... line length 40*/
    391  1.4  rillig /* x		....... line length 41*/
    392  1.4  rillig /* x		........ line length 42*/
    393  1.4  rillig //indent end
    394  1.4  rillig 
    395  1.4  rillig //indent run -l38
    396  1.4  rillig /* x		. line length 35 */
    397  1.4  rillig /* x		.. line length 36 */
    398  1.4  rillig /* x		... line length 37 */
    399  1.4  rillig /* x		.... line length 38 */
    400  1.4  rillig /*
    401  1.4  rillig  * x		..... line length 39
    402  1.4  rillig  */
    403  1.4  rillig /*
    404  1.4  rillig  * x		...... line length 40
    405  1.4  rillig  */
    406  1.4  rillig /*
    407  1.4  rillig  * x		....... line length 41
    408  1.4  rillig  */
    409  1.4  rillig /*
    410  1.4  rillig  * x		........ line length 42
    411  1.4  rillig  */
    412  1.4  rillig //indent end
    413  1.4  rillig 
    414  1.4  rillig 
    415  1.4  rillig /*
    416  1.4  rillig  * The different types of comments that indent distinguishes, starting in
    417  1.4  rillig  * column 1 (see options '-fc1' and '-nfc1').
    418  1.4  rillig  */
    419  1.4  rillig //indent input
    420  1.4  rillig /* This is a traditional C block comment. */
    421  1.4  rillig 
    422  1.4  rillig // This is a C99 line comment.
    423  1.4  rillig 
    424  1.4  rillig /*
    425  1.4  rillig  * This is a box comment since its first line (the one above this line) is
    426  1.4  rillig  * empty.
    427  1.4  rillig  *
    428  1.4  rillig  *
    429  1.4  rillig  *
    430  1.4  rillig  * Its text gets wrapped.
    431  1.4  rillig  * Empty lines serve as paragraphs.
    432  1.4  rillig  */
    433  1.4  rillig 
    434  1.4  rillig /**
    435  1.4  rillig  * This is a box comment
    436  1.4  rillig  * that is not re-wrapped.
    437  1.4  rillig  */
    438  1.4  rillig 
    439  1.4  rillig /*-
    440  1.4  rillig  * This is a box comment
    441  1.4  rillig  * that is not re-wrapped.
    442  1.4  rillig  * It is often used for copyright declarations.
    443  1.4  rillig  */
    444  1.4  rillig //indent end
    445  1.4  rillig 
    446  1.4  rillig //indent run
    447  1.4  rillig /* This is a traditional C block comment. */
    448  1.4  rillig 
    449  1.4  rillig // This is a C99 line comment.
    450  1.4  rillig 
    451  1.4  rillig /*
    452  1.4  rillig  * This is a box comment since its first line (the one above this line) is
    453  1.4  rillig  * empty.
    454  1.4  rillig  *
    455  1.4  rillig  *
    456  1.4  rillig  *
    457  1.4  rillig  * Its text gets wrapped. Empty lines serve as paragraphs.
    458  1.4  rillig  */
    459  1.4  rillig 
    460  1.4  rillig /**
    461  1.4  rillig  * This is a box comment
    462  1.4  rillig  * that is not re-wrapped.
    463  1.4  rillig  */
    464  1.4  rillig 
    465  1.4  rillig /*-
    466  1.4  rillig  * This is a box comment
    467  1.4  rillig  * that is not re-wrapped.
    468  1.4  rillig  * It is often used for copyright declarations.
    469  1.4  rillig  */
    470  1.4  rillig //indent end
    471  1.4  rillig 
    472  1.4  rillig 
    473  1.4  rillig /*
    474  1.4  rillig  * The different types of comments that indent distinguishes, starting in
    475  1.4  rillig  * column 9, so they are independent of the option '-fc1'.
    476  1.4  rillig  */
    477  1.4  rillig //indent input
    478  1.4  rillig void
    479  1.4  rillig function(void)
    480  1.4  rillig {
    481  1.4  rillig 	/* This is a traditional C block comment. */
    482  1.4  rillig 
    483  1.4  rillig 	/*
    484  1.4  rillig 	 * This is a box comment.
    485  1.4  rillig 	 *
    486  1.4  rillig 	 * It starts in column 9, not 1,
    487  1.4  rillig 	 * therefore it gets re-wrapped.
    488  1.4  rillig 	 */
    489  1.4  rillig 
    490  1.4  rillig 	/**
    491  1.4  rillig 	 * This is a box comment
    492  1.4  rillig 	 * that is not re-wrapped, even though it starts in column 9, not 1.
    493  1.4  rillig 	 */
    494  1.4  rillig 
    495  1.4  rillig 	/*-
    496  1.4  rillig 	 * This is a box comment
    497  1.4  rillig 	 * that is not re-wrapped.
    498  1.4  rillig 	 */
    499  1.4  rillig }
    500  1.4  rillig //indent end
    501  1.4  rillig 
    502  1.4  rillig //indent run
    503  1.4  rillig void
    504  1.4  rillig function(void)
    505  1.4  rillig {
    506  1.4  rillig 	/* This is a traditional C block comment. */
    507  1.4  rillig 
    508  1.4  rillig 	/*
    509  1.4  rillig 	 * This is a box comment.
    510  1.4  rillig 	 *
    511  1.4  rillig 	 * It starts in column 9, not 1, therefore it gets re-wrapped.
    512  1.4  rillig 	 */
    513  1.4  rillig 
    514  1.4  rillig 	/**
    515  1.4  rillig 	 * This is a box comment
    516  1.4  rillig 	 * that is not re-wrapped, even though it starts in column 9, not 1.
    517  1.4  rillig 	 */
    518  1.4  rillig 
    519  1.4  rillig 	/*-
    520  1.4  rillig 	 * This is a box comment
    521  1.4  rillig 	 * that is not re-wrapped.
    522  1.4  rillig 	 */
    523  1.4  rillig }
    524  1.4  rillig //indent end
    525  1.4  rillig 
    526  1.4  rillig 
    527  1.4  rillig /*
    528  1.4  rillig  * Comments to the right of declarations.
    529  1.4  rillig  */
    530  1.4  rillig //indent input
    531  1.4  rillig void
    532  1.4  rillig function(void)
    533  1.4  rillig {
    534  1.4  rillig 	int decl;	/* declaration comment */
    535  1.4  rillig 
    536  1.4  rillig 	int decl;	/* short
    537  1.4  rillig 			 * multi-line
    538  1.4  rillig 			 * declaration
    539  1.4  rillig 			 * comment */
    540  1.4  rillig 
    541  1.4  rillig 	int decl;	/* long single-line declaration comment that is longer than the allowed line width */
    542  1.4  rillig 
    543  1.4  rillig 	int decl;	/* long multi-line declaration comment
    544  1.4  rillig  * that is longer than
    545  1.4  rillig  * the allowed line width */
    546  1.4  rillig 
    547  1.4  rillig 	int decl;	// C99 declaration comment
    548  1.4  rillig 
    549  1.4  rillig 	{
    550  1.4  rillig 		int decl;	/* indented declaration */
    551  1.4  rillig 		{
    552  1.4  rillig 			int decl;	/* indented declaration */
    553  1.4  rillig 			{
    554  1.4  rillig 				int decl;	/* indented declaration */
    555  1.4  rillig 				{
    556  1.4  rillig 					int decl;	/* indented declaration */
    557  1.4  rillig 				}
    558  1.4  rillig 			}
    559  1.4  rillig 		}
    560  1.4  rillig 	}
    561  1.4  rillig }
    562  1.4  rillig //indent end
    563  1.4  rillig 
    564  1.4  rillig //indent run -ldi0
    565  1.4  rillig void
    566  1.4  rillig function(void)
    567  1.4  rillig {
    568  1.4  rillig 	int decl;		/* declaration comment */
    569  1.4  rillig 
    570  1.4  rillig 	int decl;		/* short multi-line declaration comment */
    571  1.4  rillig 
    572  1.4  rillig 	int decl;		/* long single-line declaration comment that
    573  1.4  rillig 				 * is longer than the allowed line width */
    574  1.4  rillig 
    575  1.4  rillig 	int decl;		/* long multi-line declaration comment that is
    576  1.4  rillig 				 * longer than the allowed line width */
    577  1.4  rillig 
    578  1.4  rillig 	int decl;		// C99 declaration comment
    579  1.4  rillig 
    580  1.4  rillig 	{
    581  1.4  rillig 		int decl;	/* indented declaration */
    582  1.4  rillig 		{
    583  1.4  rillig 			int decl;	/* indented declaration */
    584  1.4  rillig 			{
    585  1.4  rillig 				int decl;	/* indented declaration */
    586  1.4  rillig 				{
    587  1.4  rillig 					int decl;	/* indented declaration */
    588  1.4  rillig 				}
    589  1.4  rillig 			}
    590  1.4  rillig 		}
    591  1.4  rillig 	}
    592  1.4  rillig }
    593  1.4  rillig //indent end
    594  1.4  rillig 
    595  1.4  rillig 
    596  1.4  rillig /*
    597  1.4  rillig  * Comments to the right of code.
    598  1.4  rillig  */
    599  1.4  rillig //indent input
    600  1.4  rillig void
    601  1.4  rillig function(void)
    602  1.4  rillig {
    603  1.4  rillig 	code();			/* code comment */
    604  1.4  rillig 	code();			/* code comment _________ to line length 78 */
    605  1.4  rillig 	code();			/* code comment __________ to line length 79 */
    606  1.4  rillig 	code();			/* code comment ___________ to line length 80 */
    607  1.4  rillig 	code();			/* code comment ____________ to line length 81 */
    608  1.4  rillig 	code();			/* code comment _____________ to line length 82 */
    609  1.4  rillig 
    610  1.4  rillig /* $ In the following comments, the line length is measured after formatting. */
    611  1.4  rillig 	code();			/* code comment _________ to line length 78*/
    612  1.4  rillig 	code();			/* code comment __________ to line length 79*/
    613  1.4  rillig 	code();			/* code comment ___________ to line length 80*/
    614  1.4  rillig 	code();			/* code comment ____________ to line length 81*/
    615  1.4  rillig 	code();			/* code comment _____________ to line length 82*/
    616  1.4  rillig 
    617  1.4  rillig 	code();			/* short
    618  1.4  rillig 				 * multi-line
    619  1.4  rillig 				 * code
    620  1.4  rillig 				 * comment */
    621  1.4  rillig 
    622  1.4  rillig 	code();			/* long single-line code comment that is longer than the allowed line width */
    623  1.4  rillig 
    624  1.4  rillig 	code();			/* long multi-line code comment
    625  1.4  rillig  * that is longer than
    626  1.4  rillig  * the allowed line width */
    627  1.4  rillig 
    628  1.4  rillig 	code();			// C99 code comment
    629  1.4  rillig 	code();			// C99 code comment ________ to line length 78
    630  1.4  rillig 	code();			// C99 code comment _________ to line length 79
    631  1.4  rillig 	code();			// C99 code comment __________ to line length 80
    632  1.4  rillig 	code();			// C99 code comment ___________ to line length 81
    633  1.4  rillig 	code();			// C99 code comment ____________ to line length 82
    634  1.4  rillig 
    635  1.4  rillig 	if (cond) /* comment */
    636  1.4  rillig 		if (cond) /* comment */
    637  1.4  rillig 			if (cond) /* comment */
    638  1.4  rillig 				if (cond) /* comment */
    639  1.4  rillig 					if (cond) /* comment */
    640  1.4  rillig 						code(); /* comment */
    641  1.4  rillig }
    642  1.4  rillig //indent end
    643  1.4  rillig 
    644  1.4  rillig //indent run
    645  1.4  rillig void
    646  1.4  rillig function(void)
    647  1.4  rillig {
    648  1.4  rillig 	code();			/* code comment */
    649  1.4  rillig 	code();			/* code comment _________ to line length 78 */
    650  1.4  rillig 	code();			/* code comment __________ to line length 79 */
    651  1.4  rillig 	code();			/* code comment ___________ to line length 80 */
    652  1.4  rillig 	code();			/* code comment ____________ to line length 81 */
    653  1.4  rillig 	code();			/* code comment _____________ to line length
    654  1.4  rillig 				 * 82 */
    655  1.4  rillig 
    656  1.4  rillig /* $ In the following comments, the line length is measured after formatting. */
    657  1.4  rillig 	code();			/* code comment _________ to line length 78 */
    658  1.4  rillig 	code();			/* code comment __________ to line length 79 */
    659  1.4  rillig 	code();			/* code comment ___________ to line length 80 */
    660  1.4  rillig 	code();			/* code comment ____________ to line length 81 */
    661  1.4  rillig 	code();			/* code comment _____________ to line length
    662  1.4  rillig 				 * 82 */
    663  1.4  rillig 
    664  1.4  rillig 	code();			/* short multi-line code comment */
    665  1.4  rillig 
    666  1.4  rillig 	code();			/* long single-line code comment that is
    667  1.4  rillig 				 * longer than the allowed line width */
    668  1.4  rillig 
    669  1.4  rillig 	code();			/* long multi-line code comment that is longer
    670  1.4  rillig 				 * than the allowed line width */
    671  1.4  rillig 
    672  1.4  rillig /* $ Trailing C99 comments are not wrapped, as indent would not correctly */
    673  1.4  rillig /* $ recognize the continuation lines as continued comments. For block */
    674  1.4  rillig /* $ comments this works since the comment has not ended yet. */
    675  1.4  rillig 	code();			// C99 code comment
    676  1.4  rillig 	code();			// C99 code comment ________ to line length 78
    677  1.4  rillig 	code();			// C99 code comment _________ to line length 79
    678  1.4  rillig 	code();			// C99 code comment __________ to line length 80
    679  1.4  rillig 	code();			// C99 code comment ___________ to line length 81
    680  1.4  rillig 	code();			// C99 code comment ____________ to line length 82
    681  1.4  rillig 
    682  1.4  rillig 	if (cond)		/* comment */
    683  1.4  rillig 		if (cond)	/* comment */
    684  1.4  rillig 			if (cond)	/* comment */
    685  1.4  rillig 				if (cond)	/* comment */
    686  1.4  rillig 					if (cond)	/* comment */
    687  1.4  rillig 						code();	/* comment */
    688  1.4  rillig }
    689  1.4  rillig //indent end
    690  1.4  rillig 
    691  1.4  rillig 
    692  1.4  rillig //indent input
    693  1.4  rillig /*
    694  1.4  rillig 	 * this
    695  1.4  rillig 		 * is a boxed
    696  1.4  rillig 			 * staircase.
    697  1.4  rillig *
    698  1.4  rillig * Its paragraphs get wrapped.
    699  1.4  rillig 
    700  1.4  rillig There may also be
    701  1.4  rillig 		lines without asterisks.
    702  1.4  rillig 
    703  1.4  rillig  */
    704  1.4  rillig //indent end
    705  1.4  rillig 
    706  1.4  rillig //indent run
    707  1.4  rillig /*
    708  1.4  rillig  * this is a boxed staircase.
    709  1.4  rillig  *
    710  1.4  rillig  * Its paragraphs get wrapped.
    711  1.4  rillig  *
    712  1.4  rillig  * There may also be lines without asterisks.
    713  1.4  rillig  *
    714  1.4  rillig  */
    715  1.4  rillig //indent end
    716  1.4  rillig 
    717  1.4  rillig 
    718  1.4  rillig //indent input
    719  1.4  rillig void loop(void)
    720  1.4  rillig {
    721  1.4  rillig while(cond)/*comment*/;
    722  1.4  rillig 
    723  1.4  rillig 	while(cond)
    724  1.4  rillig 	/*comment*/;
    725  1.4  rillig }
    726  1.4  rillig //indent end
    727  1.4  rillig 
    728  1.4  rillig //indent run
    729  1.4  rillig void
    730  1.4  rillig loop(void)
    731  1.4  rillig {
    732  1.4  rillig 	while (cond)		/* comment */
    733  1.4  rillig 		;
    734  1.4  rillig 
    735  1.4  rillig 	while (cond)
    736  1.4  rillig /* $ XXX: The spaces around the comment look unintentional. */
    737  1.4  rillig 		 /* comment */ ;
    738  1.4  rillig }
    739  1.4  rillig //indent end
    740  1.4  rillig 
    741  1.4  rillig 
    742  1.4  rillig /*
    743  1.4  rillig  * The following comment starts really far to the right. To avoid that each
    744  1.4  rillig  * line only contains a single word, the maximum allowed line width is
    745  1.4  rillig  * extended such that each comment line may contain 22 characters.
    746  1.4  rillig  */
    747  1.4  rillig //indent input
    748  1.4  rillig int		global_variable_with_really_long_name_that_reaches_up_to_column_83;	/* 1234567890123456789 1 1234567890123456789 12 1234567890123456789 123 1234567890123456789 1234 1234567890123456789 12345 1234567890123456789 123456 */
    749  1.4  rillig //indent end
    750  1.4  rillig 
    751  1.4  rillig //indent run
    752  1.4  rillig int		global_variable_with_really_long_name_that_reaches_up_to_column_83;	/* 1234567890123456789 1
    753  1.4  rillig 											 * 1234567890123456789 12
    754  1.4  rillig 											 * 1234567890123456789
    755  1.4  rillig 											 * 123
    756  1.4  rillig 											 * 1234567890123456789
    757  1.4  rillig 											 * 1234
    758  1.4  rillig 											 * 1234567890123456789
    759  1.4  rillig 											 * 12345
    760  1.4  rillig 											 * 1234567890123456789
    761  1.4  rillig 											 * 123456 */
    762  1.4  rillig //indent end
    763  1.4  rillig 
    764  1.4  rillig 
    765  1.4  rillig /*
    766  1.4  rillig  * Demonstrates handling of line-end '//' comments.
    767  1.4  rillig  *
    768  1.4  rillig  * Even though this type of comments had been added in C99, indent didn't
    769  1.4  rillig  * support these comments until 2021 and instead messed up the code in
    770  1.4  rillig  * seemingly unpredictable ways. It treated any sequence of '/' as a binary
    771  1.4  rillig  * operator, no matter whether it was '/' or '//' or '/////'.
    772  1.4  rillig  */
    773  1.4  rillig //indent input
    774  1.4  rillig int dummy // comment
    775  1.4  rillig     = // eq
    776  1.4  rillig     1		// one
    777  1.4  rillig     + // plus
    778  1.4  rillig     2;// two
    779  1.4  rillig 
    780  1.4  rillig /////separator/////
    781  1.4  rillig 
    782  1.4  rillig void function(void){}
    783  1.4  rillig 
    784  1.4  rillig // Note: removing one of these line-end comments affected the formatting
    785  1.4  rillig // of the main function below, before indent supported '//' comments.
    786  1.4  rillig 
    787  1.4  rillig int
    788  1.4  rillig main(void)
    789  1.4  rillig {
    790  1.4  rillig }
    791  1.4  rillig //indent end
    792  1.4  rillig 
    793  1.4  rillig //indent run
    794  1.4  rillig int		dummy		// comment
    795  1.4  rillig =				// eq
    796  1.4  rillig 1				// one
    797  1.4  rillig +				// plus
    798  1.4  rillig 2;				// two
    799  1.4  rillig 
    800  1.4  rillig /////separator/////
    801  1.4  rillig 
    802  1.4  rillig void
    803  1.4  rillig function(void)
    804  1.4  rillig {
    805  1.4  rillig }
    806  1.4  rillig 
    807  1.4  rillig // Note: removing one of these line-end comments affected the formatting
    808  1.4  rillig // of the main function below, before indent supported '//' comments.
    809  1.4  rillig 
    810  1.4  rillig int
    811  1.4  rillig main(void)
    812  1.4  rillig {
    813  1.4  rillig }
    814  1.4  rillig //indent end
    815  1.4  rillig 
    816  1.4  rillig 
    817  1.4  rillig /*
    818  1.4  rillig  * Between March 2021 and October 2021, indent supported C99 comments only
    819  1.4  rillig  * very basically. It messed up the following code, repeating the identifier
    820  1.4  rillig  * 'bar' twice in a row.
    821  1.4  rillig  */
    822  1.4  rillig //indent input
    823  1.4  rillig void c99_comment(void)
    824  1.4  rillig {
    825  1.4  rillig foo(); // C99 comment
    826  1.4  rillig bar();
    827  1.4  rillig }
    828  1.4  rillig //indent end
    829  1.4  rillig 
    830  1.4  rillig //indent run
    831  1.4  rillig void
    832  1.4  rillig c99_comment(void)
    833  1.4  rillig {
    834  1.4  rillig 	foo();			// C99 comment
    835  1.4  rillig 	bar();
    836  1.4  rillig }
    837  1.4  rillig //indent end
    838  1.4  rillig 
    839  1.4  rillig 
    840  1.3  rillig //indent input
    841  1.4  rillig void
    842  1.4  rillig comment_at_end_of_function(void)
    843  1.4  rillig {
    844  1.4  rillig 	if (cond)
    845  1.4  rillig 		statement();
    846  1.4  rillig 	// comment
    847  1.4  rillig }
    848  1.3  rillig //indent end
    849  1.1  rillig 
    850  1.3  rillig //indent run-equals-input
    851  1.4  rillig 
    852  1.4  rillig 
    853  1.4  rillig //indent input
    854  1.4  rillig int		decl;
    855  1.4  rillig // end-of-line comment at the end of the file
    856  1.4  rillig //indent end
    857  1.4  rillig 
    858  1.4  rillig //indent run-equals-input
    859  1.4  rillig 
    860  1.4  rillig 
    861  1.4  rillig /* A form feed in the middle of a comment is an ordinary character. */
    862  1.4  rillig //indent input
    863  1.4  rillig /*
    864  1.4  rillig  * AE
    866  1.4  rillig  */
    867  1.4  rillig /*-AE*/
    869  1.4  rillig //indent end
    870  1.4  rillig 
    871  1.4  rillig //indent run-equals-input
    872  1.4  rillig 
    873  1.4  rillig 
    874  1.4  rillig /*
    875  1.4  rillig  * At the beginning of a block comment or after a '*', '\f' is special. This
    876  1.4  rillig  * is an implementation detail that should not be visible from the outside.
    877  1.4  rillig  * Form feeds in comments are seldom used though, so this is no problem.
    878  1.4  rillig  */
    879  1.4  rillig //indent input
    880  1.4  rillig /* comment*/
    882  1.4  rillig /*text* comment*/
    884  1.4  rillig //indent end
    885  1.4  rillig 
    886  1.4  rillig //indent run
    887  1.4  rillig /* * comment */
    889  1.4  rillig /* text* * comment */
    891  1.4  rillig //indent end
    892  1.4  rillig 
    893  1.4  rillig /*
    894  1.4  rillig  * Without 'star_comment_cont', there is no separator between the form feed
    895  1.4  rillig  * and the surrounding text.
    896  1.4  rillig  */
    897  1.4  rillig //indent run -nsc
    898  1.4  rillig /*comment */
    900  1.4  rillig /* text*comment */
    902  1.4  rillig //indent end
    903  1.4  rillig 
    904  1.4  rillig //indent run-equals-input -nfc1
    905  1.4  rillig 
    906  1.4  rillig 
    907  1.4  rillig /*
    908  1.4  rillig  * A completely empty line in a box comment must be copied unmodified to the
    909  1.4  rillig  * output. This is done in process_comment by adding a space to the end of an
    910  1.4  rillig  * otherwise empty comment. This space forces output_complete_line to add some output,
    911  1.4  rillig  * but the trailing space is discarded, resulting in an empty line.
    912  1.4  rillig  */
    913  1.4  rillig //indent input
    914  1.4  rillig /*- comment
    915  1.4  rillig 
    916  1.4  rillig 
    917  1.4  rillig end */
    918  1.4  rillig //indent end
    919  1.4  rillig 
    920  1.4  rillig //indent run-equals-input -nfc1
    921  1.4  rillig 
    922  1.4  rillig 
    923  1.4  rillig //indent input
    924  1.4  rillig /* comment comment comment comment mlute */
    925  1.4  rillig //indent end
    926  1.4  rillig 
    927  1.4  rillig //indent run -l40
    928  1.4  rillig /*
    929  1.4  rillig  * comment comment comment comment
    930  1.4  rillig  * mlute
    931  1.4  rillig  */
    932  1.4  rillig //indent end
    933  1.4  rillig 
    934  1.4  rillig 
    935  1.4  rillig //indent input
    936  1.4  rillig int f(void)
    937  1.4  rillig {
    938  1.4  rillig 	if (0)
    939  1.4  rillig 		/* 12 1234 123 123456 1234 1234567 123 1234.  */;
    940  1.4  rillig }
    941  1.4  rillig //indent end
    942  1.4  rillig 
    943  1.4  rillig /* The comment is too long to fit in a single line. */
    944  1.4  rillig //indent run -l54
    945  1.4  rillig int
    946  1.4  rillig f(void)
    947  1.4  rillig {
    948  1.4  rillig 	if (0)
    949  1.4  rillig 		/*
    950  1.4  rillig 		 * 12 1234 123 123456 1234 1234567 123
    951  1.4  rillig 		 * 1234.
    952  1.4  rillig 		  */ ;
    953  1.4  rillig }
    954  1.4  rillig //indent end
    955  1.4  rillig 
    956  1.4  rillig /* The comment fits in a single line. */
    957  1.4  rillig //indent run
    958  1.4  rillig int
    959  1.4  rillig f(void)
    960  1.4  rillig {
    961  1.4  rillig 	if (0)
    962  1.4  rillig 		 /* 12 1234 123 123456 1234 1234567 123 1234.  */ ;
    963  1.4  rillig }
    964  1.4  rillig //indent end
    965  1.4  rillig 
    966  1.4  rillig 
    967  1.4  rillig /*
    968  1.4  rillig  * Test for an edge cases in comment handling, having a block comment inside
    969  1.4  rillig  * a line comment. Before NetBSD pr_comment.c 1.96 from 2021-11-04, indent
    970  1.4  rillig  * wrongly assumed that the comment would end at the '*' '/', tokenizing the
    971  1.4  rillig  * second word 'still' as a type_outside_parentheses.
    972  1.4  rillig  */
    973  1.4  rillig //indent input
    974  1.4  rillig /* block comment */
    975  1.4  rillig // line comment /* still a line comment */ still a line comment
    976  1.4  rillig //indent end
    977  1.4  rillig 
    978  1.4  rillig //indent run-equals-input
    979  1.4  rillig 
    980  1.4  rillig 
    981  1.4  rillig /*
    982  1.4  rillig  * Tests for comments that are not wrapped.
    983  1.4  rillig  */
    984  1.4  rillig //indent input
    985  1.4  rillig /*-	tab space	tab space */
    986  1.4  rillig /*-	very-long-word-that-cannot-be-broken very-long-word-that-cannot-be-broken */
    987  1.4  rillig /*-	very-long-word-that-cannot-be-broken very-long-word-that-cannot-be-broken */
    988  1.4  rillig //indent end
    989  1.4  rillig 
    990  1.4  rillig //indent run-equals-input -l5
    991  1.4  rillig 
    992  1.4  rillig //indent run-equals-input -l32
    993  1.4  rillig 
    994  1.4  rillig 
    995  1.4  rillig /*
    996  1.4  rillig  * Test for form feeds in nowrap comments.
    997  1.4  rillig  */
    998  1.4  rillig //indent input
    999  1.4  rillig /*-*/
   1001  1.4  rillig /*-<>*/
   1003  1.4  rillig //indent end
   1004  1.4  rillig 
   1005  1.4  rillig //indent run-equals-input
   1006  1.4  rillig 
   1007  1.4  rillig 
   1008  1.4  rillig /*
   1009  1.4  rillig  * Test two completely empty lines in a wrap comment. The second empty line
   1010  1.4  rillig  * covers the condition ps.next_col_1 in copy_comment_wrap.
   1011  1.4  rillig  */
   1012  1.4  rillig //indent input
   1013  1.4  rillig /* line 1
   1014  1.4  rillig 
   1015  1.4  rillig 
   1016  1.4  rillig line 4 */
   1017  1.4  rillig //indent end
   1018  1.4  rillig 
   1019  1.4  rillig //indent run
   1020  1.4  rillig /*
   1021  1.4  rillig  * line 1
   1022  1.4  rillig  *
   1023  1.4  rillig  *
   1024  1.4  rillig  * line 4
   1025  1.4  rillig  */
   1026  1.4  rillig //indent end
   1027  1.4  rillig 
   1028  1.4  rillig //indent run-equals-input -nfc1
   1029  1.4  rillig 
   1030  1.4  rillig //indent run-equals-input -nfc1 -nsc
   1031  1.4  rillig 
   1032  1.4  rillig //indent run -nsc
   1033  1.4  rillig /*
   1034  1.4  rillig line 1
   1035  1.4  rillig 
   1036  1.4  rillig 
   1037  1.4  rillig line 4
   1038  1.4  rillig  */
   1039  1.4  rillig //indent end
   1040  1.4  rillig 
   1041  1.4  rillig //indent run-equals-input -nsc -ncdb
   1042  1.4  rillig 
   1043  1.4  rillig 
   1044  1.4  rillig /*
   1045  1.4  rillig  * Cover the code for expanding the comment buffer. As of 2021-11-07, the
   1046  1.4  rillig  * default buffer size is 200. To actually fill the comment buffer, there must
   1047  1.4  rillig  * be a single line of a comment that is longer than 200 bytes.
   1048  1.4  rillig  */
   1049  1.4  rillig //indent input
   1050  1.4  rillig /*-_____10________20________30________40________50________60________70________80________90_______100_______110_______120_______130_______140_______150_______160_______170_______180_______190_______200 */
   1051  1.4  rillig //indent end
   1052  1.4  rillig 
   1053  1.4  rillig //indent run-equals-input
   1054  1.4  rillig 
   1055  1.4  rillig 
   1056  1.4  rillig /*
   1057  1.4  rillig  * Cover the code for expanding the comment buffer in com_terminate. As of
   1058  1.4  rillig  * 2021-11-07, the default buffer size is 200, with a safety margin of 1 at
   1059  1.4  rillig  * the beginning and another safety margin of 5 at the end. To force the
   1060  1.4  rillig  * comment buffer to expanded in com_terminate, the comment must be exactly
   1061  1.4  rillig  * 193 bytes long.
   1062  1.4  rillig  */
   1063  1.4  rillig //indent input
   1064  1.4  rillig /*-_____10________20________30________40________50________60________70________80________90_______100_______110_______120_______130_______140_______150_______160_______170_______180_______190 */
   1065  1.4  rillig //indent end
   1066  1.4  rillig 
   1067  1.4  rillig //indent run-equals-input
   1068  1.4  rillig 
   1069  1.4  rillig 
   1070  1.4  rillig /*
   1071  1.4  rillig  * Since 2019-04-04 and before pr_comment.c 1.123 from 2021-11-25, the
   1072  1.4  rillig  * function analyze_comment wrongly joined the two comments.
   1073  1.4  rillig  */
   1074  1.4  rillig //indent input
   1075  1.4  rillig /*
   1076  1.4  rillig  *//*
   1077  1.4  rillig join*/
   1078  1.4  rillig //indent end
   1079  1.4  rillig 
   1080  1.4  rillig /* FIXME: The last line of the first comment must not be modified. */
   1081  1.4  rillig //indent run -nfc1
   1082  1.4  rillig /*
   1083  1.4  rillig   *//*
   1084  1.4  rillig   * join
   1085  1.4  rillig   */
   1086  1.4  rillig //indent end
   1087  1.4  rillig 
   1088  1.4  rillig 
   1089  1.4  rillig /*
   1090  1.4  rillig  * Since 2019-04-04 and before pr_comment.c 1.123 from 2021-11-25, the
   1091  1.4  rillig  * function analyze_comment generated malformed output by terminating the
   1092  1.4  rillig  * first comment but omitting the start of the second comment.
   1093  1.4  rillig  */
   1094  1.4  rillig //indent input
   1095  1.4  rillig /*
   1096              *//*
   1097              error*/
   1098              //indent end
   1099              
   1100              //indent run -nfc1
   1101              /*
   1102               *//*
   1103                * error
   1104                */
   1105              //indent end
   1106