1 /* $NetBSD: psym_rbrace.c,v 1.5 2023/06/16 23:19:01 rillig Exp $ */ 2 3 /* 4 * Tests for the parser symbol psym_rbrace, which represents '}' and finishes 5 * the previous '{'. 6 * 7 * See also: 8 * psym_lbrace.c 9 */ 10 11 12 /* 13 * While it is a syntax error to have an unfinished declaration between braces, 14 * indent is forgiving enough to accept this input. 15 */ 16 //indent input 17 { 18 int 19 } 20 //indent end 21 22 //indent run 23 { 24 int 25 } 26 // exit 1 27 // error: Standard Input:3: Statement nesting error 28 // error: Standard Input:3: Stuff missing from end of file 29 //indent end 30 31 32 //indent input 33 { 34 do { 35 } while (cond) 36 } 37 //indent end 38 39 // XXX: Why doesn't indent complain about the missing semicolon? 40 //indent run-equals-input 41 42 43 //indent input 44 { 45 if (cond) 46 } 47 //indent end 48 49 //indent run 50 { 51 if (cond) 52 } 53 // exit 1 54 // error: Standard Input:3: Statement nesting error 55 // error: Standard Input:3: Stuff missing from end of file 56 //indent end 57 58 59 //indent input 60 { 61 switch (expr) 62 } 63 //indent end 64 65 //indent run 66 { 67 switch (expr) 68 } 69 // exit 1 70 // error: Standard Input:3: Statement nesting error 71 // error: Standard Input:3: Stuff missing from end of file 72 //indent end 73 74 75 //indent input 76 { 77 while (cond) 78 } 79 //indent end 80 81 //indent run 82 { 83 while (cond) 84 } 85 // exit 1 86 // error: Standard Input:3: Statement nesting error 87 // error: Standard Input:3: Stuff missing from end of file 88 //indent end 89