Home | History | Annotate | Line # | Download | only in indent
      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
     14 in\
     15 t \
     16 var\
     17 iable;
     18 
     19 int
     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.
     24 struct long_tag_name_to_overflow_the_token_buffer_4567890\
     25 12345678901234567890123456789012345678901234567890\
     26 12345678901234567890123456789012345678901234567890\
     27 12345678901234567890123456789012345678901234567890;
     28 
     29 struct long_tag_name_to_overflow_the_token_buffer_4567890\
     30 12345678901234567890123456789012345678901234567890\
     31 12345678901234567890123456789012345678901234567890\
     32 12345678901234567890123456789012345678901234567890\
     33 12345678901234567890123456789012345678901234567890\
     34 12345678901234567890123456789012345678901234567890\
     35 12345678901234567890123456789012345678901234567890\
     36 12345678901234567890123456789012345678901234567890\
     37 12345678901234567890123456789012345678901234567890\
     38 12345678901234567890123456789012345678901234567890\
     39 12345678901234567890123456789012345678901234567890\
     40 12345678901234567890123456789012345678901234567890;
     41 //indent end
     42 
     43 //indent run
     44 int		variable;
     45 
     46 int
     47 		no_backslash;
     48 
     49 struct long_tag_name_to_overflow_the_token_buffer_4567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
     50 
     51 struct 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
     57 int identifier\n;
     58 //indent end
     59 
     60 //indent run
     61 int		identifier \ n;
     62 //indent end
     63