xref: /netbsd-src/tests/usr.bin/indent/lsym_newline.c (revision d3be4ec43d982d356783d517b16645cf954d602a)
1 /* $NetBSD: lsym_newline.c,v 1.5 2023/06/09 22:01:26 rillig Exp $ */
2 
3 /*
4  * Tests for the token lsym_newline, which represents a forced line break in
5  * the source code.
6  *
7  * A newline ends an end-of-line comment that has been started with '//'.
8  *
9  * When a line ends with a backslash immediately followed by '\n', these two
10  * characters are merged and continue the logical line (C11 5.1.1.2p1i2).
11  *
12  * In other contexts, a newline is an ordinary space character from a
13  * compiler's point of view. Indent preserves most line breaks though.
14  *
15  * See also:
16  *	lsym_form_feed.c
17  */
18 
19 
20 //indent input
21 int var=
22 1
23 	+2
24 		+3
25 			+4;
26 //indent end
27 
28 //indent run
29 int		var =
30 1
31 + 2
32 + 3
33 + 4;
34 //indent end
35 
36 
37 // Trim trailing blank lines.
38 //indent input
39 int x;
40 
41 
42 //indent end
43 
44 //indent run -di0
45 int x;
46 //indent end
47