modernc.org/ccgo/v3@v3.16.14/lib/testdata/bug/init3.c (about)

     1  #include <stdint.h>
     2  
     3  typedef union {
     4  	struct {
     5  		char type;
     6  		short state;
     7  		char extra;
     8  		char repetition;
     9  	} shift;
    10  	struct {
    11  		char type;
    12  		char child_count;
    13  		short symbol;
    14  		short dynamic_precedence;
    15  		short production_id;
    16  	} reduce;
    17  	char type;
    18  } TSParseAction;
    19  
    20  typedef union {
    21  	TSParseAction action;
    22  	struct {
    23  		char count;
    24  		char reusable;
    25  	} entry;
    26  } TSParseActionEntry;
    27  
    28  static const TSParseActionEntry ts_parse_actions[] = {
    29  	[13] = {
    30  			.entry = {
    31  				.count = 11,
    32  				.reusable = 22
    33  			}
    34  		},
    35  		{
    36  			{
    37  				.reduce = {
    38  					.type = 33,
    39  					.symbol = 44,
    40  					.child_count = 55,
    41  				},
    42  			}
    43  		},
    44  };
    45  
    46  static const TSParseActionEntry ts_parse_actions2[] = {
    47  	[13] = {
    48  			{
    49  				.reduce = {
    50  					.type = 66,
    51  					.symbol = 77,
    52  					.child_count = 88,
    53  				},
    54  			}
    55  		},
    56  };
    57  
    58  int main() {
    59  	if (ts_parse_actions[13].entry.count != 11) {
    60  		return __LINE__;
    61  	}
    62  
    63  	if (ts_parse_actions[13].entry.reusable != 22) {
    64  		return __LINE__;
    65  	}
    66  
    67  	if (ts_parse_actions[14].action.reduce.type != 33) {
    68  		return __LINE__;
    69  	}
    70  
    71  	if (ts_parse_actions[14].action.reduce.symbol != 44) {
    72  		return __LINE__;
    73  	}
    74  
    75  	if (ts_parse_actions[14].action.reduce.child_count != 55) {
    76  		return __LINE__;
    77  	}
    78  
    79  	if (ts_parse_actions2[13].action.reduce.type != 66) {
    80  		return __LINE__;
    81  	}
    82  
    83  	if (ts_parse_actions2[13].action.reduce.symbol != 77) {
    84  		return __LINE__;
    85  	}
    86  
    87  	if (ts_parse_actions2[13].action.reduce.child_count != 88) {
    88  		return __LINE__;
    89  	}
    90  
    91  	return 0;
    92  }