Home | History | Annotate | Line # | Download | only in indent
lsym_while.c revision 1.6.2.1
      1  1.6.2.1  perseant /* $NetBSD: lsym_while.c,v 1.6.2.1 2025/08/02 05:58:13 perseant Exp $ */
      2      1.1    rillig 
      3      1.1    rillig /*
      4      1.1    rillig  * Tests for the token 'lsym_while', which represents the keyword 'while' that
      5      1.1    rillig  * starts a 'while' loop or finishes a 'do-while' loop.
      6      1.1    rillig  */
      7      1.1    rillig 
      8      1.3    rillig //indent input
      9      1.4    rillig void
     10      1.4    rillig function(void)
     11      1.4    rillig {
     12      1.4    rillig 	while(cond)stmt();
     13      1.4    rillig 	do stmt();while(cond);
     14      1.4    rillig }
     15      1.3    rillig //indent end
     16      1.1    rillig 
     17      1.4    rillig //indent run
     18      1.4    rillig void
     19      1.4    rillig function(void)
     20      1.4    rillig {
     21      1.4    rillig 	while (cond)
     22      1.4    rillig 		stmt();
     23      1.4    rillig 	do
     24      1.4    rillig 		stmt();
     25      1.4    rillig 	while (cond);
     26      1.4    rillig }
     27      1.4    rillig //indent end
     28      1.5    rillig 
     29      1.5    rillig 
     30      1.5    rillig /*
     31      1.5    rillig  * The keyword 'while' must only be indented if it follows a psym_do_stmt,
     32      1.5    rillig  * otherwise it starts a new statement and must start a new line.
     33      1.5    rillig  */
     34      1.5    rillig //indent input
     35      1.5    rillig void
     36      1.5    rillig function(void)
     37      1.5    rillig {
     38      1.5    rillig 	{} while (0);
     39      1.5    rillig }
     40      1.5    rillig //indent end
     41      1.5    rillig 
     42      1.5    rillig //indent run
     43      1.5    rillig void
     44      1.5    rillig function(void)
     45      1.5    rillig {
     46      1.5    rillig 	{
     47      1.6    rillig 	}
     48  1.6.2.1  perseant 	while (0)
     49  1.6.2.1  perseant 		;
     50      1.5    rillig }
     51      1.5    rillig //indent end
     52