4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Transmeta Corp.
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
48 enum statement_type type
;
51 struct /* declaration */ {
52 struct symbol_list
*declaration
;
54 struct /* context */ {
55 struct expression
*expression
;
56 struct expression
*context
;
58 struct /* return_statement */ {
59 struct expression
*ret_value
;
60 struct symbol
*ret_target
;
62 struct /* if_statement */ {
63 struct expression
*if_conditional
;
64 struct statement
*if_true
;
65 struct statement
*if_false
;
67 struct /* compound_struct */ {
68 struct statement_list
*stmts
;
70 struct symbol
*inline_fn
;
71 struct statement
*args
;
73 struct /* labeled_struct */ {
74 struct symbol
*label_identifier
;
75 struct statement
*label_statement
;
77 struct /* case_struct */ {
78 struct expression
*case_expression
;
79 struct expression
*case_to
;
80 struct statement
*case_statement
;
81 struct symbol
*case_label
;
83 struct /* switch_struct */ {
84 struct expression
*switch_expression
;
85 struct statement
*switch_statement
;
86 struct symbol
*switch_break
, *switch_case
;
88 struct /* iterator_struct */ {
89 struct symbol
*iterator_break
;
90 struct symbol
*iterator_continue
;
91 struct symbol_list
*iterator_syms
;
92 struct statement
*iterator_pre_statement
;
93 struct expression
*iterator_pre_condition
;
95 struct statement
*iterator_statement
;
97 struct statement
*iterator_post_statement
;
98 struct expression
*iterator_post_condition
;
100 struct /* goto_struct */ {
101 struct symbol
*goto_label
;
103 /* computed gotos have these: */
104 struct expression
*goto_expression
;
105 struct symbol_list
*target_list
;
107 struct /* goto_bb */ {
108 struct expression
*bb_conditional
;
109 struct symbol
*bb_target
;
111 struct /* multijmp */ {
112 struct expression
*multi_from
;
113 struct expression
*multi_to
;
114 struct symbol
*multi_target
;
117 struct expression
*asm_string
;
118 struct expression_list
*asm_outputs
;
119 struct expression_list
*asm_inputs
;
120 struct expression_list
*asm_clobbers
;
121 struct symbol_list
*asm_labels
;
124 struct expression
*range_expression
;
125 struct expression
*range_low
;
126 struct expression
*range_high
;
131 extern struct symbol_list
*function_computed_target_list
;
132 extern struct statement_list
*function_computed_goto_list
;
134 extern struct token
*parse_expression(struct token
*, struct expression
**);
135 extern struct symbol
*label_symbol(struct token
*token
);
137 extern int show_statement(struct statement
*);
138 extern void show_statement_list(struct statement_list
*, const char *);
139 extern int show_expression(struct expression
*);
141 extern struct token
*external_declaration(struct token
*token
, struct symbol_list
**list
);
143 extern struct symbol
*ctype_integer(int size
, int want_unsigned
);
145 extern void copy_statement(struct statement
*src
, struct statement
*dst
);
146 extern int inline_function(struct expression
*expr
, struct symbol
*sym
);
147 extern void uninline(struct symbol
*sym
);
148 extern void init_parser(int);