| 1 | /* Ada language operator definitions for GDB, the GNU debugger. |
| 2 | |
| 3 | Copyright (C) 1992-2016 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GDB. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | /* X IN A'RANGE(N). N is an immediate operand, surrounded by |
| 21 | BINOP_IN_BOUNDS before and after. A is an array, X an index |
| 22 | value. Evaluates to true iff X is within range of the Nth |
| 23 | dimension (1-based) of A. (A multi-dimensional array |
| 24 | type is represented as array of array of ...) */ |
| 25 | OP (BINOP_IN_BOUNDS) |
| 26 | |
| 27 | /* X IN L .. U. True iff L <= X <= U. */ |
| 28 | OP (TERNOP_IN_RANGE) |
| 29 | |
| 30 | /* Ada attributes ('Foo). */ |
| 31 | OP (OP_ATR_FIRST) |
| 32 | OP (OP_ATR_LAST) |
| 33 | OP (OP_ATR_LENGTH) |
| 34 | OP (OP_ATR_IMAGE) |
| 35 | OP (OP_ATR_MAX) |
| 36 | OP (OP_ATR_MIN) |
| 37 | OP (OP_ATR_MODULUS) |
| 38 | OP (OP_ATR_POS) |
| 39 | OP (OP_ATR_SIZE) |
| 40 | OP (OP_ATR_TAG) |
| 41 | OP (OP_ATR_VAL) |
| 42 | |
| 43 | /* Ada type qualification. It is encoded as for UNOP_CAST, above, |
| 44 | and denotes the TYPE'(EXPR) construct. */ |
| 45 | OP (UNOP_QUAL) |
| 46 | |
| 47 | /* X IN TYPE. The `TYPE' argument is immediate, with |
| 48 | UNOP_IN_RANGE before and after it. True iff X is a member of |
| 49 | type TYPE (typically a subrange). */ |
| 50 | OP (UNOP_IN_RANGE) |
| 51 | |
| 52 | /* An aggregate. A single immediate operand, N>0, gives |
| 53 | the number of component specifications that follow. The |
| 54 | immediate operand is followed by a second OP_AGGREGATE. |
| 55 | Next come N component specifications. A component |
| 56 | specification is either an OP_OTHERS (others=>...), an |
| 57 | OP_CHOICES (for named associations), or other expression (for |
| 58 | positional aggregates only). Aggregates currently |
| 59 | occur only as the right sides of assignments. */ |
| 60 | OP (OP_AGGREGATE) |
| 61 | |
| 62 | /* An others clause. Followed by a single expression. */ |
| 63 | OP (OP_OTHERS) |
| 64 | |
| 65 | /* An aggregate component association. A single immediate operand, N, |
| 66 | gives the number of choices that follow. This is followed by a second |
| 67 | OP_CHOICES operator. Next come N operands, each of which is an |
| 68 | expression, an OP_DISCRETE_RANGE, or an OP_NAME---the latter |
| 69 | for a simple name that must be a record component name and does |
| 70 | not correspond to a single existing symbol. After the N choice |
| 71 | indicators comes an expression giving the value. |
| 72 | |
| 73 | In an aggregate such as (X => E1, ...), where X is a simple |
| 74 | name, X could syntactically be either a component_selector_name |
| 75 | or an expression used as a discrete_choice, depending on the |
| 76 | aggregate's type context. Since this is not known at parsing |
| 77 | time, we don't attempt to disambiguate X if it has multiple |
| 78 | definitions, but instead supply an OP_NAME. If X has a single |
| 79 | definition, we represent it with an OP_VAR_VALUE, even though |
| 80 | it may turn out to be within a record aggregate. Aggregate |
| 81 | evaluation can use either OP_NAMEs or OP_VAR_VALUEs to get a |
| 82 | record field name, and can evaluate OP_VAR_VALUE normally to |
| 83 | get its value as an expression. Unfortunately, we lose out in |
| 84 | cases where X has multiple meanings and is part of an array |
| 85 | aggregate. I hope these are not common enough to annoy users, |
| 86 | who can work around the problem in any case by putting |
| 87 | parentheses around X. */ |
| 88 | OP (OP_CHOICES) |
| 89 | |
| 90 | /* A positional aggregate component association. The operator is |
| 91 | followed by a single integer indicating the position in the |
| 92 | aggregate (0-based), followed by a second OP_POSITIONAL. Next |
| 93 | follows a single expression giving the component value. */ |
| 94 | OP (OP_POSITIONAL) |
| 95 | |
| 96 | /* A range of values. Followed by two expressions giving the |
| 97 | upper and lower bounds of the range. */ |
| 98 | OP (OP_DISCRETE_RANGE) |