| OLD | NEW |
| 1 /* Parser definitions for GDB. | 1 /* Parser definitions for GDB. |
| 2 | 2 |
| 3 Copyright (C) 1986, 1989-2000, 2002, 2007-2012 Free Software | 3 Copyright (C) 1986, 1989-2000, 2002, 2007-2012 Free Software |
| 4 Foundation, Inc. | 4 Foundation, Inc. |
| 5 | 5 |
| 6 Modified from expread.y by the Department of Computer Science at the | 6 Modified from expread.y by the Department of Computer Science at the |
| 7 State University of New York at Buffalo. | 7 State University of New York at Buffalo. |
| 8 | 8 |
| 9 This file is part of GDB. | 9 This file is part of GDB. |
| 10 | 10 |
| 11 This program is free software; you can redistribute it and/or modify | 11 This program is free software; you can redistribute it and/or modify |
| 12 it under the terms of the GNU General Public License as published by | 12 it under the terms of the GNU General Public License as published by |
| 13 the Free Software Foundation; either version 3 of the License, or | 13 the Free Software Foundation; either version 3 of the License, or |
| 14 (at your option) any later version. | 14 (at your option) any later version. |
| 15 | 15 |
| 16 This program is distributed in the hope that it will be useful, | 16 This program is distributed in the hope that it will be useful, |
| 17 but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 GNU General Public License for more details. | 19 GNU General Public License for more details. |
| 20 | 20 |
| 21 You should have received a copy of the GNU General Public License | 21 You should have received a copy of the GNU General Public License |
| 22 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 22 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 23 | 23 |
| 24 #if !defined (PARSER_DEFS_H) | 24 #if !defined (PARSER_DEFS_H) |
| 25 #define PARSER_DEFS_H 1 | 25 #define PARSER_DEFS_H 1 |
| 26 | 26 |
| 27 #include "doublest.h" | 27 #include "doublest.h" |
| 28 #include "vec.h" |
| 28 | 29 |
| 29 struct block; | 30 struct block; |
| 30 | 31 |
| 31 extern int parser_debug; | 32 extern int parser_debug; |
| 32 | 33 |
| 33 extern struct expression *expout; | 34 extern struct expression *expout; |
| 34 extern int expout_size; | 35 extern int expout_size; |
| 35 extern int expout_ptr; | 36 extern int expout_ptr; |
| 36 | 37 |
| 37 #define parse_gdbarch (expout->gdbarch) | 38 #define parse_gdbarch (expout->gdbarch) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 int is_a_field_of_this; | 101 int is_a_field_of_this; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 struct objc_class_str | 104 struct objc_class_str |
| 104 { | 105 { |
| 105 struct stoken stoken; | 106 struct stoken stoken; |
| 106 struct type *type; | 107 struct type *type; |
| 107 int class; | 108 int class; |
| 108 }; | 109 }; |
| 109 | 110 |
| 111 typedef struct type *type_ptr; |
| 112 DEF_VEC_P (type_ptr); |
| 110 | 113 |
| 111 /* For parsing of complicated types. | 114 /* For parsing of complicated types. |
| 112 An array should be preceded in the list by the size of the array. */ | 115 An array should be preceded in the list by the size of the array. */ |
| 113 enum type_pieces | 116 enum type_pieces |
| 114 { | 117 { |
| 115 tp_end = -1, | 118 tp_end = -1, |
| 116 tp_pointer, | 119 tp_pointer, |
| 117 tp_reference, | 120 tp_reference, |
| 118 tp_array, | 121 tp_array, |
| 119 tp_function, | 122 tp_function, |
| 123 tp_function_with_arguments, |
| 120 tp_const, | 124 tp_const, |
| 121 tp_volatile, | 125 tp_volatile, |
| 122 tp_space_identifier | 126 tp_space_identifier, |
| 127 tp_type_stack |
| 123 }; | 128 }; |
| 124 /* The stack can contain either an enum type_pieces or an int. */ | 129 /* The stack can contain either an enum type_pieces or an int. */ |
| 125 union type_stack_elt | 130 union type_stack_elt |
| 126 { | 131 { |
| 127 enum type_pieces piece; | 132 enum type_pieces piece; |
| 128 int int_val; | 133 int int_val; |
| 134 struct type_stack *stack_val; |
| 135 VEC (type_ptr) *typelist_val; |
| 129 }; | 136 }; |
| 130 extern union type_stack_elt *type_stack; | 137 |
| 131 extern int type_stack_depth, type_stack_size; | 138 /* The type stack is an instance of this structure. */ |
| 139 |
| 140 struct type_stack |
| 141 { |
| 142 /* Elements on the stack. */ |
| 143 union type_stack_elt *elements; |
| 144 /* Current stack depth. */ |
| 145 int depth; |
| 146 /* Allocated size of stack. */ |
| 147 int size; |
| 148 }; |
| 149 |
| 150 /* Helper function to initialize the expout, expout_size, expout_ptr |
| 151 trio before it is used to store expression elements created during |
| 152 the parsing of an expression. INITIAL_SIZE is the initial size of |
| 153 the expout array. LANG is the language used to parse the expression. |
| 154 And GDBARCH is the gdbarch to use during parsing. */ |
| 155 |
| 156 extern void initialize_expout (int, const struct language_defn *, |
| 157 » » » struct gdbarch *); |
| 158 |
| 159 /* Helper function that frees any unsed space in the expout array. |
| 160 It is generally used when the parser has just been parsed and |
| 161 created. */ |
| 162 |
| 163 extern void reallocate_expout (void); |
| 164 |
| 165 /* Reverse an expression from suffix form (in which it is constructed) |
| 166 to prefix form (in which we can conveniently print or execute it). |
| 167 Ordinarily this always returns -1. However, if EXPOUT_LAST_STRUCT |
| 168 is not -1 (i.e., we are trying to complete a field name), it will |
| 169 return the index of the subexpression which is the left-hand-side |
| 170 of the struct operation at EXPOUT_LAST_STRUCT. */ |
| 171 |
| 172 extern int prefixify_expression (struct expression *expr); |
| 132 | 173 |
| 133 extern void write_exp_elt_opcode (enum exp_opcode); | 174 extern void write_exp_elt_opcode (enum exp_opcode); |
| 134 | 175 |
| 135 extern void write_exp_elt_sym (struct symbol *); | 176 extern void write_exp_elt_sym (struct symbol *); |
| 136 | 177 |
| 137 extern void write_exp_elt_longcst (LONGEST); | 178 extern void write_exp_elt_longcst (LONGEST); |
| 138 | 179 |
| 139 extern void write_exp_elt_dblcst (DOUBLEST); | 180 extern void write_exp_elt_dblcst (DOUBLEST); |
| 140 | 181 |
| 141 extern void write_exp_elt_decfloatcst (gdb_byte *); | 182 extern void write_exp_elt_decfloatcst (gdb_byte *); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 161 extern void mark_struct_expression (void); | 202 extern void mark_struct_expression (void); |
| 162 | 203 |
| 163 extern char *find_template_name_end (char *); | 204 extern char *find_template_name_end (char *); |
| 164 | 205 |
| 165 extern void start_arglist (void); | 206 extern void start_arglist (void); |
| 166 | 207 |
| 167 extern int end_arglist (void); | 208 extern int end_arglist (void); |
| 168 | 209 |
| 169 extern char *copy_name (struct stoken); | 210 extern char *copy_name (struct stoken); |
| 170 | 211 |
| 212 extern void insert_type (enum type_pieces); |
| 213 |
| 171 extern void push_type (enum type_pieces); | 214 extern void push_type (enum type_pieces); |
| 172 | 215 |
| 173 extern void push_type_int (int); | 216 extern void push_type_int (int); |
| 174 | 217 |
| 175 extern void push_type_address_space (char *); | 218 extern void insert_type_address_space (char *); |
| 176 | 219 |
| 177 extern enum type_pieces pop_type (void); | 220 extern enum type_pieces pop_type (void); |
| 178 | 221 |
| 179 extern int pop_type_int (void); | 222 extern int pop_type_int (void); |
| 180 | 223 |
| 224 extern struct type_stack *get_type_stack (void); |
| 225 |
| 226 extern struct type_stack *append_type_stack (struct type_stack *to, |
| 227 struct type_stack *from); |
| 228 |
| 229 extern void push_type_stack (struct type_stack *stack); |
| 230 |
| 231 extern void type_stack_cleanup (void *arg); |
| 232 |
| 233 extern void push_typelist (VEC (type_ptr) *typelist); |
| 234 |
| 181 extern int length_of_subexp (struct expression *, int); | 235 extern int length_of_subexp (struct expression *, int); |
| 182 | 236 |
| 183 extern int dump_subexp (struct expression *, struct ui_file *, int); | 237 extern int dump_subexp (struct expression *, struct ui_file *, int); |
| 184 | 238 |
| 185 extern int dump_subexp_body_standard (struct expression *, | 239 extern int dump_subexp_body_standard (struct expression *, |
| 186 struct ui_file *, int); | 240 struct ui_file *, int); |
| 187 | 241 |
| 188 extern void operator_length (const struct expression *, int, int *, int *); | 242 extern void operator_length (const struct expression *, int, int *, int *); |
| 189 | 243 |
| 190 extern void operator_length_standard (const struct expression *, int, int *, | 244 extern void operator_length_standard (const struct expression *, int, int *, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 209 | 263 |
| 210 /* During parsing of a C expression, the pointer to the next character | 264 /* During parsing of a C expression, the pointer to the next character |
| 211 is in this variable. */ | 265 is in this variable. */ |
| 212 | 266 |
| 213 extern char *lexptr; | 267 extern char *lexptr; |
| 214 | 268 |
| 215 /* After a token has been recognized, this variable points to it. | 269 /* After a token has been recognized, this variable points to it. |
| 216 Currently used only for error reporting. */ | 270 Currently used only for error reporting. */ |
| 217 extern char *prev_lexptr; | 271 extern char *prev_lexptr; |
| 218 | 272 |
| 219 /* Tokens that refer to names do so with explicit pointer and length, | |
| 220 so they can share the storage that lexptr is parsing. | |
| 221 | |
| 222 When it is necessary to pass a name to a function that expects | |
| 223 a null-terminated string, the substring is copied out | |
| 224 into a block of storage that namecopy points to. | |
| 225 | |
| 226 namecopy is allocated once, guaranteed big enough, for each parsing. */ | |
| 227 | |
| 228 extern char *namecopy; | |
| 229 | |
| 230 /* Current depth in parentheses within the expression. */ | 273 /* Current depth in parentheses within the expression. */ |
| 231 | 274 |
| 232 extern int paren_depth; | 275 extern int paren_depth; |
| 233 | 276 |
| 234 /* Nonzero means stop parsing on first comma (if not within parentheses). */ | 277 /* Nonzero means stop parsing on first comma (if not within parentheses). */ |
| 235 | 278 |
| 236 extern int comma_terminates; | 279 extern int comma_terminates; |
| 237 | 280 |
| 238 | 281 |
| 239 /* These codes indicate operator precedences for expression printing, | 282 /* These codes indicate operator precedences for expression printing, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 struct ui_file *, enum precedence); | 364 struct ui_file *, enum precedence); |
| 322 | 365 |
| 323 /* Function used to avoid direct calls to fprintf | 366 /* Function used to avoid direct calls to fprintf |
| 324 in the code generated by the bison parser. */ | 367 in the code generated by the bison parser. */ |
| 325 | 368 |
| 326 extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); | 369 extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); |
| 327 | 370 |
| 328 extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); | 371 extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); |
| 329 | 372 |
| 330 #endif /* PARSER_DEFS_H */ | 373 #endif /* PARSER_DEFS_H */ |
| OLD | NEW |