Home | History | Annotate | Line # | Download | only in indent
opt_fc1.c revision 1.2
      1  1.2  rillig /* $NetBSD: opt_fc1.c,v 1.2 2021/10/16 05:40:17 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 run -nfc1
     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 /* $ No spaces got added around the comment text. */
     86  1.1  rillig /*narrow*/
     87  1.1  rillig 
     88  1.1  rillig /* $ The indentation of a single space was preserved. */
     89  1.1  rillig /* $ If the comment were moved to column 1, it would change from the area */
     90  1.1  rillig /* $ of 'comments that may be formatted' to the area of 'comments that must */
     91  1.1  rillig /* $ not be formatted. The indentation of a single space prevents this. */
     92  1.1  rillig  /* space */
     93  1.1  rillig 
     94  1.1  rillig /* $ The indentation was changed from a single tab to a single space. */
     95  1.1  rillig  /* tab	*/
     96  1.1  rillig 
     97  1.1  rillig /* $ The space between these two comments got removed. */
     98  1.1  rillig /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
     99  1.1  rillig /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    100  1.1  rillig /* $ This is probably because there is a second comment in the same line. */
    101  1.1  rillig  /* block1 *//* block2 */
    102  1.1  rillig 
    103  1.1  rillig /* $ It may seem strange at first that the left comment is not touched */
    104  1.1  rillig /* $ but the right comment gets spaces added. This difference is the */
    105  1.1  rillig /* $ exact purpose of the option '-nfc1', which says "do not touch comments */
    106  1.1  rillig /* $ that start in column 1. The first comment starts in column 1, the */
    107  1.1  rillig /* $ second comment doesn't. */
    108  1.1  rillig /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
    109  1.1  rillig /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    110  1.1  rillig /* $ This is probably because there is a second comment in the same line. */
    111  1.1  rillig  /*block1*//* block2 */
    112  1.1  rillig 
    113  1.1  rillig /*
    114  1.1  rillig  * A multi-line comment that starts
    115  1.1  rillig  * in column 1.
    116  1.1  rillig   *
    117  1.1  rillig   * followed by another multi-line comment that starts in column 4.
    118  1.1  rillig   */
    119  1.1  rillig /* $ XXX: The two comments have been merged into a single comment. */
    120  1.1  rillig 
    121  1.1  rillig  /* comment */ int decl2;	/* comment */
    122  1.1  rillig  /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2;	/* second comment */
    123  1.1  rillig  /* first comment */ int decl2;	/* looooooooooooooooooooooooooooooooooooooooong
    124  1.1  rillig 				 * second comment */
    125  1.1  rillig #indent end
    126