This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Some pascal parser enhancements
- From: Pierre Muller <muller at ics dot u-strasbg dot fr>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 19 Nov 2002 13:43:26 +0100
- Subject: [PATCH] Some pascal parser enhancements
I committed the following patch,
it add support for type written as '^type'
in the parser.
It also add automatic derefencing of
pascal classes (which are pointers to objects).
2002-11-19 Pierre Muller <muller@ics.u-strasbg.fr>
* p-exp.y (typecast rule): Add automatic dereference of
pascal classes if needed.
(THIS): Set current_type.
Automatically dereference pascal classes.
(typebase rule): Add ^typebase recognition.
Index: p-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/p-exp.y,v
retrieving revision 1.18
diff -r1.18 p-exp.y
345c345,353
< { write_exp_elt_opcode (UNOP_CAST);
---
> { if (current_type)
> {
> /* Allow automatic dereference of classes. */
> if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
> && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
> && (TYPE_CODE ($1) == TYPE_CODE_CLASS))
> write_exp_elt_opcode (UNOP_IND);
> }
> write_exp_elt_opcode (UNOP_CAST);
507,508c515,536
< { write_exp_elt_opcode (OP_THIS);
< write_exp_elt_opcode (OP_THIS); }
---
> {
> struct value * this_val;
> struct type * this_type;
> write_exp_elt_opcode (OP_THIS);
> write_exp_elt_opcode (OP_THIS);
> /* we need type of this */
> this_val = value_of_this (0);
> if (this_val)
> this_type = this_val->type;
> else
> this_type = NULL;
> if (this_type)
> {
> if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
> {
> this_type = TYPE_TARGET_TYPE (this_type);
> write_exp_elt_opcode (UNOP_IND);
> }
> }
>
> current_type = this_type;
> }
696c724,726
< : TYPENAME
---
> : '^' typebase
> { $$ = lookup_pointer_type ($2); }
> | TYPENAME
Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99