Home | History | Annotate | Line # | Download | only in indent
psym_stmt.c revision 1.6
      1  1.6  rillig /* $NetBSD: psym_stmt.c,v 1.6 2023/06/09 10:24:55 rillig Exp $ */
      2  1.1  rillig 
      3  1.1  rillig /*
      4  1.1  rillig  * Tests for the parser symbol psym_stmt, which represents a statement on the
      5  1.1  rillig  * stack.
      6  1.1  rillig  *
      7  1.1  rillig  * TODO: Explain why the stack contains 'lbrace' 'stmt' instead of only 'lbrace'.
      8  1.1  rillig  */
      9  1.1  rillig 
     10  1.3  rillig //indent input
     11  1.4  rillig #define unless(cond) if (!(cond))
     12  1.4  rillig 
     13  1.4  rillig void
     14  1.4  rillig function(void)
     15  1.4  rillig {
     16  1.4  rillig 	stmt();
     17  1.4  rillig 	stmt;			/* probably some macro */
     18  1.4  rillig 
     19  1.4  rillig 	unless(cond)
     20  1.4  rillig 		stmt();
     21  1.4  rillig }
     22  1.3  rillig //indent end
     23  1.1  rillig 
     24  1.4  rillig /*
     25  1.4  rillig  * There is no space after 'unless' since indent cannot know that it is a
     26  1.4  rillig  * syntactic macro, especially not when its definition is in a header file.
     27  1.4  rillig  */
     28  1.3  rillig //indent run-equals-input
     29  1.5  rillig 
     30  1.5  rillig 
     31  1.6  rillig // Ensure that '(something) {' is not treated as a cast expression.
     32  1.5  rillig //indent input
     33  1.5  rillig {
     34  1.5  rillig 	TAILQ_FOREACH(a, b, c) {
     35  1.5  rillig 		a =
     36  1.6  rillig 		    b;
     37  1.5  rillig 	}
     38  1.5  rillig }
     39  1.5  rillig //indent end
     40  1.5  rillig 
     41  1.5  rillig //indent run-equals-input -di0 -nlp -ci4
     42