lex_ident.c revision 1.5 1 /* $NetBSD: lex_ident.c,v 1.5 2022/04/24 09:04:12 rillig Exp $ */
2
3 /*
4 * Test lexing of word-like tokens, such as keywords, identifiers, numeric
5 * constants, character constants, string literals.
6 */
7
8 /*
9 * Conceptually, backslash-newline is replaced with nothing, in a very early
10 * stage of the translation, see C11 5.1.1.2p1, item 2. Indent does not
11 * preserve these; in most cases, they are simply removed.
12 */
13 //indent input
14 in\
15 t \
16 var\
17 iable;
18
19 int
20 no_backslash;
21
22 /* $ See check_size_token. */
23 /* $ The default buffer size is 200, the limit is 195. */
24 struct long_tag_name_to_overflow_the_token_buffer_4567890\
25 12345678901234567890123456789012345678901234567890\
26 12345678901234567890123456789012345678901234567890\
27 12345678901234567890123456789012345678901234567890;
28
29 /* $ See check_size_token. */
30 /* $ The difference between limit and start got incremented to 595. */
31 struct long_tag_name_to_overflow_the_token_buffer_4567890\
32 12345678901234567890123456789012345678901234567890\
33 12345678901234567890123456789012345678901234567890\
34 12345678901234567890123456789012345678901234567890\
35 12345678901234567890123456789012345678901234567890\
36 12345678901234567890123456789012345678901234567890\
37 12345678901234567890123456789012345678901234567890\
38 12345678901234567890123456789012345678901234567890\
39 12345678901234567890123456789012345678901234567890\
40 12345678901234567890123456789012345678901234567890\
41 12345678901234567890123456789012345678901234567890\
42 12345678901234567890123456789012345678901234567890;
43 //indent end
44
45 //indent run
46 /* $ XXX: The indentation of the backslash is one short of a tab. */
47 int \
48 variable;
49
50 int
51 no_backslash;
52
53 struct long_tag_name_to_overflow_the_token_buffer_4567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
54
55 struct long_tag_name_to_overflow_the_token_buffer_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
56 //indent end
57
58
59 /* This is a syntax error; see lex_word. */
60 //indent input
61 int identifier\n;
62 //indent end
63
64 //indent run
65 int identifier \ n;
66 //indent end
67