1*37331766Srillig /* $NetBSD: lsym_period.c,v 1.5 2023/05/11 09:28:53 rillig Exp $ */ 29ae26de1Srillig 39ae26de1Srillig /* 49ae26de1Srillig * Tests for the token lsym_period, which represents '.' in these contexts: 59ae26de1Srillig * 69ae26de1Srillig * In an initializer, '.' starts a named designator (since C99). 79ae26de1Srillig * 89ae26de1Srillig * In an expression, 'sou.member' accesses the member 'member' in the struct 99ae26de1Srillig * or union 'sou'. 109ae26de1Srillig * 119ae26de1Srillig * In a function prototype declaration, the sequence '.' '.' '.' marks the 12173b4e09Srillig * start of a variable number of arguments. It would have been more intuitive 13173b4e09Srillig * to model them as a single token, but it doesn't make any difference for 14173b4e09Srillig * formatting the code. 159ae26de1Srillig * 169ae26de1Srillig * See also: 179ae26de1Srillig * lsym_word.c for '.' inside numeric constants 189ae26de1Srillig */ 199ae26de1Srillig 20173b4e09Srillig /* Designators in an initialization */ 2147306038Srillig //indent input 22173b4e09Srillig struct point { 23173b4e09Srillig int x; 24173b4e09Srillig int y; 25173b4e09Srillig } p = { 26173b4e09Srillig .x = 3, 27173b4e09Srillig .y = 4, 28173b4e09Srillig }; 2947306038Srillig //indent end 309ae26de1Srillig 3147306038Srillig //indent run-equals-input -di0 32173b4e09Srillig 33173b4e09Srillig 34173b4e09Srillig /* Accessing struct members */ 3547306038Srillig //indent input 36173b4e09Srillig time_t get_time(struct stat st)37173b4e09Srilligget_time(struct stat st) 38173b4e09Srillig { 39173b4e09Srillig return st.st_mtime > 0 ? st . st_atime : st.st_ctime; 40173b4e09Srillig } 4147306038Srillig //indent end 42173b4e09Srillig 4347306038Srillig //indent run 44173b4e09Srillig time_t get_time(struct stat st)45173b4e09Srilligget_time(struct stat st) 46173b4e09Srillig { 47173b4e09Srillig return st.st_mtime > 0 ? st.st_atime : st.st_ctime; 48173b4e09Srillig } 4947306038Srillig //indent end 50173b4e09Srillig 51*37331766Srillig //indent run-equals-prev-output -Ttime_t 52*37331766Srillig 53173b4e09Srillig 54173b4e09Srillig /* Varargs in a function declaration */ 5547306038Srillig //indent input 56173b4e09Srillig void my_printf(const char *, ...); 5747306038Srillig //indent end 58173b4e09Srillig 5947306038Srillig //indent run-equals-input -di0 60