Automatic date update in version.in
[binutils-gdb.git] / gdb / m2-exp.h
blobcf233e66009ed04dcf7c5698116ab39960bee7a1
1 /* Definitions for Modula-2 expressions
3 Copyright (C) 2020-2022 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #ifndef M2_EXP_H
21 #define M2_EXP_H
23 #include "expop.h"
25 extern struct value *eval_op_m2_high (struct type *expect_type,
26 struct expression *exp,
27 enum noside noside,
28 struct value *arg1);
29 extern struct value *eval_op_m2_subscript (struct type *expect_type,
30 struct expression *exp,
31 enum noside noside,
32 struct value *arg1,
33 struct value *arg2);
35 namespace expr
38 /* The Modula-2 "HIGH" operation. */
39 class m2_unop_high_operation
40 : public tuple_holding_operation<operation_up>
42 public:
44 using tuple_holding_operation::tuple_holding_operation;
46 value *evaluate (struct type *expect_type,
47 struct expression *exp,
48 enum noside noside) override
50 value *arg1 = std::get<0> (m_storage)->evaluate_with_coercion (exp,
51 noside);
52 return eval_op_m2_high (expect_type, exp, noside, arg1);
55 enum exp_opcode opcode () const override
56 { return UNOP_HIGH; }
59 /* Subscripting for Modula-2. */
60 class m2_binop_subscript_operation
61 : public tuple_holding_operation<operation_up, operation_up>
63 public:
65 using tuple_holding_operation::tuple_holding_operation;
67 value *evaluate (struct type *expect_type,
68 struct expression *exp,
69 enum noside noside) override
71 value *arg1 = std::get<0> (m_storage)->evaluate_with_coercion (exp,
72 noside);
73 value *arg2 = std::get<1> (m_storage)->evaluate_with_coercion (exp,
74 noside);
75 return eval_op_m2_subscript (expect_type, exp, noside, arg1, arg2);
78 enum exp_opcode opcode () const override
79 { return BINOP_SUBSCRIPT; }
82 } /* namespace expr */
84 #endif /* M2_EXP_H */