Home | History | Annotate | Line # | Download | only in indent
opt_fc1.c revision 1.1
      1  1.1  rillig /* $NetBSD: opt_fc1.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
      2  1.1  rillig /* $FreeBSD$ */
      3  1.1  rillig 
      4  1.1  rillig #indent input
      5  1.1  rillig /*
      6  1.1  rillig  * A comment
      7  1.1  rillig  * in column 1.
      8  1.1  rillig  *
      9  1.1  rillig  *
     10  1.1  rillig  *
     11  1.1  rillig  */
     12  1.1  rillig 
     13  1.1  rillig /* $ Neither indentation nor surrounding spaces. */
     14  1.1  rillig /*narrow*/
     15  1.1  rillig 
     16  1.1  rillig /* $ Indented by a single space, single spaces around the text. */
     17  1.1  rillig  /* space */
     18  1.1  rillig 
     19  1.1  rillig /* $ Indented by a single tab, single tabs around the text. */
     20  1.1  rillig 	/*	tab	*/
     21  1.1  rillig 
     22  1.1  rillig /* $ The space between these comments gets removed. */
     23  1.1  rillig /* block1 */ /* block2 */
     24  1.1  rillig 
     25  1.1  rillig /* $ Both comment texts get surrounded by spaces. */
     26  1.1  rillig /*block1*//*block2*/
     27  1.1  rillig 
     28  1.1  rillig /*
     29  1.1  rillig  * A multi-line comment that starts
     30  1.1  rillig  * in column 1.
     31  1.1  rillig  *//* followed by another multi-line comment
     32  1.1  rillig  * that starts in column 4.
     33  1.1  rillig  */
     34  1.1  rillig 
     35  1.1  rillig /* comment */ int decl2; /* comment */
     36  1.1  rillig /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */
     37  1.1  rillig /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */
     38  1.1  rillig #indent end
     39  1.1  rillig 
     40  1.1  rillig #indent run -fc1
     41  1.1  rillig /*
     42  1.1  rillig  * A comment in column 1.
     43  1.1  rillig  *
     44  1.1  rillig  *
     45  1.1  rillig  *
     46  1.1  rillig  */
     47  1.1  rillig 
     48  1.1  rillig /* $ The comment text got surrounded by spaces. */
     49  1.1  rillig /* narrow */
     50  1.1  rillig 
     51  1.1  rillig /* $ The indentation got removed. */
     52  1.1  rillig /* space */
     53  1.1  rillig 
     54  1.1  rillig /* $ The indentation got removed, only the leading tab got replaced by a space. */
     55  1.1  rillig /* tab	*/
     56  1.1  rillig 
     57  1.1  rillig /* $ The space between these comments got removed. */
     58  1.1  rillig /* block1 *//* block2 */
     59  1.1  rillig 
     60  1.1  rillig /* $ Both comment texts got surrounded by spaces. */
     61  1.1  rillig /* block1 *//* block2 */
     62  1.1  rillig 
     63  1.1  rillig /*
     64  1.1  rillig  * A multi-line comment that starts in column 1.
     65  1.1  rillig  *
     66  1.1  rillig  * followed by another multi-line comment that starts in column 4.
     67  1.1  rillig  */
     68  1.1  rillig /* $ XXX: The two comments have been merged into a single comment. */
     69  1.1  rillig 
     70  1.1  rillig  /* comment */ int decl2;	/* comment */
     71  1.1  rillig  /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2;	/* second comment */
     72  1.1  rillig  /* first comment */ int decl2;	/* looooooooooooooooooooooooooooooooooooooooong
     73  1.1  rillig 				 * second comment */
     74  1.1  rillig #indent end
     75  1.1  rillig 
     76  1.1  rillig #indent input
     77  1.1  rillig /*
     78  1.1  rillig  * A comment
     79  1.1  rillig  * in column 1.
     80  1.1  rillig  *
     81  1.1  rillig  *
     82  1.1  rillig  *
     83  1.1  rillig  */
     84  1.1  rillig 
     85  1.1  rillig /* $ Neither indentation nor surrounding spaces. */
     86  1.1  rillig /*narrow*/
     87  1.1  rillig 
     88  1.1  rillig /* $ Indented by a single space, single spaces around the text. */
     89  1.1  rillig  /* space */
     90  1.1  rillig 
     91  1.1  rillig /* $ Indented by a single tab, single tabs around the text. */
     92  1.1  rillig 	/*	tab	*/
     93  1.1  rillig 
     94  1.1  rillig /* $ The space between these comments gets removed. */
     95  1.1  rillig /* block1 */ /* block2 */
     96  1.1  rillig 
     97  1.1  rillig /* $ Both comment texts get surrounded by spaces. */
     98  1.1  rillig /*block1*//*block2*/
     99  1.1  rillig 
    100  1.1  rillig /*
    101  1.1  rillig  * A multi-line comment that starts
    102  1.1  rillig  * in column 1.
    103  1.1  rillig  *//* followed by another multi-line comment
    104  1.1  rillig  * that starts in column 4.
    105  1.1  rillig  */
    106  1.1  rillig 
    107  1.1  rillig /* comment */ int decl2; /* comment */
    108  1.1  rillig /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */
    109  1.1  rillig /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */
    110  1.1  rillig #indent end
    111  1.1  rillig 
    112  1.1  rillig #indent run -nfc1
    113  1.1  rillig /*
    114  1.1  rillig  * A comment
    115  1.1  rillig  * in column 1.
    116  1.1  rillig  *
    117  1.1  rillig  *
    118  1.1  rillig  *
    119  1.1  rillig  */
    120  1.1  rillig 
    121  1.1  rillig /* $ No spaces got added around the comment text. */
    122  1.1  rillig /*narrow*/
    123  1.1  rillig 
    124  1.1  rillig /* $ The indentation of a single space was preserved. */
    125  1.1  rillig /* $ If the comment were moved to column 1, it would change from the area */
    126  1.1  rillig /* $ of 'comments that may be formatted' to the area of 'comments that must */
    127  1.1  rillig /* $ not be formatted. The indentation of a single space prevents this. */
    128  1.1  rillig  /* space */
    129  1.1  rillig 
    130  1.1  rillig /* $ The indentation was changed from a single tab to a single space. */
    131  1.1  rillig  /* tab	*/
    132  1.1  rillig 
    133  1.1  rillig /* $ The space between these two comments got removed. */
    134  1.1  rillig /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
    135  1.1  rillig /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    136  1.1  rillig /* $ This is probably because there is a second comment in the same line. */
    137  1.1  rillig  /* block1 *//* block2 */
    138  1.1  rillig 
    139  1.1  rillig /* $ It may seem strange at first that the left comment is not touched */
    140  1.1  rillig /* $ but the right comment gets spaces added. This difference is the */
    141  1.1  rillig /* $ exact purpose of the option '-nfc1', which says "do not touch comments */
    142  1.1  rillig /* $ that start in column 1. The first comment starts in column 1, the */
    143  1.1  rillig /* $ second comment doesn't. */
    144  1.1  rillig /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
    145  1.1  rillig /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    146  1.1  rillig /* $ This is probably because there is a second comment in the same line. */
    147  1.1  rillig  /*block1*//* block2 */
    148  1.1  rillig 
    149  1.1  rillig /*
    150  1.1  rillig  * A multi-line comment that starts
    151  1.1  rillig  * in column 1.
    152  1.1  rillig   *
    153  1.1  rillig   * followed by another multi-line comment that starts in column 4.
    154  1.1  rillig   */
    155  1.1  rillig /* $ XXX: The two comments have been merged into a single comment. */
    156  1.1  rillig 
    157  1.1  rillig  /* comment */ int decl2;	/* comment */
    158  1.1  rillig  /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2;	/* second comment */
    159  1.1  rillig  /* first comment */ int decl2;	/* looooooooooooooooooooooooooooooooooooooooong
    160  1.1  rillig 				 * second comment */
    161  1.1  rillig #indent end
    162