lex_ident.c revision 1.6
1/* $NetBSD: lex_ident.c,v 1.6 2023/05/15 17:28:14 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
14in\
15t \
16var\
17iable;
18
19int
20	no_backslash;
21
22/* $ See check_size_token. */
23/* $ The default buffer size is 200, the limit is 195. */
24struct long_tag_name_to_overflow_the_token_buffer_4567890\
2512345678901234567890123456789012345678901234567890\
2612345678901234567890123456789012345678901234567890\
2712345678901234567890123456789012345678901234567890;
28
29/* $ See check_size_token. */
30/* $ The difference between limit and start got incremented to 595. */
31struct long_tag_name_to_overflow_the_token_buffer_4567890\
3212345678901234567890123456789012345678901234567890\
3312345678901234567890123456789012345678901234567890\
3412345678901234567890123456789012345678901234567890\
3512345678901234567890123456789012345678901234567890\
3612345678901234567890123456789012345678901234567890\
3712345678901234567890123456789012345678901234567890\
3812345678901234567890123456789012345678901234567890\
3912345678901234567890123456789012345678901234567890\
4012345678901234567890123456789012345678901234567890\
4112345678901234567890123456789012345678901234567890\
4212345678901234567890123456789012345678901234567890;
43//indent end
44
45//indent run
46int		variable;
47
48int
49		no_backslash;
50
51struct long_tag_name_to_overflow_the_token_buffer_4567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
52
53struct long_tag_name_to_overflow_the_token_buffer_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
54//indent end
55
56
57/* This is a syntax error; see lex_word. */
58//indent input
59int identifier\n;
60//indent end
61
62//indent run
63int		identifier \ n;
64//indent end
65