Home | History | Annotate | Line # | Download | only in indent
opt_eei.c revision 1.4
      1  1.4  rillig /* $NetBSD: opt_eei.c,v 1.4 2021/10/18 07:11:31 rillig Exp $ */
      2  1.1  rillig /* $FreeBSD$ */
      3  1.1  rillig 
      4  1.3  rillig /*
      5  1.3  rillig  * Tests for the options '-eei' and '-neei'.
      6  1.3  rillig  *
      7  1.3  rillig  * The option '-eei' enables extra indentation on continuation lines of the
      8  1.3  rillig  * expression part of 'if' and 'while' statements. These continuation lines
      9  1.3  rillig  * are indented one extra level.
     10  1.3  rillig  *
     11  1.3  rillig  * The option '-neei' indents these conditions in the same way as all other
     12  1.3  rillig  * continued statements.
     13  1.3  rillig  */
     14  1.3  rillig 
     15  1.1  rillig #indent input
     16  1.1  rillig bool
     17  1.1  rillig less(int a, int b)
     18  1.1  rillig {
     19  1.1  rillig 	if (a <
     20  1.1  rillig 	    b)
     21  1.1  rillig 		return true;
     22  1.1  rillig 	if (a
     23  1.1  rillig 	    <
     24  1.1  rillig 	    b)
     25  1.1  rillig 		return true;
     26  1.1  rillig }
     27  1.1  rillig #indent end
     28  1.1  rillig 
     29  1.1  rillig #indent run -eei
     30  1.1  rillig bool
     31  1.1  rillig less(int a, int b)
     32  1.1  rillig {
     33  1.1  rillig 	if (a <
     34  1.1  rillig 			b)
     35  1.1  rillig 		return true;
     36  1.1  rillig 	if (a
     37  1.1  rillig 			<
     38  1.1  rillig 			b)
     39  1.1  rillig 		return true;
     40  1.1  rillig }
     41  1.1  rillig #indent end
     42  1.1  rillig 
     43  1.4  rillig #indent run-equals-input -neei
     44  1.3  rillig 
     45  1.3  rillig /*
     46  1.3  rillig  * When the indentation level is the same as the continuation indentation, the
     47  1.3  rillig  * indentation does not show the structure of the code.
     48  1.3  rillig  */
     49  1.3  rillig #indent run -neei -i4
     50  1.3  rillig bool
     51  1.3  rillig less(int a, int b)
     52  1.3  rillig {
     53  1.3  rillig     if (a <
     54  1.3  rillig 	b)
     55  1.3  rillig 	return true;
     56  1.3  rillig     if (a
     57  1.3  rillig 	<
     58  1.3  rillig 	b)
     59  1.3  rillig 	return true;
     60  1.3  rillig }
     61  1.3  rillig #indent end
     62  1.3  rillig 
     63  1.3  rillig /*
     64  1.3  rillig  * Adding the extra level of indentation is useful when the standard
     65  1.3  rillig  * indentation is the same as the indentation of statement continuations. In
     66  1.3  rillig  * such a case, the continued condition would have the same indentation as the
     67  1.3  rillig  * following statement, which would be confusing.
     68  1.3  rillig  */
     69  1.3  rillig #indent run -eei -i4
     70  1.3  rillig bool
     71  1.3  rillig less(int a, int b)
     72  1.3  rillig {
     73  1.3  rillig     if (a <
     74  1.3  rillig 	    b)
     75  1.3  rillig 	return true;
     76  1.3  rillig     if (a
     77  1.3  rillig 	    <
     78  1.3  rillig 	    b)
     79  1.3  rillig 	return true;
     80  1.3  rillig }
     81  1.3  rillig #indent end
     82