1/* $NetBSD: lex_ident.c,v 1.7 2023/06/04 19:28:54 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// $ Test long identifiers, to cover the code that expands a buffer first to
23// $ more than 400 bytes and then to more than 1400 bytes.
24struct long_tag_name_to_overflow_the_token_buffer_4567890\
2512345678901234567890123456789012345678901234567890\
2612345678901234567890123456789012345678901234567890\
2712345678901234567890123456789012345678901234567890;
28
29struct long_tag_name_to_overflow_the_token_buffer_4567890\
3012345678901234567890123456789012345678901234567890\
3112345678901234567890123456789012345678901234567890\
3212345678901234567890123456789012345678901234567890\
3312345678901234567890123456789012345678901234567890\
3412345678901234567890123456789012345678901234567890\
3512345678901234567890123456789012345678901234567890\
3612345678901234567890123456789012345678901234567890\
3712345678901234567890123456789012345678901234567890\
3812345678901234567890123456789012345678901234567890\
3912345678901234567890123456789012345678901234567890\
4012345678901234567890123456789012345678901234567890;
41//indent end
42
43//indent run
44int		variable;
45
46int
47		no_backslash;
48
49struct long_tag_name_to_overflow_the_token_buffer_4567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
50
51struct long_tag_name_to_overflow_the_token_buffer_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
52//indent end
53
54
55/* This is a syntax error; see lex_word. */
56//indent input
57int identifier\n;
58//indent end
59
60//indent run
61int		identifier \ n;
62//indent end
63