@@ -153,15 +153,35 @@ static inline std::string unop_to_str(const ASR::unaryopType t) {
153
153
}
154
154
}
155
155
156
+ static inline std::string binop_to_str (const ASR::binopType t) {
157
+ switch (t) {
158
+ case (ASR::binopType::Add): { return " + " ; }
159
+ case (ASR::binopType::Sub): { return " - " ; }
160
+ case (ASR::binopType::Mul): { return " *" ; }
161
+ case (ASR::binopType::Div): { return " /" ; }
162
+ default : throw LFortranException (" Cannot represent the binary operator as a string" );
163
+ }
164
+ }
165
+
156
166
static inline std::string cmpop_to_str (const ASR::cmpopType t) {
157
167
switch (t) {
158
- case (ASR::cmpopType::Eq): { return " ==" ; }
159
- case (ASR::cmpopType::NotEq): { return " !=" ; }
160
- case (ASR::cmpopType::Lt): { return " <" ; }
161
- case (ASR::cmpopType::LtE): { return " <=" ; }
162
- case (ASR::cmpopType::Gt): { return " >" ; }
163
- case (ASR::cmpopType::GtE): { return " >=" ; }
164
- default : throw LFortranException (" Not implemented" );
168
+ case (ASR::cmpopType::Eq): { return " == " ; }
169
+ case (ASR::cmpopType::NotEq): { return " != " ; }
170
+ case (ASR::cmpopType::Lt): { return " < " ; }
171
+ case (ASR::cmpopType::LtE): { return " <= " ; }
172
+ case (ASR::cmpopType::Gt): { return " > " ; }
173
+ case (ASR::cmpopType::GtE): { return " >= " ; }
174
+ default : throw LFortranException (" Cannot represent the comparison as a string" );
175
+ }
176
+ }
177
+
178
+ static inline std::string boolop_to_str (const ASR::boolopType t) {
179
+ switch (t) {
180
+ case (ASR::boolopType::And): { return " && " ; }
181
+ case (ASR::boolopType::Or): { return " || " ; }
182
+ case (ASR::boolopType::Eqv): { return " == " ; }
183
+ case (ASR::boolopType::NEqv): { return " != " ; }
184
+ default : throw LFortranException (" Cannot represent the boolean operator as a string" );
165
185
}
166
186
}
167
187
0 commit comments