1 /* expr.c -- Implementation File (module.c template V1.0)
2 Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002
3 Free Software Foundation, Inc.
4 Contributed by James Craig Burley.
6 This file is part of GNU Fortran.
8 GNU Fortran is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU Fortran is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Fortran; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
27 Handles syntactic and semantic analysis of Fortran expressions.
53 /* Externals defined here. */
56 /* Simple definitions and enumerations. */
60 FFEEXPR_exprtypeUNKNOWN_
,
61 FFEEXPR_exprtypeOPERAND_
,
62 FFEEXPR_exprtypeUNARY_
,
63 FFEEXPR_exprtypeBINARY_
,
69 FFEEXPR_operatorPOWER_
,
70 FFEEXPR_operatorMULTIPLY_
,
71 FFEEXPR_operatorDIVIDE_
,
73 FFEEXPR_operatorSUBTRACT_
,
74 FFEEXPR_operatorCONCATENATE_
,
86 FFEEXPR_operatorNEQV_
,
92 FFEEXPR_operatorprecedenceHIGHEST_
= 1,
93 FFEEXPR_operatorprecedencePOWER_
= 1,
94 FFEEXPR_operatorprecedenceMULTIPLY_
= 2,
95 FFEEXPR_operatorprecedenceDIVIDE_
= 2,
96 FFEEXPR_operatorprecedenceADD_
= 3,
97 FFEEXPR_operatorprecedenceSUBTRACT_
= 3,
98 FFEEXPR_operatorprecedenceLOWARITH_
= 3,
99 FFEEXPR_operatorprecedenceCONCATENATE_
= 3,
100 FFEEXPR_operatorprecedenceLT_
= 4,
101 FFEEXPR_operatorprecedenceLE_
= 4,
102 FFEEXPR_operatorprecedenceEQ_
= 4,
103 FFEEXPR_operatorprecedenceNE_
= 4,
104 FFEEXPR_operatorprecedenceGT_
= 4,
105 FFEEXPR_operatorprecedenceGE_
= 4,
106 FFEEXPR_operatorprecedenceNOT_
= 5,
107 FFEEXPR_operatorprecedenceAND_
= 6,
108 FFEEXPR_operatorprecedenceOR_
= 7,
109 FFEEXPR_operatorprecedenceXOR_
= 8,
110 FFEEXPR_operatorprecedenceEQV_
= 8,
111 FFEEXPR_operatorprecedenceNEQV_
= 8,
112 FFEEXPR_operatorprecedenceLOWEST_
= 8,
113 FFEEXPR_operatorprecedence_
114 } ffeexprOperatorPrecedence_
;
116 #define FFEEXPR_operatorassociativityL2R_ TRUE
117 #define FFEEXPR_operatorassociativityR2L_ FALSE
118 #define FFEEXPR_operatorassociativityPOWER_ FFEEXPR_operatorassociativityR2L_
119 #define FFEEXPR_operatorassociativityMULTIPLY_ FFEEXPR_operatorassociativityL2R_
120 #define FFEEXPR_operatorassociativityDIVIDE_ FFEEXPR_operatorassociativityL2R_
121 #define FFEEXPR_operatorassociativityADD_ FFEEXPR_operatorassociativityL2R_
122 #define FFEEXPR_operatorassociativitySUBTRACT_ FFEEXPR_operatorassociativityL2R_
123 #define FFEEXPR_operatorassociativityCONCATENATE_ FFEEXPR_operatorassociativityL2R_
124 #define FFEEXPR_operatorassociativityLT_ FFEEXPR_operatorassociativityL2R_
125 #define FFEEXPR_operatorassociativityLE_ FFEEXPR_operatorassociativityL2R_
126 #define FFEEXPR_operatorassociativityEQ_ FFEEXPR_operatorassociativityL2R_
127 #define FFEEXPR_operatorassociativityNE_ FFEEXPR_operatorassociativityL2R_
128 #define FFEEXPR_operatorassociativityGT_ FFEEXPR_operatorassociativityL2R_
129 #define FFEEXPR_operatorassociativityGE_ FFEEXPR_operatorassociativityL2R_
130 #define FFEEXPR_operatorassociativityNOT_ FFEEXPR_operatorassociativityL2R_
131 #define FFEEXPR_operatorassociativityAND_ FFEEXPR_operatorassociativityL2R_
132 #define FFEEXPR_operatorassociativityOR_ FFEEXPR_operatorassociativityL2R_
133 #define FFEEXPR_operatorassociativityXOR_ FFEEXPR_operatorassociativityL2R_
134 #define FFEEXPR_operatorassociativityEQV_ FFEEXPR_operatorassociativityL2R_
135 #define FFEEXPR_operatorassociativityNEQV_ FFEEXPR_operatorassociativityL2R_
139 FFEEXPR_parentypeFUNCTION_
,
140 FFEEXPR_parentypeSUBROUTINE_
,
141 FFEEXPR_parentypeARRAY_
,
142 FFEEXPR_parentypeSUBSTRING_
,
143 FFEEXPR_parentypeFUNSUBSTR_
,/* Ambig: check for colon after first expr. */
144 FFEEXPR_parentypeEQUIVALENCE_
, /* Ambig: ARRAY_ or SUBSTRING_. */
145 FFEEXPR_parentypeANY_
, /* Allow basically anything. */
151 FFEEXPR_percentNONE_
,
155 FFEEXPR_percentDESCR_
,
159 /* Internal typedefs. */
161 typedef struct _ffeexpr_expr_
*ffeexprExpr_
;
162 typedef bool ffeexprOperatorAssociativity_
;
163 typedef struct _ffeexpr_stack_
*ffeexprStack_
;
165 /* Private include files. */
168 /* Internal structure definitions. */
170 struct _ffeexpr_expr_
172 ffeexprExpr_ previous
;
174 ffeexprExprtype_ type
;
180 ffeexprOperatorPrecedence_ prec
;
181 ffeexprOperatorAssociativity_ as
;
189 struct _ffeexpr_stack_
191 ffeexprStack_ previous
;
193 ffeexprContext context
;
194 ffeexprCallback callback
;
195 ffelexToken first_token
;
196 ffeexprExpr_ exprstack
;
197 ffelexToken tokens
[10]; /* Used in certain cases, like (unary)
199 ffebld expr
; /* For first of
200 complex/implied-do/substring/array-elements
201 / actual-args expression. */
202 ffebld bound_list
; /* For tracking dimension bounds list of
204 ffebldListBottom bottom
; /* For building lists. */
205 ffeinfoRank rank
; /* For elements in an array reference. */
206 bool constant
; /* TRUE while elements seen so far are
208 bool immediate
; /* TRUE while elements seen so far are
209 immediate/constants. */
210 ffebld next_dummy
; /* Next SFUNC dummy arg in arg list. */
211 ffebldListLength num_args
; /* Number of dummy args expected in arg list. */
212 bool is_rhs
; /* TRUE if rhs context, FALSE otherwise. */
213 ffeexprPercent_ percent
; /* Current %FOO keyword. */
216 struct _ffeexpr_find_
223 /* Static objects accessed by functions in this module. */
225 static ffeexprStack_ ffeexpr_stack_
; /* Expression stack for semantic. */
226 static ffelexToken ffeexpr_tokens_
[10]; /* Scratchpad tokens for syntactic. */
227 static ffestrOther ffeexpr_current_dotdot_
; /* Current .FOO. keyword. */
228 static long ffeexpr_hollerith_count_
; /* ffeexpr_token_number_ and caller. */
229 static int ffeexpr_level_
; /* Level of DATA implied-DO construct. */
230 static bool ffeexpr_is_substr_ok_
; /* If OPEN_PAREN as binary "op" ok. */
231 static struct _ffeexpr_find_ ffeexpr_find_
;
233 /* Static functions (internal). */
235 static ffelexHandler
ffeexpr_cb_close_paren_ (ffelexToken ft
, ffebld expr
,
237 static ffelexHandler
ffeexpr_cb_close_paren_ambig_ (ffelexToken ft
,
240 static ffelexHandler
ffeexpr_cb_close_paren_ambig_1_ (ffelexToken t
);
241 static ffelexHandler
ffeexpr_cb_close_paren_c_ (ffelexToken ft
,
242 ffebld expr
, ffelexToken t
);
243 static ffelexHandler
ffeexpr_cb_comma_c_ (ffelexToken ft
, ffebld expr
,
245 static ffelexHandler
ffeexpr_cb_close_paren_ci_ (ffelexToken ft
,
246 ffebld expr
, ffelexToken t
);
247 static ffelexHandler
ffeexpr_cb_comma_ci_ (ffelexToken ft
, ffebld expr
,
249 static ffelexHandler
ffeexpr_cb_comma_i_ (ffelexToken ft
, ffebld expr
,
251 static ffelexHandler
ffeexpr_cb_comma_i_1_ (ffelexToken ft
, ffebld expr
,
253 static ffelexHandler
ffeexpr_cb_comma_i_2_ (ffelexToken ft
, ffebld expr
,
255 static ffelexHandler
ffeexpr_cb_comma_i_3_ (ffelexToken ft
, ffebld expr
,
257 static ffelexHandler
ffeexpr_cb_comma_i_4_ (ffelexToken ft
, ffebld expr
,
259 static ffelexHandler
ffeexpr_cb_comma_i_5_ (ffelexToken t
);
260 static ffelexHandler
ffeexpr_cb_end_loc_ (ffelexToken ft
, ffebld expr
,
262 static ffelexHandler
ffeexpr_cb_end_notloc_ (ffelexToken ft
, ffebld expr
,
264 static ffelexHandler
ffeexpr_cb_end_notloc_1_ (ffelexToken t
);
265 static ffesymbol
ffeexpr_check_impctrl_ (ffesymbol s
);
266 static void ffeexpr_check_impdo_ (ffebld list
, ffelexToken list_t
,
267 ffebld dovar
, ffelexToken dovar_t
);
268 static void ffeexpr_update_impdo_ (ffebld expr
, ffebld dovar
);
269 static void ffeexpr_update_impdo_sym_ (ffebld expr
, ffesymbol dovar
);
270 static ffeexprContext
ffeexpr_context_outer_ (ffeexprStack_ s
);
271 static ffeexprExpr_
ffeexpr_expr_new_ (void);
272 static void ffeexpr_fulfill_call_ (ffebld
*expr
, ffelexToken t
);
273 static bool ffeexpr_isdigits_ (const char *p
);
274 static ffelexHandler
ffeexpr_token_first_lhs_ (ffelexToken t
);
275 static ffelexHandler
ffeexpr_token_first_lhs_1_ (ffelexToken t
);
276 static ffelexHandler
ffeexpr_token_first_rhs_ (ffelexToken t
);
277 static ffelexHandler
ffeexpr_token_first_rhs_1_ (ffelexToken t
);
278 static ffelexHandler
ffeexpr_token_first_rhs_2_ (ffelexToken t
);
279 static ffelexHandler
ffeexpr_token_first_rhs_3_ (ffelexToken t
);
280 static ffelexHandler
ffeexpr_token_first_rhs_4_ (ffelexToken t
);
281 static ffelexHandler
ffeexpr_token_first_rhs_5_ (ffelexToken t
);
282 static ffelexHandler
ffeexpr_token_first_rhs_6_ (ffelexToken t
);
283 static ffelexHandler
ffeexpr_token_namelist_ (ffelexToken t
);
284 static void ffeexpr_expr_kill_ (ffeexprExpr_ e
);
285 static void ffeexpr_exprstack_push_ (ffeexprExpr_ e
);
286 static void ffeexpr_exprstack_push_binary_ (ffeexprExpr_ e
);
287 static void ffeexpr_exprstack_push_operand_ (ffeexprExpr_ e
);
288 static void ffeexpr_exprstack_push_unary_ (ffeexprExpr_ e
);
289 static void ffeexpr_reduce_ (void);
290 static ffebld
ffeexpr_reduced_bool1_ (ffebld reduced
, ffeexprExpr_ op
,
292 static ffebld
ffeexpr_reduced_bool2_ (ffebld reduced
, ffeexprExpr_ l
,
293 ffeexprExpr_ op
, ffeexprExpr_ r
);
294 static ffebld
ffeexpr_reduced_concatenate_ (ffebld reduced
, ffeexprExpr_ l
,
295 ffeexprExpr_ op
, ffeexprExpr_ r
);
296 static ffebld
ffeexpr_reduced_eqop2_ (ffebld reduced
, ffeexprExpr_ l
,
297 ffeexprExpr_ op
, ffeexprExpr_ r
);
298 static ffebld
ffeexpr_reduced_math1_ (ffebld reduced
, ffeexprExpr_ op
,
300 static ffebld
ffeexpr_reduced_math2_ (ffebld reduced
, ffeexprExpr_ l
,
301 ffeexprExpr_ op
, ffeexprExpr_ r
);
302 static ffebld
ffeexpr_reduced_power_ (ffebld reduced
, ffeexprExpr_ l
,
303 ffeexprExpr_ op
, ffeexprExpr_ r
);
304 static ffebld
ffeexpr_reduced_relop2_ (ffebld reduced
, ffeexprExpr_ l
,
305 ffeexprExpr_ op
, ffeexprExpr_ r
);
306 static ffebld
ffeexpr_reduced_ugly1_ (ffebld reduced
, ffeexprExpr_ op
, ffeexprExpr_ r
);
307 static ffebld
ffeexpr_reduced_ugly1log_ (ffebld reduced
, ffeexprExpr_ op
,
309 static ffebld
ffeexpr_reduced_ugly2_ (ffebld reduced
, ffeexprExpr_ l
,
310 ffeexprExpr_ op
, ffeexprExpr_ r
);
311 static ffebld
ffeexpr_reduced_ugly2log_ (ffebld reduced
, ffeexprExpr_ l
,
312 ffeexprExpr_ op
, ffeexprExpr_ r
);
313 static ffelexHandler
ffeexpr_find_close_paren_ (ffelexToken t
,
314 ffelexHandler after
);
315 static ffelexHandler
ffeexpr_nil_finished_ (ffelexToken t
);
316 static ffelexHandler
ffeexpr_nil_rhs_ (ffelexToken t
);
317 static ffelexHandler
ffeexpr_nil_period_ (ffelexToken t
);
318 static ffelexHandler
ffeexpr_nil_end_period_ (ffelexToken t
);
319 static ffelexHandler
ffeexpr_nil_swallow_period_ (ffelexToken t
);
320 static ffelexHandler
ffeexpr_nil_real_ (ffelexToken t
);
321 static ffelexHandler
ffeexpr_nil_real_exponent_ (ffelexToken t
);
322 static ffelexHandler
ffeexpr_nil_real_exp_sign_ (ffelexToken t
);
323 static ffelexHandler
ffeexpr_nil_number_ (ffelexToken t
);
324 static ffelexHandler
ffeexpr_nil_number_exponent_ (ffelexToken t
);
325 static ffelexHandler
ffeexpr_nil_number_exp_sign_ (ffelexToken t
);
326 static ffelexHandler
ffeexpr_nil_number_period_ (ffelexToken t
);
327 static ffelexHandler
ffeexpr_nil_number_per_exp_ (ffelexToken t
);
328 static ffelexHandler
ffeexpr_nil_number_real_ (ffelexToken t
);
329 static ffelexHandler
ffeexpr_nil_num_per_exp_sign_ (ffelexToken t
);
330 static ffelexHandler
ffeexpr_nil_number_real_exp_ (ffelexToken t
);
331 static ffelexHandler
ffeexpr_nil_num_real_exp_sn_ (ffelexToken t
);
332 static ffelexHandler
ffeexpr_nil_binary_ (ffelexToken t
);
333 static ffelexHandler
ffeexpr_nil_binary_period_ (ffelexToken t
);
334 static ffelexHandler
ffeexpr_nil_binary_end_per_ (ffelexToken t
);
335 static ffelexHandler
ffeexpr_nil_binary_sw_per_ (ffelexToken t
);
336 static ffelexHandler
ffeexpr_nil_quote_ (ffelexToken t
);
337 static ffelexHandler
ffeexpr_nil_apostrophe_ (ffelexToken t
);
338 static ffelexHandler
ffeexpr_nil_apos_char_ (ffelexToken t
);
339 static ffelexHandler
ffeexpr_nil_name_rhs_ (ffelexToken t
);
340 static ffelexHandler
ffeexpr_nil_name_apos_ (ffelexToken t
);
341 static ffelexHandler
ffeexpr_nil_name_apos_name_ (ffelexToken t
);
342 static ffelexHandler
ffeexpr_nil_percent_ (ffelexToken t
);
343 static ffelexHandler
ffeexpr_nil_percent_name_ (ffelexToken t
);
344 static ffelexHandler
ffeexpr_nil_substrp_ (ffelexToken t
);
345 static ffelexHandler
ffeexpr_finished_ (ffelexToken t
);
346 static ffebld
ffeexpr_finished_ambig_ (ffelexToken t
, ffebld expr
);
347 static ffelexHandler
ffeexpr_token_lhs_ (ffelexToken t
);
348 static ffelexHandler
ffeexpr_token_rhs_ (ffelexToken t
);
349 static ffelexHandler
ffeexpr_token_binary_ (ffelexToken t
);
350 static ffelexHandler
ffeexpr_token_period_ (ffelexToken t
);
351 static ffelexHandler
ffeexpr_token_end_period_ (ffelexToken t
);
352 static ffelexHandler
ffeexpr_token_swallow_period_ (ffelexToken t
);
353 static ffelexHandler
ffeexpr_token_real_ (ffelexToken t
);
354 static ffelexHandler
ffeexpr_token_real_exponent_ (ffelexToken t
);
355 static ffelexHandler
ffeexpr_token_real_exp_sign_ (ffelexToken t
);
356 static ffelexHandler
ffeexpr_token_number_ (ffelexToken t
);
357 static ffelexHandler
ffeexpr_token_number_exponent_ (ffelexToken t
);
358 static ffelexHandler
ffeexpr_token_number_exp_sign_ (ffelexToken t
);
359 static ffelexHandler
ffeexpr_token_number_period_ (ffelexToken t
);
360 static ffelexHandler
ffeexpr_token_number_per_exp_ (ffelexToken t
);
361 static ffelexHandler
ffeexpr_token_number_real_ (ffelexToken t
);
362 static ffelexHandler
ffeexpr_token_num_per_exp_sign_ (ffelexToken t
);
363 static ffelexHandler
ffeexpr_token_number_real_exp_ (ffelexToken t
);
364 static ffelexHandler
ffeexpr_token_num_real_exp_sn_ (ffelexToken t
);
365 static ffelexHandler
ffeexpr_token_binary_period_ (ffelexToken t
);
366 static ffelexHandler
ffeexpr_token_binary_end_per_ (ffelexToken t
);
367 static ffelexHandler
ffeexpr_token_binary_sw_per_ (ffelexToken t
);
368 static ffelexHandler
ffeexpr_token_quote_ (ffelexToken t
);
369 static ffelexHandler
ffeexpr_token_apostrophe_ (ffelexToken t
);
370 static ffelexHandler
ffeexpr_token_apos_char_ (ffelexToken t
);
371 static ffelexHandler
ffeexpr_token_name_lhs_ (ffelexToken t
);
372 static ffelexHandler
ffeexpr_token_name_arg_ (ffelexToken t
);
373 static ffelexHandler
ffeexpr_token_name_rhs_ (ffelexToken t
);
374 static ffelexHandler
ffeexpr_token_name_apos_ (ffelexToken t
);
375 static ffelexHandler
ffeexpr_token_name_apos_name_ (ffelexToken t
);
376 static ffelexHandler
ffeexpr_token_percent_ (ffelexToken t
);
377 static ffelexHandler
ffeexpr_token_percent_name_ (ffelexToken t
);
378 static ffelexHandler
ffeexpr_token_arguments_ (ffelexToken ft
, ffebld expr
,
380 static ffelexHandler
ffeexpr_token_elements_ (ffelexToken ft
, ffebld expr
,
382 static ffelexHandler
ffeexpr_token_equivalence_ (ffelexToken ft
, ffebld expr
,
384 static ffelexHandler
ffeexpr_token_substring_ (ffelexToken ft
, ffebld expr
,
386 static ffelexHandler
ffeexpr_token_substring_1_ (ffelexToken ft
, ffebld expr
,
388 static ffelexHandler
ffeexpr_token_substrp_ (ffelexToken t
);
389 static ffelexHandler
ffeexpr_token_intrincheck_ (ffelexToken t
);
390 static ffelexHandler
ffeexpr_token_funsubstr_ (ffelexToken ft
, ffebld expr
,
392 static ffelexHandler
ffeexpr_token_anything_ (ffelexToken ft
, ffebld expr
,
394 static void ffeexpr_make_float_const_ (char exp_letter
, ffelexToken integer
,
395 ffelexToken decimal
, ffelexToken fraction
, ffelexToken exponent
,
396 ffelexToken exponent_sign
, ffelexToken exponent_digits
);
397 static ffesymbol
ffeexpr_declare_unadorned_ (ffelexToken t
, bool maybe_intrin
);
398 static ffesymbol
ffeexpr_sym_impdoitem_ (ffesymbol s
, ffelexToken t
);
399 static ffesymbol
ffeexpr_sym_lhs_call_ (ffesymbol s
, ffelexToken t
);
400 static ffesymbol
ffeexpr_sym_lhs_data_ (ffesymbol s
, ffelexToken t
);
401 static ffesymbol
ffeexpr_sym_lhs_equivalence_ (ffesymbol s
, ffelexToken t
);
402 static ffesymbol
ffeexpr_sym_lhs_extfunc_ (ffesymbol s
, ffelexToken t
);
403 static ffesymbol
ffeexpr_sym_lhs_impdoctrl_ (ffesymbol s
, ffelexToken t
);
404 static ffesymbol
ffeexpr_sym_lhs_parameter_ (ffesymbol s
, ffelexToken t
);
405 static ffesymbol
ffeexpr_sym_rhs_actualarg_ (ffesymbol s
, ffelexToken t
);
406 static ffesymbol
ffeexpr_sym_rhs_dimlist_ (ffesymbol s
, ffelexToken t
);
407 static ffesymbol
ffeexpr_sym_rhs_let_ (ffesymbol s
, ffelexToken t
);
408 static ffesymbol
ffeexpr_declare_parenthesized_ (ffelexToken t
,
410 ffeexprParenType_
*paren_type
);
411 static ffesymbol
ffeexpr_paren_rhs_let_ (ffesymbol s
, ffelexToken t
);
413 /* Internal macros. */
415 #define ffeexpr_paren_lhs_let_(s,t) ffeexpr_sym_rhs_let_(s,t)
416 #define ffeexpr_sym_lhs_let_(s,t) ffeexpr_sym_rhs_let_(s,t)
418 /* ffeexpr_collapse_convert -- Collapse convert expr
422 expr = ffeexpr_collapse_convert(expr,token);
424 If the result of the expr is a constant, replaces the expr with the
425 computed constant. */
428 ffeexpr_collapse_convert (ffebld expr
, ffelexToken t
)
430 ffebad error
= FFEBAD
;
432 ffebldConstantUnion u
;
435 ffetargetCharacterSize sz
;
436 ffetargetCharacterSize sz2
;
438 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
441 l
= ffebld_left (expr
);
443 if (ffebld_op (l
) != FFEBLD_opCONTER
)
446 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
448 case FFEINFO_basictypeANY
:
451 case FFEINFO_basictypeINTEGER
:
452 sz
= FFETARGET_charactersizeNONE
;
453 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
455 #if FFETARGET_okINTEGER1
456 case FFEINFO_kindtypeINTEGER1
:
457 switch (ffeinfo_basictype (ffebld_info (l
)))
459 case FFEINFO_basictypeINTEGER
:
460 switch (ffeinfo_kindtype (ffebld_info (l
)))
462 #if FFETARGET_okINTEGER2
463 case FFEINFO_kindtypeINTEGER2
:
464 error
= ffetarget_convert_integer1_integer2
465 (ffebld_cu_ptr_integer1 (u
),
466 ffebld_constant_integer2 (ffebld_conter (l
)));
470 #if FFETARGET_okINTEGER3
471 case FFEINFO_kindtypeINTEGER3
:
472 error
= ffetarget_convert_integer1_integer3
473 (ffebld_cu_ptr_integer1 (u
),
474 ffebld_constant_integer3 (ffebld_conter (l
)));
478 #if FFETARGET_okINTEGER4
479 case FFEINFO_kindtypeINTEGER4
:
480 error
= ffetarget_convert_integer1_integer4
481 (ffebld_cu_ptr_integer1 (u
),
482 ffebld_constant_integer4 (ffebld_conter (l
)));
487 assert ("INTEGER1/INTEGER bad source kind type" == NULL
);
492 case FFEINFO_basictypeREAL
:
493 switch (ffeinfo_kindtype (ffebld_info (l
)))
495 #if FFETARGET_okREAL1
496 case FFEINFO_kindtypeREAL1
:
497 error
= ffetarget_convert_integer1_real1
498 (ffebld_cu_ptr_integer1 (u
),
499 ffebld_constant_real1 (ffebld_conter (l
)));
503 #if FFETARGET_okREAL2
504 case FFEINFO_kindtypeREAL2
:
505 error
= ffetarget_convert_integer1_real2
506 (ffebld_cu_ptr_integer1 (u
),
507 ffebld_constant_real2 (ffebld_conter (l
)));
511 #if FFETARGET_okREAL3
512 case FFEINFO_kindtypeREAL3
:
513 error
= ffetarget_convert_integer1_real3
514 (ffebld_cu_ptr_integer1 (u
),
515 ffebld_constant_real3 (ffebld_conter (l
)));
519 #if FFETARGET_okREAL4
520 case FFEINFO_kindtypeREAL4
:
521 error
= ffetarget_convert_integer1_real4
522 (ffebld_cu_ptr_integer1 (u
),
523 ffebld_constant_real4 (ffebld_conter (l
)));
528 assert ("INTEGER1/REAL bad source kind type" == NULL
);
533 case FFEINFO_basictypeCOMPLEX
:
534 switch (ffeinfo_kindtype (ffebld_info (l
)))
536 #if FFETARGET_okCOMPLEX1
537 case FFEINFO_kindtypeREAL1
:
538 error
= ffetarget_convert_integer1_complex1
539 (ffebld_cu_ptr_integer1 (u
),
540 ffebld_constant_complex1 (ffebld_conter (l
)));
544 #if FFETARGET_okCOMPLEX2
545 case FFEINFO_kindtypeREAL2
:
546 error
= ffetarget_convert_integer1_complex2
547 (ffebld_cu_ptr_integer1 (u
),
548 ffebld_constant_complex2 (ffebld_conter (l
)));
552 #if FFETARGET_okCOMPLEX3
553 case FFEINFO_kindtypeREAL3
:
554 error
= ffetarget_convert_integer1_complex3
555 (ffebld_cu_ptr_integer1 (u
),
556 ffebld_constant_complex3 (ffebld_conter (l
)));
560 #if FFETARGET_okCOMPLEX4
561 case FFEINFO_kindtypeREAL4
:
562 error
= ffetarget_convert_integer1_complex4
563 (ffebld_cu_ptr_integer1 (u
),
564 ffebld_constant_complex4 (ffebld_conter (l
)));
569 assert ("INTEGER1/COMPLEX bad source kind type" == NULL
);
574 case FFEINFO_basictypeLOGICAL
:
575 switch (ffeinfo_kindtype (ffebld_info (l
)))
577 #if FFETARGET_okLOGICAL1
578 case FFEINFO_kindtypeLOGICAL1
:
579 error
= ffetarget_convert_integer1_logical1
580 (ffebld_cu_ptr_integer1 (u
),
581 ffebld_constant_logical1 (ffebld_conter (l
)));
585 #if FFETARGET_okLOGICAL2
586 case FFEINFO_kindtypeLOGICAL2
:
587 error
= ffetarget_convert_integer1_logical2
588 (ffebld_cu_ptr_integer1 (u
),
589 ffebld_constant_logical2 (ffebld_conter (l
)));
593 #if FFETARGET_okLOGICAL3
594 case FFEINFO_kindtypeLOGICAL3
:
595 error
= ffetarget_convert_integer1_logical3
596 (ffebld_cu_ptr_integer1 (u
),
597 ffebld_constant_logical3 (ffebld_conter (l
)));
601 #if FFETARGET_okLOGICAL4
602 case FFEINFO_kindtypeLOGICAL4
:
603 error
= ffetarget_convert_integer1_logical4
604 (ffebld_cu_ptr_integer1 (u
),
605 ffebld_constant_logical4 (ffebld_conter (l
)));
610 assert ("INTEGER1/LOGICAL bad source kind type" == NULL
);
615 case FFEINFO_basictypeCHARACTER
:
616 error
= ffetarget_convert_integer1_character1
617 (ffebld_cu_ptr_integer1 (u
),
618 ffebld_constant_character1 (ffebld_conter (l
)));
621 case FFEINFO_basictypeHOLLERITH
:
622 error
= ffetarget_convert_integer1_hollerith
623 (ffebld_cu_ptr_integer1 (u
),
624 ffebld_constant_hollerith (ffebld_conter (l
)));
627 case FFEINFO_basictypeTYPELESS
:
628 error
= ffetarget_convert_integer1_typeless
629 (ffebld_cu_ptr_integer1 (u
),
630 ffebld_constant_typeless (ffebld_conter (l
)));
634 assert ("INTEGER1 bad type" == NULL
);
638 /* If conversion operation is not implemented, return original expr. */
639 if (error
== FFEBAD_NOCANDO
)
642 expr
= ffebld_new_conter_with_orig
643 (ffebld_constant_new_integer1_val
644 (ffebld_cu_val_integer1 (u
)), expr
);
648 #if FFETARGET_okINTEGER2
649 case FFEINFO_kindtypeINTEGER2
:
650 switch (ffeinfo_basictype (ffebld_info (l
)))
652 case FFEINFO_basictypeINTEGER
:
653 switch (ffeinfo_kindtype (ffebld_info (l
)))
655 #if FFETARGET_okINTEGER1
656 case FFEINFO_kindtypeINTEGER1
:
657 error
= ffetarget_convert_integer2_integer1
658 (ffebld_cu_ptr_integer2 (u
),
659 ffebld_constant_integer1 (ffebld_conter (l
)));
663 #if FFETARGET_okINTEGER3
664 case FFEINFO_kindtypeINTEGER3
:
665 error
= ffetarget_convert_integer2_integer3
666 (ffebld_cu_ptr_integer2 (u
),
667 ffebld_constant_integer3 (ffebld_conter (l
)));
671 #if FFETARGET_okINTEGER4
672 case FFEINFO_kindtypeINTEGER4
:
673 error
= ffetarget_convert_integer2_integer4
674 (ffebld_cu_ptr_integer2 (u
),
675 ffebld_constant_integer4 (ffebld_conter (l
)));
680 assert ("INTEGER2/INTEGER bad source kind type" == NULL
);
685 case FFEINFO_basictypeREAL
:
686 switch (ffeinfo_kindtype (ffebld_info (l
)))
688 #if FFETARGET_okREAL1
689 case FFEINFO_kindtypeREAL1
:
690 error
= ffetarget_convert_integer2_real1
691 (ffebld_cu_ptr_integer2 (u
),
692 ffebld_constant_real1 (ffebld_conter (l
)));
696 #if FFETARGET_okREAL2
697 case FFEINFO_kindtypeREAL2
:
698 error
= ffetarget_convert_integer2_real2
699 (ffebld_cu_ptr_integer2 (u
),
700 ffebld_constant_real2 (ffebld_conter (l
)));
704 #if FFETARGET_okREAL3
705 case FFEINFO_kindtypeREAL3
:
706 error
= ffetarget_convert_integer2_real3
707 (ffebld_cu_ptr_integer2 (u
),
708 ffebld_constant_real3 (ffebld_conter (l
)));
712 #if FFETARGET_okREAL4
713 case FFEINFO_kindtypeREAL4
:
714 error
= ffetarget_convert_integer2_real4
715 (ffebld_cu_ptr_integer2 (u
),
716 ffebld_constant_real4 (ffebld_conter (l
)));
721 assert ("INTEGER2/REAL bad source kind type" == NULL
);
726 case FFEINFO_basictypeCOMPLEX
:
727 switch (ffeinfo_kindtype (ffebld_info (l
)))
729 #if FFETARGET_okCOMPLEX1
730 case FFEINFO_kindtypeREAL1
:
731 error
= ffetarget_convert_integer2_complex1
732 (ffebld_cu_ptr_integer2 (u
),
733 ffebld_constant_complex1 (ffebld_conter (l
)));
737 #if FFETARGET_okCOMPLEX2
738 case FFEINFO_kindtypeREAL2
:
739 error
= ffetarget_convert_integer2_complex2
740 (ffebld_cu_ptr_integer2 (u
),
741 ffebld_constant_complex2 (ffebld_conter (l
)));
745 #if FFETARGET_okCOMPLEX3
746 case FFEINFO_kindtypeREAL3
:
747 error
= ffetarget_convert_integer2_complex3
748 (ffebld_cu_ptr_integer2 (u
),
749 ffebld_constant_complex3 (ffebld_conter (l
)));
753 #if FFETARGET_okCOMPLEX4
754 case FFEINFO_kindtypeREAL4
:
755 error
= ffetarget_convert_integer2_complex4
756 (ffebld_cu_ptr_integer2 (u
),
757 ffebld_constant_complex4 (ffebld_conter (l
)));
762 assert ("INTEGER2/COMPLEX bad source kind type" == NULL
);
767 case FFEINFO_basictypeLOGICAL
:
768 switch (ffeinfo_kindtype (ffebld_info (l
)))
770 #if FFETARGET_okLOGICAL1
771 case FFEINFO_kindtypeLOGICAL1
:
772 error
= ffetarget_convert_integer2_logical1
773 (ffebld_cu_ptr_integer2 (u
),
774 ffebld_constant_logical1 (ffebld_conter (l
)));
778 #if FFETARGET_okLOGICAL2
779 case FFEINFO_kindtypeLOGICAL2
:
780 error
= ffetarget_convert_integer2_logical2
781 (ffebld_cu_ptr_integer2 (u
),
782 ffebld_constant_logical2 (ffebld_conter (l
)));
786 #if FFETARGET_okLOGICAL3
787 case FFEINFO_kindtypeLOGICAL3
:
788 error
= ffetarget_convert_integer2_logical3
789 (ffebld_cu_ptr_integer2 (u
),
790 ffebld_constant_logical3 (ffebld_conter (l
)));
794 #if FFETARGET_okLOGICAL4
795 case FFEINFO_kindtypeLOGICAL4
:
796 error
= ffetarget_convert_integer2_logical4
797 (ffebld_cu_ptr_integer2 (u
),
798 ffebld_constant_logical4 (ffebld_conter (l
)));
803 assert ("INTEGER2/LOGICAL bad source kind type" == NULL
);
808 case FFEINFO_basictypeCHARACTER
:
809 error
= ffetarget_convert_integer2_character1
810 (ffebld_cu_ptr_integer2 (u
),
811 ffebld_constant_character1 (ffebld_conter (l
)));
814 case FFEINFO_basictypeHOLLERITH
:
815 error
= ffetarget_convert_integer2_hollerith
816 (ffebld_cu_ptr_integer2 (u
),
817 ffebld_constant_hollerith (ffebld_conter (l
)));
820 case FFEINFO_basictypeTYPELESS
:
821 error
= ffetarget_convert_integer2_typeless
822 (ffebld_cu_ptr_integer2 (u
),
823 ffebld_constant_typeless (ffebld_conter (l
)));
827 assert ("INTEGER2 bad type" == NULL
);
831 /* If conversion operation is not implemented, return original expr. */
832 if (error
== FFEBAD_NOCANDO
)
835 expr
= ffebld_new_conter_with_orig
836 (ffebld_constant_new_integer2_val
837 (ffebld_cu_val_integer2 (u
)), expr
);
841 #if FFETARGET_okINTEGER3
842 case FFEINFO_kindtypeINTEGER3
:
843 switch (ffeinfo_basictype (ffebld_info (l
)))
845 case FFEINFO_basictypeINTEGER
:
846 switch (ffeinfo_kindtype (ffebld_info (l
)))
848 #if FFETARGET_okINTEGER1
849 case FFEINFO_kindtypeINTEGER1
:
850 error
= ffetarget_convert_integer3_integer1
851 (ffebld_cu_ptr_integer3 (u
),
852 ffebld_constant_integer1 (ffebld_conter (l
)));
856 #if FFETARGET_okINTEGER2
857 case FFEINFO_kindtypeINTEGER2
:
858 error
= ffetarget_convert_integer3_integer2
859 (ffebld_cu_ptr_integer3 (u
),
860 ffebld_constant_integer2 (ffebld_conter (l
)));
864 #if FFETARGET_okINTEGER4
865 case FFEINFO_kindtypeINTEGER4
:
866 error
= ffetarget_convert_integer3_integer4
867 (ffebld_cu_ptr_integer3 (u
),
868 ffebld_constant_integer4 (ffebld_conter (l
)));
873 assert ("INTEGER3/INTEGER bad source kind type" == NULL
);
878 case FFEINFO_basictypeREAL
:
879 switch (ffeinfo_kindtype (ffebld_info (l
)))
881 #if FFETARGET_okREAL1
882 case FFEINFO_kindtypeREAL1
:
883 error
= ffetarget_convert_integer3_real1
884 (ffebld_cu_ptr_integer3 (u
),
885 ffebld_constant_real1 (ffebld_conter (l
)));
889 #if FFETARGET_okREAL2
890 case FFEINFO_kindtypeREAL2
:
891 error
= ffetarget_convert_integer3_real2
892 (ffebld_cu_ptr_integer3 (u
),
893 ffebld_constant_real2 (ffebld_conter (l
)));
897 #if FFETARGET_okREAL3
898 case FFEINFO_kindtypeREAL3
:
899 error
= ffetarget_convert_integer3_real3
900 (ffebld_cu_ptr_integer3 (u
),
901 ffebld_constant_real3 (ffebld_conter (l
)));
905 #if FFETARGET_okREAL4
906 case FFEINFO_kindtypeREAL4
:
907 error
= ffetarget_convert_integer3_real4
908 (ffebld_cu_ptr_integer3 (u
),
909 ffebld_constant_real4 (ffebld_conter (l
)));
914 assert ("INTEGER3/REAL bad source kind type" == NULL
);
919 case FFEINFO_basictypeCOMPLEX
:
920 switch (ffeinfo_kindtype (ffebld_info (l
)))
922 #if FFETARGET_okCOMPLEX1
923 case FFEINFO_kindtypeREAL1
:
924 error
= ffetarget_convert_integer3_complex1
925 (ffebld_cu_ptr_integer3 (u
),
926 ffebld_constant_complex1 (ffebld_conter (l
)));
930 #if FFETARGET_okCOMPLEX2
931 case FFEINFO_kindtypeREAL2
:
932 error
= ffetarget_convert_integer3_complex2
933 (ffebld_cu_ptr_integer3 (u
),
934 ffebld_constant_complex2 (ffebld_conter (l
)));
938 #if FFETARGET_okCOMPLEX3
939 case FFEINFO_kindtypeREAL3
:
940 error
= ffetarget_convert_integer3_complex3
941 (ffebld_cu_ptr_integer3 (u
),
942 ffebld_constant_complex3 (ffebld_conter (l
)));
946 #if FFETARGET_okCOMPLEX4
947 case FFEINFO_kindtypeREAL4
:
948 error
= ffetarget_convert_integer3_complex4
949 (ffebld_cu_ptr_integer3 (u
),
950 ffebld_constant_complex4 (ffebld_conter (l
)));
955 assert ("INTEGER3/COMPLEX bad source kind type" == NULL
);
960 case FFEINFO_basictypeLOGICAL
:
961 switch (ffeinfo_kindtype (ffebld_info (l
)))
963 #if FFETARGET_okLOGICAL1
964 case FFEINFO_kindtypeLOGICAL1
:
965 error
= ffetarget_convert_integer3_logical1
966 (ffebld_cu_ptr_integer3 (u
),
967 ffebld_constant_logical1 (ffebld_conter (l
)));
971 #if FFETARGET_okLOGICAL2
972 case FFEINFO_kindtypeLOGICAL2
:
973 error
= ffetarget_convert_integer3_logical2
974 (ffebld_cu_ptr_integer3 (u
),
975 ffebld_constant_logical2 (ffebld_conter (l
)));
979 #if FFETARGET_okLOGICAL3
980 case FFEINFO_kindtypeLOGICAL3
:
981 error
= ffetarget_convert_integer3_logical3
982 (ffebld_cu_ptr_integer3 (u
),
983 ffebld_constant_logical3 (ffebld_conter (l
)));
987 #if FFETARGET_okLOGICAL4
988 case FFEINFO_kindtypeLOGICAL4
:
989 error
= ffetarget_convert_integer3_logical4
990 (ffebld_cu_ptr_integer3 (u
),
991 ffebld_constant_logical4 (ffebld_conter (l
)));
996 assert ("INTEGER3/LOGICAL bad source kind type" == NULL
);
1001 case FFEINFO_basictypeCHARACTER
:
1002 error
= ffetarget_convert_integer3_character1
1003 (ffebld_cu_ptr_integer3 (u
),
1004 ffebld_constant_character1 (ffebld_conter (l
)));
1007 case FFEINFO_basictypeHOLLERITH
:
1008 error
= ffetarget_convert_integer3_hollerith
1009 (ffebld_cu_ptr_integer3 (u
),
1010 ffebld_constant_hollerith (ffebld_conter (l
)));
1013 case FFEINFO_basictypeTYPELESS
:
1014 error
= ffetarget_convert_integer3_typeless
1015 (ffebld_cu_ptr_integer3 (u
),
1016 ffebld_constant_typeless (ffebld_conter (l
)));
1020 assert ("INTEGER3 bad type" == NULL
);
1024 /* If conversion operation is not implemented, return original expr. */
1025 if (error
== FFEBAD_NOCANDO
)
1028 expr
= ffebld_new_conter_with_orig
1029 (ffebld_constant_new_integer3_val
1030 (ffebld_cu_val_integer3 (u
)), expr
);
1034 #if FFETARGET_okINTEGER4
1035 case FFEINFO_kindtypeINTEGER4
:
1036 switch (ffeinfo_basictype (ffebld_info (l
)))
1038 case FFEINFO_basictypeINTEGER
:
1039 switch (ffeinfo_kindtype (ffebld_info (l
)))
1041 #if FFETARGET_okINTEGER1
1042 case FFEINFO_kindtypeINTEGER1
:
1043 error
= ffetarget_convert_integer4_integer1
1044 (ffebld_cu_ptr_integer4 (u
),
1045 ffebld_constant_integer1 (ffebld_conter (l
)));
1049 #if FFETARGET_okINTEGER2
1050 case FFEINFO_kindtypeINTEGER2
:
1051 error
= ffetarget_convert_integer4_integer2
1052 (ffebld_cu_ptr_integer4 (u
),
1053 ffebld_constant_integer2 (ffebld_conter (l
)));
1057 #if FFETARGET_okINTEGER3
1058 case FFEINFO_kindtypeINTEGER3
:
1059 error
= ffetarget_convert_integer4_integer3
1060 (ffebld_cu_ptr_integer4 (u
),
1061 ffebld_constant_integer3 (ffebld_conter (l
)));
1066 assert ("INTEGER4/INTEGER bad source kind type" == NULL
);
1071 case FFEINFO_basictypeREAL
:
1072 switch (ffeinfo_kindtype (ffebld_info (l
)))
1074 #if FFETARGET_okREAL1
1075 case FFEINFO_kindtypeREAL1
:
1076 error
= ffetarget_convert_integer4_real1
1077 (ffebld_cu_ptr_integer4 (u
),
1078 ffebld_constant_real1 (ffebld_conter (l
)));
1082 #if FFETARGET_okREAL2
1083 case FFEINFO_kindtypeREAL2
:
1084 error
= ffetarget_convert_integer4_real2
1085 (ffebld_cu_ptr_integer4 (u
),
1086 ffebld_constant_real2 (ffebld_conter (l
)));
1090 #if FFETARGET_okREAL3
1091 case FFEINFO_kindtypeREAL3
:
1092 error
= ffetarget_convert_integer4_real3
1093 (ffebld_cu_ptr_integer4 (u
),
1094 ffebld_constant_real3 (ffebld_conter (l
)));
1098 #if FFETARGET_okREAL4
1099 case FFEINFO_kindtypeREAL4
:
1100 error
= ffetarget_convert_integer4_real4
1101 (ffebld_cu_ptr_integer4 (u
),
1102 ffebld_constant_real4 (ffebld_conter (l
)));
1107 assert ("INTEGER4/REAL bad source kind type" == NULL
);
1112 case FFEINFO_basictypeCOMPLEX
:
1113 switch (ffeinfo_kindtype (ffebld_info (l
)))
1115 #if FFETARGET_okCOMPLEX1
1116 case FFEINFO_kindtypeREAL1
:
1117 error
= ffetarget_convert_integer4_complex1
1118 (ffebld_cu_ptr_integer4 (u
),
1119 ffebld_constant_complex1 (ffebld_conter (l
)));
1123 #if FFETARGET_okCOMPLEX2
1124 case FFEINFO_kindtypeREAL2
:
1125 error
= ffetarget_convert_integer4_complex2
1126 (ffebld_cu_ptr_integer4 (u
),
1127 ffebld_constant_complex2 (ffebld_conter (l
)));
1131 #if FFETARGET_okCOMPLEX3
1132 case FFEINFO_kindtypeREAL3
:
1133 error
= ffetarget_convert_integer4_complex3
1134 (ffebld_cu_ptr_integer4 (u
),
1135 ffebld_constant_complex3 (ffebld_conter (l
)));
1139 #if FFETARGET_okCOMPLEX4
1140 case FFEINFO_kindtypeREAL4
:
1141 error
= ffetarget_convert_integer4_complex4
1142 (ffebld_cu_ptr_integer4 (u
),
1143 ffebld_constant_complex4 (ffebld_conter (l
)));
1148 assert ("INTEGER3/COMPLEX bad source kind type" == NULL
);
1153 case FFEINFO_basictypeLOGICAL
:
1154 switch (ffeinfo_kindtype (ffebld_info (l
)))
1156 #if FFETARGET_okLOGICAL1
1157 case FFEINFO_kindtypeLOGICAL1
:
1158 error
= ffetarget_convert_integer4_logical1
1159 (ffebld_cu_ptr_integer4 (u
),
1160 ffebld_constant_logical1 (ffebld_conter (l
)));
1164 #if FFETARGET_okLOGICAL2
1165 case FFEINFO_kindtypeLOGICAL2
:
1166 error
= ffetarget_convert_integer4_logical2
1167 (ffebld_cu_ptr_integer4 (u
),
1168 ffebld_constant_logical2 (ffebld_conter (l
)));
1172 #if FFETARGET_okLOGICAL3
1173 case FFEINFO_kindtypeLOGICAL3
:
1174 error
= ffetarget_convert_integer4_logical3
1175 (ffebld_cu_ptr_integer4 (u
),
1176 ffebld_constant_logical3 (ffebld_conter (l
)));
1180 #if FFETARGET_okLOGICAL4
1181 case FFEINFO_kindtypeLOGICAL4
:
1182 error
= ffetarget_convert_integer4_logical4
1183 (ffebld_cu_ptr_integer4 (u
),
1184 ffebld_constant_logical4 (ffebld_conter (l
)));
1189 assert ("INTEGER4/LOGICAL bad source kind type" == NULL
);
1194 case FFEINFO_basictypeCHARACTER
:
1195 error
= ffetarget_convert_integer4_character1
1196 (ffebld_cu_ptr_integer4 (u
),
1197 ffebld_constant_character1 (ffebld_conter (l
)));
1200 case FFEINFO_basictypeHOLLERITH
:
1201 error
= ffetarget_convert_integer4_hollerith
1202 (ffebld_cu_ptr_integer4 (u
),
1203 ffebld_constant_hollerith (ffebld_conter (l
)));
1206 case FFEINFO_basictypeTYPELESS
:
1207 error
= ffetarget_convert_integer4_typeless
1208 (ffebld_cu_ptr_integer4 (u
),
1209 ffebld_constant_typeless (ffebld_conter (l
)));
1213 assert ("INTEGER4 bad type" == NULL
);
1217 /* If conversion operation is not implemented, return original expr. */
1218 if (error
== FFEBAD_NOCANDO
)
1221 expr
= ffebld_new_conter_with_orig
1222 (ffebld_constant_new_integer4_val
1223 (ffebld_cu_val_integer4 (u
)), expr
);
1228 assert ("bad integer kind type" == NULL
);
1233 case FFEINFO_basictypeLOGICAL
:
1234 sz
= FFETARGET_charactersizeNONE
;
1235 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
1237 #if FFETARGET_okLOGICAL1
1238 case FFEINFO_kindtypeLOGICAL1
:
1239 switch (ffeinfo_basictype (ffebld_info (l
)))
1241 case FFEINFO_basictypeLOGICAL
:
1242 switch (ffeinfo_kindtype (ffebld_info (l
)))
1244 #if FFETARGET_okLOGICAL2
1245 case FFEINFO_kindtypeLOGICAL2
:
1246 error
= ffetarget_convert_logical1_logical2
1247 (ffebld_cu_ptr_logical1 (u
),
1248 ffebld_constant_logical2 (ffebld_conter (l
)));
1252 #if FFETARGET_okLOGICAL3
1253 case FFEINFO_kindtypeLOGICAL3
:
1254 error
= ffetarget_convert_logical1_logical3
1255 (ffebld_cu_ptr_logical1 (u
),
1256 ffebld_constant_logical3 (ffebld_conter (l
)));
1260 #if FFETARGET_okLOGICAL4
1261 case FFEINFO_kindtypeLOGICAL4
:
1262 error
= ffetarget_convert_logical1_logical4
1263 (ffebld_cu_ptr_logical1 (u
),
1264 ffebld_constant_logical4 (ffebld_conter (l
)));
1269 assert ("LOGICAL1/LOGICAL bad source kind type" == NULL
);
1274 case FFEINFO_basictypeINTEGER
:
1275 switch (ffeinfo_kindtype (ffebld_info (l
)))
1277 #if FFETARGET_okINTEGER1
1278 case FFEINFO_kindtypeINTEGER1
:
1279 error
= ffetarget_convert_logical1_integer1
1280 (ffebld_cu_ptr_logical1 (u
),
1281 ffebld_constant_integer1 (ffebld_conter (l
)));
1285 #if FFETARGET_okINTEGER2
1286 case FFEINFO_kindtypeINTEGER2
:
1287 error
= ffetarget_convert_logical1_integer2
1288 (ffebld_cu_ptr_logical1 (u
),
1289 ffebld_constant_integer2 (ffebld_conter (l
)));
1293 #if FFETARGET_okINTEGER3
1294 case FFEINFO_kindtypeINTEGER3
:
1295 error
= ffetarget_convert_logical1_integer3
1296 (ffebld_cu_ptr_logical1 (u
),
1297 ffebld_constant_integer3 (ffebld_conter (l
)));
1301 #if FFETARGET_okINTEGER4
1302 case FFEINFO_kindtypeINTEGER4
:
1303 error
= ffetarget_convert_logical1_integer4
1304 (ffebld_cu_ptr_logical1 (u
),
1305 ffebld_constant_integer4 (ffebld_conter (l
)));
1310 assert ("LOGICAL1/INTEGER bad source kind type" == NULL
);
1315 case FFEINFO_basictypeCHARACTER
:
1316 error
= ffetarget_convert_logical1_character1
1317 (ffebld_cu_ptr_logical1 (u
),
1318 ffebld_constant_character1 (ffebld_conter (l
)));
1321 case FFEINFO_basictypeHOLLERITH
:
1322 error
= ffetarget_convert_logical1_hollerith
1323 (ffebld_cu_ptr_logical1 (u
),
1324 ffebld_constant_hollerith (ffebld_conter (l
)));
1327 case FFEINFO_basictypeTYPELESS
:
1328 error
= ffetarget_convert_logical1_typeless
1329 (ffebld_cu_ptr_logical1 (u
),
1330 ffebld_constant_typeless (ffebld_conter (l
)));
1334 assert ("LOGICAL1 bad type" == NULL
);
1338 /* If conversion operation is not implemented, return original expr. */
1339 if (error
== FFEBAD_NOCANDO
)
1342 expr
= ffebld_new_conter_with_orig
1343 (ffebld_constant_new_logical1_val
1344 (ffebld_cu_val_logical1 (u
)), expr
);
1348 #if FFETARGET_okLOGICAL2
1349 case FFEINFO_kindtypeLOGICAL2
:
1350 switch (ffeinfo_basictype (ffebld_info (l
)))
1352 case FFEINFO_basictypeLOGICAL
:
1353 switch (ffeinfo_kindtype (ffebld_info (l
)))
1355 #if FFETARGET_okLOGICAL1
1356 case FFEINFO_kindtypeLOGICAL1
:
1357 error
= ffetarget_convert_logical2_logical1
1358 (ffebld_cu_ptr_logical2 (u
),
1359 ffebld_constant_logical1 (ffebld_conter (l
)));
1363 #if FFETARGET_okLOGICAL3
1364 case FFEINFO_kindtypeLOGICAL3
:
1365 error
= ffetarget_convert_logical2_logical3
1366 (ffebld_cu_ptr_logical2 (u
),
1367 ffebld_constant_logical3 (ffebld_conter (l
)));
1371 #if FFETARGET_okLOGICAL4
1372 case FFEINFO_kindtypeLOGICAL4
:
1373 error
= ffetarget_convert_logical2_logical4
1374 (ffebld_cu_ptr_logical2 (u
),
1375 ffebld_constant_logical4 (ffebld_conter (l
)));
1380 assert ("LOGICAL2/LOGICAL bad source kind type" == NULL
);
1385 case FFEINFO_basictypeINTEGER
:
1386 switch (ffeinfo_kindtype (ffebld_info (l
)))
1388 #if FFETARGET_okINTEGER1
1389 case FFEINFO_kindtypeINTEGER1
:
1390 error
= ffetarget_convert_logical2_integer1
1391 (ffebld_cu_ptr_logical2 (u
),
1392 ffebld_constant_integer1 (ffebld_conter (l
)));
1396 #if FFETARGET_okINTEGER2
1397 case FFEINFO_kindtypeINTEGER2
:
1398 error
= ffetarget_convert_logical2_integer2
1399 (ffebld_cu_ptr_logical2 (u
),
1400 ffebld_constant_integer2 (ffebld_conter (l
)));
1404 #if FFETARGET_okINTEGER3
1405 case FFEINFO_kindtypeINTEGER3
:
1406 error
= ffetarget_convert_logical2_integer3
1407 (ffebld_cu_ptr_logical2 (u
),
1408 ffebld_constant_integer3 (ffebld_conter (l
)));
1412 #if FFETARGET_okINTEGER4
1413 case FFEINFO_kindtypeINTEGER4
:
1414 error
= ffetarget_convert_logical2_integer4
1415 (ffebld_cu_ptr_logical2 (u
),
1416 ffebld_constant_integer4 (ffebld_conter (l
)));
1421 assert ("LOGICAL2/INTEGER bad source kind type" == NULL
);
1426 case FFEINFO_basictypeCHARACTER
:
1427 error
= ffetarget_convert_logical2_character1
1428 (ffebld_cu_ptr_logical2 (u
),
1429 ffebld_constant_character1 (ffebld_conter (l
)));
1432 case FFEINFO_basictypeHOLLERITH
:
1433 error
= ffetarget_convert_logical2_hollerith
1434 (ffebld_cu_ptr_logical2 (u
),
1435 ffebld_constant_hollerith (ffebld_conter (l
)));
1438 case FFEINFO_basictypeTYPELESS
:
1439 error
= ffetarget_convert_logical2_typeless
1440 (ffebld_cu_ptr_logical2 (u
),
1441 ffebld_constant_typeless (ffebld_conter (l
)));
1445 assert ("LOGICAL2 bad type" == NULL
);
1449 /* If conversion operation is not implemented, return original expr. */
1450 if (error
== FFEBAD_NOCANDO
)
1453 expr
= ffebld_new_conter_with_orig
1454 (ffebld_constant_new_logical2_val
1455 (ffebld_cu_val_logical2 (u
)), expr
);
1459 #if FFETARGET_okLOGICAL3
1460 case FFEINFO_kindtypeLOGICAL3
:
1461 switch (ffeinfo_basictype (ffebld_info (l
)))
1463 case FFEINFO_basictypeLOGICAL
:
1464 switch (ffeinfo_kindtype (ffebld_info (l
)))
1466 #if FFETARGET_okLOGICAL1
1467 case FFEINFO_kindtypeLOGICAL1
:
1468 error
= ffetarget_convert_logical3_logical1
1469 (ffebld_cu_ptr_logical3 (u
),
1470 ffebld_constant_logical1 (ffebld_conter (l
)));
1474 #if FFETARGET_okLOGICAL2
1475 case FFEINFO_kindtypeLOGICAL2
:
1476 error
= ffetarget_convert_logical3_logical2
1477 (ffebld_cu_ptr_logical3 (u
),
1478 ffebld_constant_logical2 (ffebld_conter (l
)));
1482 #if FFETARGET_okLOGICAL4
1483 case FFEINFO_kindtypeLOGICAL4
:
1484 error
= ffetarget_convert_logical3_logical4
1485 (ffebld_cu_ptr_logical3 (u
),
1486 ffebld_constant_logical4 (ffebld_conter (l
)));
1491 assert ("LOGICAL3/LOGICAL bad source kind type" == NULL
);
1496 case FFEINFO_basictypeINTEGER
:
1497 switch (ffeinfo_kindtype (ffebld_info (l
)))
1499 #if FFETARGET_okINTEGER1
1500 case FFEINFO_kindtypeINTEGER1
:
1501 error
= ffetarget_convert_logical3_integer1
1502 (ffebld_cu_ptr_logical3 (u
),
1503 ffebld_constant_integer1 (ffebld_conter (l
)));
1507 #if FFETARGET_okINTEGER2
1508 case FFEINFO_kindtypeINTEGER2
:
1509 error
= ffetarget_convert_logical3_integer2
1510 (ffebld_cu_ptr_logical3 (u
),
1511 ffebld_constant_integer2 (ffebld_conter (l
)));
1515 #if FFETARGET_okINTEGER3
1516 case FFEINFO_kindtypeINTEGER3
:
1517 error
= ffetarget_convert_logical3_integer3
1518 (ffebld_cu_ptr_logical3 (u
),
1519 ffebld_constant_integer3 (ffebld_conter (l
)));
1523 #if FFETARGET_okINTEGER4
1524 case FFEINFO_kindtypeINTEGER4
:
1525 error
= ffetarget_convert_logical3_integer4
1526 (ffebld_cu_ptr_logical3 (u
),
1527 ffebld_constant_integer4 (ffebld_conter (l
)));
1532 assert ("LOGICAL3/INTEGER bad source kind type" == NULL
);
1537 case FFEINFO_basictypeCHARACTER
:
1538 error
= ffetarget_convert_logical3_character1
1539 (ffebld_cu_ptr_logical3 (u
),
1540 ffebld_constant_character1 (ffebld_conter (l
)));
1543 case FFEINFO_basictypeHOLLERITH
:
1544 error
= ffetarget_convert_logical3_hollerith
1545 (ffebld_cu_ptr_logical3 (u
),
1546 ffebld_constant_hollerith (ffebld_conter (l
)));
1549 case FFEINFO_basictypeTYPELESS
:
1550 error
= ffetarget_convert_logical3_typeless
1551 (ffebld_cu_ptr_logical3 (u
),
1552 ffebld_constant_typeless (ffebld_conter (l
)));
1556 assert ("LOGICAL3 bad type" == NULL
);
1560 /* If conversion operation is not implemented, return original expr. */
1561 if (error
== FFEBAD_NOCANDO
)
1564 expr
= ffebld_new_conter_with_orig
1565 (ffebld_constant_new_logical3_val
1566 (ffebld_cu_val_logical3 (u
)), expr
);
1570 #if FFETARGET_okLOGICAL4
1571 case FFEINFO_kindtypeLOGICAL4
:
1572 switch (ffeinfo_basictype (ffebld_info (l
)))
1574 case FFEINFO_basictypeLOGICAL
:
1575 switch (ffeinfo_kindtype (ffebld_info (l
)))
1577 #if FFETARGET_okLOGICAL1
1578 case FFEINFO_kindtypeLOGICAL1
:
1579 error
= ffetarget_convert_logical4_logical1
1580 (ffebld_cu_ptr_logical4 (u
),
1581 ffebld_constant_logical1 (ffebld_conter (l
)));
1585 #if FFETARGET_okLOGICAL2
1586 case FFEINFO_kindtypeLOGICAL2
:
1587 error
= ffetarget_convert_logical4_logical2
1588 (ffebld_cu_ptr_logical4 (u
),
1589 ffebld_constant_logical2 (ffebld_conter (l
)));
1593 #if FFETARGET_okLOGICAL3
1594 case FFEINFO_kindtypeLOGICAL3
:
1595 error
= ffetarget_convert_logical4_logical3
1596 (ffebld_cu_ptr_logical4 (u
),
1597 ffebld_constant_logical3 (ffebld_conter (l
)));
1602 assert ("LOGICAL4/LOGICAL bad source kind type" == NULL
);
1607 case FFEINFO_basictypeINTEGER
:
1608 switch (ffeinfo_kindtype (ffebld_info (l
)))
1610 #if FFETARGET_okINTEGER1
1611 case FFEINFO_kindtypeINTEGER1
:
1612 error
= ffetarget_convert_logical4_integer1
1613 (ffebld_cu_ptr_logical4 (u
),
1614 ffebld_constant_integer1 (ffebld_conter (l
)));
1618 #if FFETARGET_okINTEGER2
1619 case FFEINFO_kindtypeINTEGER2
:
1620 error
= ffetarget_convert_logical4_integer2
1621 (ffebld_cu_ptr_logical4 (u
),
1622 ffebld_constant_integer2 (ffebld_conter (l
)));
1626 #if FFETARGET_okINTEGER3
1627 case FFEINFO_kindtypeINTEGER3
:
1628 error
= ffetarget_convert_logical4_integer3
1629 (ffebld_cu_ptr_logical4 (u
),
1630 ffebld_constant_integer3 (ffebld_conter (l
)));
1634 #if FFETARGET_okINTEGER4
1635 case FFEINFO_kindtypeINTEGER4
:
1636 error
= ffetarget_convert_logical4_integer4
1637 (ffebld_cu_ptr_logical4 (u
),
1638 ffebld_constant_integer4 (ffebld_conter (l
)));
1643 assert ("LOGICAL4/INTEGER bad source kind type" == NULL
);
1648 case FFEINFO_basictypeCHARACTER
:
1649 error
= ffetarget_convert_logical4_character1
1650 (ffebld_cu_ptr_logical4 (u
),
1651 ffebld_constant_character1 (ffebld_conter (l
)));
1654 case FFEINFO_basictypeHOLLERITH
:
1655 error
= ffetarget_convert_logical4_hollerith
1656 (ffebld_cu_ptr_logical4 (u
),
1657 ffebld_constant_hollerith (ffebld_conter (l
)));
1660 case FFEINFO_basictypeTYPELESS
:
1661 error
= ffetarget_convert_logical4_typeless
1662 (ffebld_cu_ptr_logical4 (u
),
1663 ffebld_constant_typeless (ffebld_conter (l
)));
1667 assert ("LOGICAL4 bad type" == NULL
);
1671 /* If conversion operation is not implemented, return original expr. */
1672 if (error
== FFEBAD_NOCANDO
)
1675 expr
= ffebld_new_conter_with_orig
1676 (ffebld_constant_new_logical4_val
1677 (ffebld_cu_val_logical4 (u
)), expr
);
1682 assert ("bad logical kind type" == NULL
);
1687 case FFEINFO_basictypeREAL
:
1688 sz
= FFETARGET_charactersizeNONE
;
1689 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
1691 #if FFETARGET_okREAL1
1692 case FFEINFO_kindtypeREAL1
:
1693 switch (ffeinfo_basictype (ffebld_info (l
)))
1695 case FFEINFO_basictypeINTEGER
:
1696 switch (ffeinfo_kindtype (ffebld_info (l
)))
1698 #if FFETARGET_okINTEGER1
1699 case FFEINFO_kindtypeINTEGER1
:
1700 error
= ffetarget_convert_real1_integer1
1701 (ffebld_cu_ptr_real1 (u
),
1702 ffebld_constant_integer1 (ffebld_conter (l
)));
1706 #if FFETARGET_okINTEGER2
1707 case FFEINFO_kindtypeINTEGER2
:
1708 error
= ffetarget_convert_real1_integer2
1709 (ffebld_cu_ptr_real1 (u
),
1710 ffebld_constant_integer2 (ffebld_conter (l
)));
1714 #if FFETARGET_okINTEGER3
1715 case FFEINFO_kindtypeINTEGER3
:
1716 error
= ffetarget_convert_real1_integer3
1717 (ffebld_cu_ptr_real1 (u
),
1718 ffebld_constant_integer3 (ffebld_conter (l
)));
1722 #if FFETARGET_okINTEGER4
1723 case FFEINFO_kindtypeINTEGER4
:
1724 error
= ffetarget_convert_real1_integer4
1725 (ffebld_cu_ptr_real1 (u
),
1726 ffebld_constant_integer4 (ffebld_conter (l
)));
1731 assert ("REAL1/INTEGER bad source kind type" == NULL
);
1736 case FFEINFO_basictypeREAL
:
1737 switch (ffeinfo_kindtype (ffebld_info (l
)))
1739 #if FFETARGET_okREAL2
1740 case FFEINFO_kindtypeREAL2
:
1741 error
= ffetarget_convert_real1_real2
1742 (ffebld_cu_ptr_real1 (u
),
1743 ffebld_constant_real2 (ffebld_conter (l
)));
1747 #if FFETARGET_okREAL3
1748 case FFEINFO_kindtypeREAL3
:
1749 error
= ffetarget_convert_real1_real3
1750 (ffebld_cu_ptr_real1 (u
),
1751 ffebld_constant_real3 (ffebld_conter (l
)));
1755 #if FFETARGET_okREAL4
1756 case FFEINFO_kindtypeREAL4
:
1757 error
= ffetarget_convert_real1_real4
1758 (ffebld_cu_ptr_real1 (u
),
1759 ffebld_constant_real4 (ffebld_conter (l
)));
1764 assert ("REAL1/REAL bad source kind type" == NULL
);
1769 case FFEINFO_basictypeCOMPLEX
:
1770 switch (ffeinfo_kindtype (ffebld_info (l
)))
1772 #if FFETARGET_okCOMPLEX1
1773 case FFEINFO_kindtypeREAL1
:
1774 error
= ffetarget_convert_real1_complex1
1775 (ffebld_cu_ptr_real1 (u
),
1776 ffebld_constant_complex1 (ffebld_conter (l
)));
1780 #if FFETARGET_okCOMPLEX2
1781 case FFEINFO_kindtypeREAL2
:
1782 error
= ffetarget_convert_real1_complex2
1783 (ffebld_cu_ptr_real1 (u
),
1784 ffebld_constant_complex2 (ffebld_conter (l
)));
1788 #if FFETARGET_okCOMPLEX3
1789 case FFEINFO_kindtypeREAL3
:
1790 error
= ffetarget_convert_real1_complex3
1791 (ffebld_cu_ptr_real1 (u
),
1792 ffebld_constant_complex3 (ffebld_conter (l
)));
1796 #if FFETARGET_okCOMPLEX4
1797 case FFEINFO_kindtypeREAL4
:
1798 error
= ffetarget_convert_real1_complex4
1799 (ffebld_cu_ptr_real1 (u
),
1800 ffebld_constant_complex4 (ffebld_conter (l
)));
1805 assert ("REAL1/COMPLEX bad source kind type" == NULL
);
1810 case FFEINFO_basictypeCHARACTER
:
1811 error
= ffetarget_convert_real1_character1
1812 (ffebld_cu_ptr_real1 (u
),
1813 ffebld_constant_character1 (ffebld_conter (l
)));
1816 case FFEINFO_basictypeHOLLERITH
:
1817 error
= ffetarget_convert_real1_hollerith
1818 (ffebld_cu_ptr_real1 (u
),
1819 ffebld_constant_hollerith (ffebld_conter (l
)));
1822 case FFEINFO_basictypeTYPELESS
:
1823 error
= ffetarget_convert_real1_typeless
1824 (ffebld_cu_ptr_real1 (u
),
1825 ffebld_constant_typeless (ffebld_conter (l
)));
1829 assert ("REAL1 bad type" == NULL
);
1833 /* If conversion operation is not implemented, return original expr. */
1834 if (error
== FFEBAD_NOCANDO
)
1837 expr
= ffebld_new_conter_with_orig
1838 (ffebld_constant_new_real1_val
1839 (ffebld_cu_val_real1 (u
)), expr
);
1843 #if FFETARGET_okREAL2
1844 case FFEINFO_kindtypeREAL2
:
1845 switch (ffeinfo_basictype (ffebld_info (l
)))
1847 case FFEINFO_basictypeINTEGER
:
1848 switch (ffeinfo_kindtype (ffebld_info (l
)))
1850 #if FFETARGET_okINTEGER1
1851 case FFEINFO_kindtypeINTEGER1
:
1852 error
= ffetarget_convert_real2_integer1
1853 (ffebld_cu_ptr_real2 (u
),
1854 ffebld_constant_integer1 (ffebld_conter (l
)));
1858 #if FFETARGET_okINTEGER2
1859 case FFEINFO_kindtypeINTEGER2
:
1860 error
= ffetarget_convert_real2_integer2
1861 (ffebld_cu_ptr_real2 (u
),
1862 ffebld_constant_integer2 (ffebld_conter (l
)));
1866 #if FFETARGET_okINTEGER3
1867 case FFEINFO_kindtypeINTEGER3
:
1868 error
= ffetarget_convert_real2_integer3
1869 (ffebld_cu_ptr_real2 (u
),
1870 ffebld_constant_integer3 (ffebld_conter (l
)));
1874 #if FFETARGET_okINTEGER4
1875 case FFEINFO_kindtypeINTEGER4
:
1876 error
= ffetarget_convert_real2_integer4
1877 (ffebld_cu_ptr_real2 (u
),
1878 ffebld_constant_integer4 (ffebld_conter (l
)));
1883 assert ("REAL2/INTEGER bad source kind type" == NULL
);
1888 case FFEINFO_basictypeREAL
:
1889 switch (ffeinfo_kindtype (ffebld_info (l
)))
1891 #if FFETARGET_okREAL1
1892 case FFEINFO_kindtypeREAL1
:
1893 error
= ffetarget_convert_real2_real1
1894 (ffebld_cu_ptr_real2 (u
),
1895 ffebld_constant_real1 (ffebld_conter (l
)));
1899 #if FFETARGET_okREAL3
1900 case FFEINFO_kindtypeREAL3
:
1901 error
= ffetarget_convert_real2_real3
1902 (ffebld_cu_ptr_real2 (u
),
1903 ffebld_constant_real3 (ffebld_conter (l
)));
1907 #if FFETARGET_okREAL4
1908 case FFEINFO_kindtypeREAL4
:
1909 error
= ffetarget_convert_real2_real4
1910 (ffebld_cu_ptr_real2 (u
),
1911 ffebld_constant_real4 (ffebld_conter (l
)));
1916 assert ("REAL2/REAL bad source kind type" == NULL
);
1921 case FFEINFO_basictypeCOMPLEX
:
1922 switch (ffeinfo_kindtype (ffebld_info (l
)))
1924 #if FFETARGET_okCOMPLEX1
1925 case FFEINFO_kindtypeREAL1
:
1926 error
= ffetarget_convert_real2_complex1
1927 (ffebld_cu_ptr_real2 (u
),
1928 ffebld_constant_complex1 (ffebld_conter (l
)));
1932 #if FFETARGET_okCOMPLEX2
1933 case FFEINFO_kindtypeREAL2
:
1934 error
= ffetarget_convert_real2_complex2
1935 (ffebld_cu_ptr_real2 (u
),
1936 ffebld_constant_complex2 (ffebld_conter (l
)));
1940 #if FFETARGET_okCOMPLEX3
1941 case FFEINFO_kindtypeREAL3
:
1942 error
= ffetarget_convert_real2_complex3
1943 (ffebld_cu_ptr_real2 (u
),
1944 ffebld_constant_complex3 (ffebld_conter (l
)));
1948 #if FFETARGET_okCOMPLEX4
1949 case FFEINFO_kindtypeREAL4
:
1950 error
= ffetarget_convert_real2_complex4
1951 (ffebld_cu_ptr_real2 (u
),
1952 ffebld_constant_complex4 (ffebld_conter (l
)));
1957 assert ("REAL2/COMPLEX bad source kind type" == NULL
);
1962 case FFEINFO_basictypeCHARACTER
:
1963 error
= ffetarget_convert_real2_character1
1964 (ffebld_cu_ptr_real2 (u
),
1965 ffebld_constant_character1 (ffebld_conter (l
)));
1968 case FFEINFO_basictypeHOLLERITH
:
1969 error
= ffetarget_convert_real2_hollerith
1970 (ffebld_cu_ptr_real2 (u
),
1971 ffebld_constant_hollerith (ffebld_conter (l
)));
1974 case FFEINFO_basictypeTYPELESS
:
1975 error
= ffetarget_convert_real2_typeless
1976 (ffebld_cu_ptr_real2 (u
),
1977 ffebld_constant_typeless (ffebld_conter (l
)));
1981 assert ("REAL2 bad type" == NULL
);
1985 /* If conversion operation is not implemented, return original expr. */
1986 if (error
== FFEBAD_NOCANDO
)
1989 expr
= ffebld_new_conter_with_orig
1990 (ffebld_constant_new_real2_val
1991 (ffebld_cu_val_real2 (u
)), expr
);
1995 #if FFETARGET_okREAL3
1996 case FFEINFO_kindtypeREAL3
:
1997 switch (ffeinfo_basictype (ffebld_info (l
)))
1999 case FFEINFO_basictypeINTEGER
:
2000 switch (ffeinfo_kindtype (ffebld_info (l
)))
2002 #if FFETARGET_okINTEGER1
2003 case FFEINFO_kindtypeINTEGER1
:
2004 error
= ffetarget_convert_real3_integer1
2005 (ffebld_cu_ptr_real3 (u
),
2006 ffebld_constant_integer1 (ffebld_conter (l
)));
2010 #if FFETARGET_okINTEGER2
2011 case FFEINFO_kindtypeINTEGER2
:
2012 error
= ffetarget_convert_real3_integer2
2013 (ffebld_cu_ptr_real3 (u
),
2014 ffebld_constant_integer2 (ffebld_conter (l
)));
2018 #if FFETARGET_okINTEGER3
2019 case FFEINFO_kindtypeINTEGER3
:
2020 error
= ffetarget_convert_real3_integer3
2021 (ffebld_cu_ptr_real3 (u
),
2022 ffebld_constant_integer3 (ffebld_conter (l
)));
2026 #if FFETARGET_okINTEGER4
2027 case FFEINFO_kindtypeINTEGER4
:
2028 error
= ffetarget_convert_real3_integer4
2029 (ffebld_cu_ptr_real3 (u
),
2030 ffebld_constant_integer4 (ffebld_conter (l
)));
2035 assert ("REAL3/INTEGER bad source kind type" == NULL
);
2040 case FFEINFO_basictypeREAL
:
2041 switch (ffeinfo_kindtype (ffebld_info (l
)))
2043 #if FFETARGET_okREAL1
2044 case FFEINFO_kindtypeREAL1
:
2045 error
= ffetarget_convert_real3_real1
2046 (ffebld_cu_ptr_real3 (u
),
2047 ffebld_constant_real1 (ffebld_conter (l
)));
2051 #if FFETARGET_okREAL2
2052 case FFEINFO_kindtypeREAL2
:
2053 error
= ffetarget_convert_real3_real2
2054 (ffebld_cu_ptr_real3 (u
),
2055 ffebld_constant_real2 (ffebld_conter (l
)));
2059 #if FFETARGET_okREAL4
2060 case FFEINFO_kindtypeREAL4
:
2061 error
= ffetarget_convert_real3_real4
2062 (ffebld_cu_ptr_real3 (u
),
2063 ffebld_constant_real4 (ffebld_conter (l
)));
2068 assert ("REAL3/REAL bad source kind type" == NULL
);
2073 case FFEINFO_basictypeCOMPLEX
:
2074 switch (ffeinfo_kindtype (ffebld_info (l
)))
2076 #if FFETARGET_okCOMPLEX1
2077 case FFEINFO_kindtypeREAL1
:
2078 error
= ffetarget_convert_real3_complex1
2079 (ffebld_cu_ptr_real3 (u
),
2080 ffebld_constant_complex1 (ffebld_conter (l
)));
2084 #if FFETARGET_okCOMPLEX2
2085 case FFEINFO_kindtypeREAL2
:
2086 error
= ffetarget_convert_real3_complex2
2087 (ffebld_cu_ptr_real3 (u
),
2088 ffebld_constant_complex2 (ffebld_conter (l
)));
2092 #if FFETARGET_okCOMPLEX3
2093 case FFEINFO_kindtypeREAL3
:
2094 error
= ffetarget_convert_real3_complex3
2095 (ffebld_cu_ptr_real3 (u
),
2096 ffebld_constant_complex3 (ffebld_conter (l
)));
2100 #if FFETARGET_okCOMPLEX4
2101 case FFEINFO_kindtypeREAL4
:
2102 error
= ffetarget_convert_real3_complex4
2103 (ffebld_cu_ptr_real3 (u
),
2104 ffebld_constant_complex4 (ffebld_conter (l
)));
2109 assert ("REAL3/COMPLEX bad source kind type" == NULL
);
2114 case FFEINFO_basictypeCHARACTER
:
2115 error
= ffetarget_convert_real3_character1
2116 (ffebld_cu_ptr_real3 (u
),
2117 ffebld_constant_character1 (ffebld_conter (l
)));
2120 case FFEINFO_basictypeHOLLERITH
:
2121 error
= ffetarget_convert_real3_hollerith
2122 (ffebld_cu_ptr_real3 (u
),
2123 ffebld_constant_hollerith (ffebld_conter (l
)));
2126 case FFEINFO_basictypeTYPELESS
:
2127 error
= ffetarget_convert_real3_typeless
2128 (ffebld_cu_ptr_real3 (u
),
2129 ffebld_constant_typeless (ffebld_conter (l
)));
2133 assert ("REAL3 bad type" == NULL
);
2137 /* If conversion operation is not implemented, return original expr. */
2138 if (error
== FFEBAD_NOCANDO
)
2141 expr
= ffebld_new_conter_with_orig
2142 (ffebld_constant_new_real3_val
2143 (ffebld_cu_val_real3 (u
)), expr
);
2147 #if FFETARGET_okREAL4
2148 case FFEINFO_kindtypeREAL4
:
2149 switch (ffeinfo_basictype (ffebld_info (l
)))
2151 case FFEINFO_basictypeINTEGER
:
2152 switch (ffeinfo_kindtype (ffebld_info (l
)))
2154 #if FFETARGET_okINTEGER1
2155 case FFEINFO_kindtypeINTEGER1
:
2156 error
= ffetarget_convert_real4_integer1
2157 (ffebld_cu_ptr_real4 (u
),
2158 ffebld_constant_integer1 (ffebld_conter (l
)));
2162 #if FFETARGET_okINTEGER2
2163 case FFEINFO_kindtypeINTEGER2
:
2164 error
= ffetarget_convert_real4_integer2
2165 (ffebld_cu_ptr_real4 (u
),
2166 ffebld_constant_integer2 (ffebld_conter (l
)));
2170 #if FFETARGET_okINTEGER3
2171 case FFEINFO_kindtypeINTEGER3
:
2172 error
= ffetarget_convert_real4_integer3
2173 (ffebld_cu_ptr_real4 (u
),
2174 ffebld_constant_integer3 (ffebld_conter (l
)));
2178 #if FFETARGET_okINTEGER4
2179 case FFEINFO_kindtypeINTEGER4
:
2180 error
= ffetarget_convert_real4_integer4
2181 (ffebld_cu_ptr_real4 (u
),
2182 ffebld_constant_integer4 (ffebld_conter (l
)));
2187 assert ("REAL4/INTEGER bad source kind type" == NULL
);
2192 case FFEINFO_basictypeREAL
:
2193 switch (ffeinfo_kindtype (ffebld_info (l
)))
2195 #if FFETARGET_okREAL1
2196 case FFEINFO_kindtypeREAL1
:
2197 error
= ffetarget_convert_real4_real1
2198 (ffebld_cu_ptr_real4 (u
),
2199 ffebld_constant_real1 (ffebld_conter (l
)));
2203 #if FFETARGET_okREAL2
2204 case FFEINFO_kindtypeREAL2
:
2205 error
= ffetarget_convert_real4_real2
2206 (ffebld_cu_ptr_real4 (u
),
2207 ffebld_constant_real2 (ffebld_conter (l
)));
2211 #if FFETARGET_okREAL3
2212 case FFEINFO_kindtypeREAL3
:
2213 error
= ffetarget_convert_real4_real3
2214 (ffebld_cu_ptr_real4 (u
),
2215 ffebld_constant_real3 (ffebld_conter (l
)));
2220 assert ("REAL4/REAL bad source kind type" == NULL
);
2225 case FFEINFO_basictypeCOMPLEX
:
2226 switch (ffeinfo_kindtype (ffebld_info (l
)))
2228 #if FFETARGET_okCOMPLEX1
2229 case FFEINFO_kindtypeREAL1
:
2230 error
= ffetarget_convert_real4_complex1
2231 (ffebld_cu_ptr_real4 (u
),
2232 ffebld_constant_complex1 (ffebld_conter (l
)));
2236 #if FFETARGET_okCOMPLEX2
2237 case FFEINFO_kindtypeREAL2
:
2238 error
= ffetarget_convert_real4_complex2
2239 (ffebld_cu_ptr_real4 (u
),
2240 ffebld_constant_complex2 (ffebld_conter (l
)));
2244 #if FFETARGET_okCOMPLEX3
2245 case FFEINFO_kindtypeREAL3
:
2246 error
= ffetarget_convert_real4_complex3
2247 (ffebld_cu_ptr_real4 (u
),
2248 ffebld_constant_complex3 (ffebld_conter (l
)));
2252 #if FFETARGET_okCOMPLEX4
2253 case FFEINFO_kindtypeREAL4
:
2254 error
= ffetarget_convert_real4_complex4
2255 (ffebld_cu_ptr_real4 (u
),
2256 ffebld_constant_complex4 (ffebld_conter (l
)));
2261 assert ("REAL4/COMPLEX bad source kind type" == NULL
);
2266 case FFEINFO_basictypeCHARACTER
:
2267 error
= ffetarget_convert_real4_character1
2268 (ffebld_cu_ptr_real4 (u
),
2269 ffebld_constant_character1 (ffebld_conter (l
)));
2272 case FFEINFO_basictypeHOLLERITH
:
2273 error
= ffetarget_convert_real4_hollerith
2274 (ffebld_cu_ptr_real4 (u
),
2275 ffebld_constant_hollerith (ffebld_conter (l
)));
2278 case FFEINFO_basictypeTYPELESS
:
2279 error
= ffetarget_convert_real4_typeless
2280 (ffebld_cu_ptr_real4 (u
),
2281 ffebld_constant_typeless (ffebld_conter (l
)));
2285 assert ("REAL4 bad type" == NULL
);
2289 /* If conversion operation is not implemented, return original expr. */
2290 if (error
== FFEBAD_NOCANDO
)
2293 expr
= ffebld_new_conter_with_orig
2294 (ffebld_constant_new_real4_val
2295 (ffebld_cu_val_real4 (u
)), expr
);
2300 assert ("bad real kind type" == NULL
);
2305 case FFEINFO_basictypeCOMPLEX
:
2306 sz
= FFETARGET_charactersizeNONE
;
2307 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
2309 #if FFETARGET_okCOMPLEX1
2310 case FFEINFO_kindtypeREAL1
:
2311 switch (ffeinfo_basictype (ffebld_info (l
)))
2313 case FFEINFO_basictypeINTEGER
:
2314 switch (ffeinfo_kindtype (ffebld_info (l
)))
2316 #if FFETARGET_okINTEGER1
2317 case FFEINFO_kindtypeINTEGER1
:
2318 error
= ffetarget_convert_complex1_integer1
2319 (ffebld_cu_ptr_complex1 (u
),
2320 ffebld_constant_integer1 (ffebld_conter (l
)));
2324 #if FFETARGET_okINTEGER2
2325 case FFEINFO_kindtypeINTEGER2
:
2326 error
= ffetarget_convert_complex1_integer2
2327 (ffebld_cu_ptr_complex1 (u
),
2328 ffebld_constant_integer2 (ffebld_conter (l
)));
2332 #if FFETARGET_okINTEGER3
2333 case FFEINFO_kindtypeINTEGER3
:
2334 error
= ffetarget_convert_complex1_integer3
2335 (ffebld_cu_ptr_complex1 (u
),
2336 ffebld_constant_integer3 (ffebld_conter (l
)));
2340 #if FFETARGET_okINTEGER4
2341 case FFEINFO_kindtypeINTEGER4
:
2342 error
= ffetarget_convert_complex1_integer4
2343 (ffebld_cu_ptr_complex1 (u
),
2344 ffebld_constant_integer4 (ffebld_conter (l
)));
2349 assert ("COMPLEX1/INTEGER bad source kind type" == NULL
);
2354 case FFEINFO_basictypeREAL
:
2355 switch (ffeinfo_kindtype (ffebld_info (l
)))
2357 #if FFETARGET_okREAL1
2358 case FFEINFO_kindtypeREAL1
:
2359 error
= ffetarget_convert_complex1_real1
2360 (ffebld_cu_ptr_complex1 (u
),
2361 ffebld_constant_real1 (ffebld_conter (l
)));
2365 #if FFETARGET_okREAL2
2366 case FFEINFO_kindtypeREAL2
:
2367 error
= ffetarget_convert_complex1_real2
2368 (ffebld_cu_ptr_complex1 (u
),
2369 ffebld_constant_real2 (ffebld_conter (l
)));
2373 #if FFETARGET_okREAL3
2374 case FFEINFO_kindtypeREAL3
:
2375 error
= ffetarget_convert_complex1_real3
2376 (ffebld_cu_ptr_complex1 (u
),
2377 ffebld_constant_real3 (ffebld_conter (l
)));
2381 #if FFETARGET_okREAL4
2382 case FFEINFO_kindtypeREAL4
:
2383 error
= ffetarget_convert_complex1_real4
2384 (ffebld_cu_ptr_complex1 (u
),
2385 ffebld_constant_real4 (ffebld_conter (l
)));
2390 assert ("COMPLEX1/REAL bad source kind type" == NULL
);
2395 case FFEINFO_basictypeCOMPLEX
:
2396 switch (ffeinfo_kindtype (ffebld_info (l
)))
2398 #if FFETARGET_okCOMPLEX2
2399 case FFEINFO_kindtypeREAL2
:
2400 error
= ffetarget_convert_complex1_complex2
2401 (ffebld_cu_ptr_complex1 (u
),
2402 ffebld_constant_complex2 (ffebld_conter (l
)));
2406 #if FFETARGET_okCOMPLEX3
2407 case FFEINFO_kindtypeREAL3
:
2408 error
= ffetarget_convert_complex1_complex3
2409 (ffebld_cu_ptr_complex1 (u
),
2410 ffebld_constant_complex3 (ffebld_conter (l
)));
2414 #if FFETARGET_okCOMPLEX4
2415 case FFEINFO_kindtypeREAL4
:
2416 error
= ffetarget_convert_complex1_complex4
2417 (ffebld_cu_ptr_complex1 (u
),
2418 ffebld_constant_complex4 (ffebld_conter (l
)));
2423 assert ("COMPLEX1/COMPLEX bad source kind type" == NULL
);
2428 case FFEINFO_basictypeCHARACTER
:
2429 error
= ffetarget_convert_complex1_character1
2430 (ffebld_cu_ptr_complex1 (u
),
2431 ffebld_constant_character1 (ffebld_conter (l
)));
2434 case FFEINFO_basictypeHOLLERITH
:
2435 error
= ffetarget_convert_complex1_hollerith
2436 (ffebld_cu_ptr_complex1 (u
),
2437 ffebld_constant_hollerith (ffebld_conter (l
)));
2440 case FFEINFO_basictypeTYPELESS
:
2441 error
= ffetarget_convert_complex1_typeless
2442 (ffebld_cu_ptr_complex1 (u
),
2443 ffebld_constant_typeless (ffebld_conter (l
)));
2447 assert ("COMPLEX1 bad type" == NULL
);
2451 /* If conversion operation is not implemented, return original expr. */
2452 if (error
== FFEBAD_NOCANDO
)
2455 expr
= ffebld_new_conter_with_orig
2456 (ffebld_constant_new_complex1_val
2457 (ffebld_cu_val_complex1 (u
)), expr
);
2461 #if FFETARGET_okCOMPLEX2
2462 case FFEINFO_kindtypeREAL2
:
2463 switch (ffeinfo_basictype (ffebld_info (l
)))
2465 case FFEINFO_basictypeINTEGER
:
2466 switch (ffeinfo_kindtype (ffebld_info (l
)))
2468 #if FFETARGET_okINTEGER1
2469 case FFEINFO_kindtypeINTEGER1
:
2470 error
= ffetarget_convert_complex2_integer1
2471 (ffebld_cu_ptr_complex2 (u
),
2472 ffebld_constant_integer1 (ffebld_conter (l
)));
2476 #if FFETARGET_okINTEGER2
2477 case FFEINFO_kindtypeINTEGER2
:
2478 error
= ffetarget_convert_complex2_integer2
2479 (ffebld_cu_ptr_complex2 (u
),
2480 ffebld_constant_integer2 (ffebld_conter (l
)));
2484 #if FFETARGET_okINTEGER3
2485 case FFEINFO_kindtypeINTEGER3
:
2486 error
= ffetarget_convert_complex2_integer3
2487 (ffebld_cu_ptr_complex2 (u
),
2488 ffebld_constant_integer3 (ffebld_conter (l
)));
2492 #if FFETARGET_okINTEGER4
2493 case FFEINFO_kindtypeINTEGER4
:
2494 error
= ffetarget_convert_complex2_integer4
2495 (ffebld_cu_ptr_complex2 (u
),
2496 ffebld_constant_integer4 (ffebld_conter (l
)));
2501 assert ("COMPLEX2/INTEGER bad source kind type" == NULL
);
2506 case FFEINFO_basictypeREAL
:
2507 switch (ffeinfo_kindtype (ffebld_info (l
)))
2509 #if FFETARGET_okREAL1
2510 case FFEINFO_kindtypeREAL1
:
2511 error
= ffetarget_convert_complex2_real1
2512 (ffebld_cu_ptr_complex2 (u
),
2513 ffebld_constant_real1 (ffebld_conter (l
)));
2517 #if FFETARGET_okREAL2
2518 case FFEINFO_kindtypeREAL2
:
2519 error
= ffetarget_convert_complex2_real2
2520 (ffebld_cu_ptr_complex2 (u
),
2521 ffebld_constant_real2 (ffebld_conter (l
)));
2525 #if FFETARGET_okREAL3
2526 case FFEINFO_kindtypeREAL3
:
2527 error
= ffetarget_convert_complex2_real3
2528 (ffebld_cu_ptr_complex2 (u
),
2529 ffebld_constant_real3 (ffebld_conter (l
)));
2533 #if FFETARGET_okREAL4
2534 case FFEINFO_kindtypeREAL4
:
2535 error
= ffetarget_convert_complex2_real4
2536 (ffebld_cu_ptr_complex2 (u
),
2537 ffebld_constant_real4 (ffebld_conter (l
)));
2542 assert ("COMPLEX2/REAL bad source kind type" == NULL
);
2547 case FFEINFO_basictypeCOMPLEX
:
2548 switch (ffeinfo_kindtype (ffebld_info (l
)))
2550 #if FFETARGET_okCOMPLEX1
2551 case FFEINFO_kindtypeREAL1
:
2552 error
= ffetarget_convert_complex2_complex1
2553 (ffebld_cu_ptr_complex2 (u
),
2554 ffebld_constant_complex1 (ffebld_conter (l
)));
2558 #if FFETARGET_okCOMPLEX3
2559 case FFEINFO_kindtypeREAL3
:
2560 error
= ffetarget_convert_complex2_complex3
2561 (ffebld_cu_ptr_complex2 (u
),
2562 ffebld_constant_complex3 (ffebld_conter (l
)));
2566 #if FFETARGET_okCOMPLEX4
2567 case FFEINFO_kindtypeREAL4
:
2568 error
= ffetarget_convert_complex2_complex4
2569 (ffebld_cu_ptr_complex2 (u
),
2570 ffebld_constant_complex4 (ffebld_conter (l
)));
2575 assert ("COMPLEX2/COMPLEX bad source kind type" == NULL
);
2580 case FFEINFO_basictypeCHARACTER
:
2581 error
= ffetarget_convert_complex2_character1
2582 (ffebld_cu_ptr_complex2 (u
),
2583 ffebld_constant_character1 (ffebld_conter (l
)));
2586 case FFEINFO_basictypeHOLLERITH
:
2587 error
= ffetarget_convert_complex2_hollerith
2588 (ffebld_cu_ptr_complex2 (u
),
2589 ffebld_constant_hollerith (ffebld_conter (l
)));
2592 case FFEINFO_basictypeTYPELESS
:
2593 error
= ffetarget_convert_complex2_typeless
2594 (ffebld_cu_ptr_complex2 (u
),
2595 ffebld_constant_typeless (ffebld_conter (l
)));
2599 assert ("COMPLEX2 bad type" == NULL
);
2603 /* If conversion operation is not implemented, return original expr. */
2604 if (error
== FFEBAD_NOCANDO
)
2607 expr
= ffebld_new_conter_with_orig
2608 (ffebld_constant_new_complex2_val
2609 (ffebld_cu_val_complex2 (u
)), expr
);
2613 #if FFETARGET_okCOMPLEX3
2614 case FFEINFO_kindtypeREAL3
:
2615 switch (ffeinfo_basictype (ffebld_info (l
)))
2617 case FFEINFO_basictypeINTEGER
:
2618 switch (ffeinfo_kindtype (ffebld_info (l
)))
2620 #if FFETARGET_okINTEGER1
2621 case FFEINFO_kindtypeINTEGER1
:
2622 error
= ffetarget_convert_complex3_integer1
2623 (ffebld_cu_ptr_complex3 (u
),
2624 ffebld_constant_integer1 (ffebld_conter (l
)));
2628 #if FFETARGET_okINTEGER2
2629 case FFEINFO_kindtypeINTEGER2
:
2630 error
= ffetarget_convert_complex3_integer2
2631 (ffebld_cu_ptr_complex3 (u
),
2632 ffebld_constant_integer2 (ffebld_conter (l
)));
2636 #if FFETARGET_okINTEGER3
2637 case FFEINFO_kindtypeINTEGER3
:
2638 error
= ffetarget_convert_complex3_integer3
2639 (ffebld_cu_ptr_complex3 (u
),
2640 ffebld_constant_integer3 (ffebld_conter (l
)));
2644 #if FFETARGET_okINTEGER4
2645 case FFEINFO_kindtypeINTEGER4
:
2646 error
= ffetarget_convert_complex3_integer4
2647 (ffebld_cu_ptr_complex3 (u
),
2648 ffebld_constant_integer4 (ffebld_conter (l
)));
2653 assert ("COMPLEX3/INTEGER bad source kind type" == NULL
);
2658 case FFEINFO_basictypeREAL
:
2659 switch (ffeinfo_kindtype (ffebld_info (l
)))
2661 #if FFETARGET_okREAL1
2662 case FFEINFO_kindtypeREAL1
:
2663 error
= ffetarget_convert_complex3_real1
2664 (ffebld_cu_ptr_complex3 (u
),
2665 ffebld_constant_real1 (ffebld_conter (l
)));
2669 #if FFETARGET_okREAL2
2670 case FFEINFO_kindtypeREAL2
:
2671 error
= ffetarget_convert_complex3_real2
2672 (ffebld_cu_ptr_complex3 (u
),
2673 ffebld_constant_real2 (ffebld_conter (l
)));
2677 #if FFETARGET_okREAL3
2678 case FFEINFO_kindtypeREAL3
:
2679 error
= ffetarget_convert_complex3_real3
2680 (ffebld_cu_ptr_complex3 (u
),
2681 ffebld_constant_real3 (ffebld_conter (l
)));
2685 #if FFETARGET_okREAL4
2686 case FFEINFO_kindtypeREAL4
:
2687 error
= ffetarget_convert_complex3_real4
2688 (ffebld_cu_ptr_complex3 (u
),
2689 ffebld_constant_real4 (ffebld_conter (l
)));
2694 assert ("COMPLEX3/REAL bad source kind type" == NULL
);
2699 case FFEINFO_basictypeCOMPLEX
:
2700 switch (ffeinfo_kindtype (ffebld_info (l
)))
2702 #if FFETARGET_okCOMPLEX1
2703 case FFEINFO_kindtypeREAL1
:
2704 error
= ffetarget_convert_complex3_complex1
2705 (ffebld_cu_ptr_complex3 (u
),
2706 ffebld_constant_complex1 (ffebld_conter (l
)));
2710 #if FFETARGET_okCOMPLEX2
2711 case FFEINFO_kindtypeREAL2
:
2712 error
= ffetarget_convert_complex3_complex2
2713 (ffebld_cu_ptr_complex3 (u
),
2714 ffebld_constant_complex2 (ffebld_conter (l
)));
2718 #if FFETARGET_okCOMPLEX4
2719 case FFEINFO_kindtypeREAL4
:
2720 error
= ffetarget_convert_complex3_complex4
2721 (ffebld_cu_ptr_complex3 (u
),
2722 ffebld_constant_complex4 (ffebld_conter (l
)));
2727 assert ("COMPLEX3/COMPLEX bad source kind type" == NULL
);
2732 case FFEINFO_basictypeCHARACTER
:
2733 error
= ffetarget_convert_complex3_character1
2734 (ffebld_cu_ptr_complex3 (u
),
2735 ffebld_constant_character1 (ffebld_conter (l
)));
2738 case FFEINFO_basictypeHOLLERITH
:
2739 error
= ffetarget_convert_complex3_hollerith
2740 (ffebld_cu_ptr_complex3 (u
),
2741 ffebld_constant_hollerith (ffebld_conter (l
)));
2744 case FFEINFO_basictypeTYPELESS
:
2745 error
= ffetarget_convert_complex3_typeless
2746 (ffebld_cu_ptr_complex3 (u
),
2747 ffebld_constant_typeless (ffebld_conter (l
)));
2751 assert ("COMPLEX3 bad type" == NULL
);
2755 /* If conversion operation is not implemented, return original expr. */
2756 if (error
== FFEBAD_NOCANDO
)
2759 expr
= ffebld_new_conter_with_orig
2760 (ffebld_constant_new_complex3_val
2761 (ffebld_cu_val_complex3 (u
)), expr
);
2765 #if FFETARGET_okCOMPLEX4
2766 case FFEINFO_kindtypeREAL4
:
2767 switch (ffeinfo_basictype (ffebld_info (l
)))
2769 case FFEINFO_basictypeINTEGER
:
2770 switch (ffeinfo_kindtype (ffebld_info (l
)))
2772 #if FFETARGET_okINTEGER1
2773 case FFEINFO_kindtypeINTEGER1
:
2774 error
= ffetarget_convert_complex4_integer1
2775 (ffebld_cu_ptr_complex4 (u
),
2776 ffebld_constant_integer1 (ffebld_conter (l
)));
2780 #if FFETARGET_okINTEGER2
2781 case FFEINFO_kindtypeINTEGER2
:
2782 error
= ffetarget_convert_complex4_integer2
2783 (ffebld_cu_ptr_complex4 (u
),
2784 ffebld_constant_integer2 (ffebld_conter (l
)));
2788 #if FFETARGET_okINTEGER3
2789 case FFEINFO_kindtypeINTEGER3
:
2790 error
= ffetarget_convert_complex4_integer3
2791 (ffebld_cu_ptr_complex4 (u
),
2792 ffebld_constant_integer3 (ffebld_conter (l
)));
2796 #if FFETARGET_okINTEGER4
2797 case FFEINFO_kindtypeINTEGER4
:
2798 error
= ffetarget_convert_complex4_integer4
2799 (ffebld_cu_ptr_complex4 (u
),
2800 ffebld_constant_integer4 (ffebld_conter (l
)));
2805 assert ("COMPLEX4/INTEGER bad source kind type" == NULL
);
2810 case FFEINFO_basictypeREAL
:
2811 switch (ffeinfo_kindtype (ffebld_info (l
)))
2813 #if FFETARGET_okREAL1
2814 case FFEINFO_kindtypeREAL1
:
2815 error
= ffetarget_convert_complex4_real1
2816 (ffebld_cu_ptr_complex4 (u
),
2817 ffebld_constant_real1 (ffebld_conter (l
)));
2821 #if FFETARGET_okREAL2
2822 case FFEINFO_kindtypeREAL2
:
2823 error
= ffetarget_convert_complex4_real2
2824 (ffebld_cu_ptr_complex4 (u
),
2825 ffebld_constant_real2 (ffebld_conter (l
)));
2829 #if FFETARGET_okREAL3
2830 case FFEINFO_kindtypeREAL3
:
2831 error
= ffetarget_convert_complex4_real3
2832 (ffebld_cu_ptr_complex4 (u
),
2833 ffebld_constant_real3 (ffebld_conter (l
)));
2837 #if FFETARGET_okREAL4
2838 case FFEINFO_kindtypeREAL4
:
2839 error
= ffetarget_convert_complex4_real4
2840 (ffebld_cu_ptr_complex4 (u
),
2841 ffebld_constant_real4 (ffebld_conter (l
)));
2846 assert ("COMPLEX4/REAL bad source kind type" == NULL
);
2851 case FFEINFO_basictypeCOMPLEX
:
2852 switch (ffeinfo_kindtype (ffebld_info (l
)))
2854 #if FFETARGET_okCOMPLEX1
2855 case FFEINFO_kindtypeREAL1
:
2856 error
= ffetarget_convert_complex4_complex1
2857 (ffebld_cu_ptr_complex4 (u
),
2858 ffebld_constant_complex1 (ffebld_conter (l
)));
2862 #if FFETARGET_okCOMPLEX2
2863 case FFEINFO_kindtypeREAL2
:
2864 error
= ffetarget_convert_complex4_complex2
2865 (ffebld_cu_ptr_complex4 (u
),
2866 ffebld_constant_complex2 (ffebld_conter (l
)));
2870 #if FFETARGET_okCOMPLEX3
2871 case FFEINFO_kindtypeREAL3
:
2872 error
= ffetarget_convert_complex4_complex3
2873 (ffebld_cu_ptr_complex4 (u
),
2874 ffebld_constant_complex3 (ffebld_conter (l
)));
2879 assert ("COMPLEX4/COMPLEX bad source kind type" == NULL
);
2884 case FFEINFO_basictypeCHARACTER
:
2885 error
= ffetarget_convert_complex4_character1
2886 (ffebld_cu_ptr_complex4 (u
),
2887 ffebld_constant_character1 (ffebld_conter (l
)));
2890 case FFEINFO_basictypeHOLLERITH
:
2891 error
= ffetarget_convert_complex4_hollerith
2892 (ffebld_cu_ptr_complex4 (u
),
2893 ffebld_constant_hollerith (ffebld_conter (l
)));
2896 case FFEINFO_basictypeTYPELESS
:
2897 error
= ffetarget_convert_complex4_typeless
2898 (ffebld_cu_ptr_complex4 (u
),
2899 ffebld_constant_typeless (ffebld_conter (l
)));
2903 assert ("COMPLEX4 bad type" == NULL
);
2907 /* If conversion operation is not implemented, return original expr. */
2908 if (error
== FFEBAD_NOCANDO
)
2911 expr
= ffebld_new_conter_with_orig
2912 (ffebld_constant_new_complex4_val
2913 (ffebld_cu_val_complex4 (u
)), expr
);
2918 assert ("bad complex kind type" == NULL
);
2923 case FFEINFO_basictypeCHARACTER
:
2924 if ((sz
= ffebld_size (expr
)) == FFETARGET_charactersizeNONE
)
2926 kt
= ffeinfo_kindtype (ffebld_info (expr
));
2929 #if FFETARGET_okCHARACTER1
2930 case FFEINFO_kindtypeCHARACTER1
:
2931 switch (ffeinfo_basictype (ffebld_info (l
)))
2933 case FFEINFO_basictypeCHARACTER
:
2934 if ((sz2
= ffebld_size (l
)) == FFETARGET_charactersizeNONE
)
2936 assert (kt
== ffeinfo_kindtype (ffebld_info (l
)));
2937 assert (sz2
== ffetarget_length_character1
2938 (ffebld_constant_character1
2939 (ffebld_conter (l
))));
2941 = ffetarget_convert_character1_character1
2942 (ffebld_cu_ptr_character1 (u
), sz
,
2943 ffebld_constant_character1 (ffebld_conter (l
)),
2944 ffebld_constant_pool ());
2947 case FFEINFO_basictypeINTEGER
:
2948 switch (ffeinfo_kindtype (ffebld_info (l
)))
2950 #if FFETARGET_okINTEGER1
2951 case FFEINFO_kindtypeINTEGER1
:
2953 = ffetarget_convert_character1_integer1
2954 (ffebld_cu_ptr_character1 (u
),
2956 ffebld_constant_integer1 (ffebld_conter (l
)),
2957 ffebld_constant_pool ());
2961 #if FFETARGET_okINTEGER2
2962 case FFEINFO_kindtypeINTEGER2
:
2964 = ffetarget_convert_character1_integer2
2965 (ffebld_cu_ptr_character1 (u
),
2967 ffebld_constant_integer2 (ffebld_conter (l
)),
2968 ffebld_constant_pool ());
2972 #if FFETARGET_okINTEGER3
2973 case FFEINFO_kindtypeINTEGER3
:
2975 = ffetarget_convert_character1_integer3
2976 (ffebld_cu_ptr_character1 (u
),
2978 ffebld_constant_integer3 (ffebld_conter (l
)),
2979 ffebld_constant_pool ());
2983 #if FFETARGET_okINTEGER4
2984 case FFEINFO_kindtypeINTEGER4
:
2986 = ffetarget_convert_character1_integer4
2987 (ffebld_cu_ptr_character1 (u
),
2989 ffebld_constant_integer4 (ffebld_conter (l
)),
2990 ffebld_constant_pool ());
2995 assert ("CHARACTER1/INTEGER bad source kind type" == NULL
);
3000 case FFEINFO_basictypeLOGICAL
:
3001 switch (ffeinfo_kindtype (ffebld_info (l
)))
3003 #if FFETARGET_okLOGICAL1
3004 case FFEINFO_kindtypeLOGICAL1
:
3006 = ffetarget_convert_character1_logical1
3007 (ffebld_cu_ptr_character1 (u
),
3009 ffebld_constant_logical1 (ffebld_conter (l
)),
3010 ffebld_constant_pool ());
3014 #if FFETARGET_okLOGICAL2
3015 case FFEINFO_kindtypeLOGICAL2
:
3017 = ffetarget_convert_character1_logical2
3018 (ffebld_cu_ptr_character1 (u
),
3020 ffebld_constant_logical2 (ffebld_conter (l
)),
3021 ffebld_constant_pool ());
3025 #if FFETARGET_okLOGICAL3
3026 case FFEINFO_kindtypeLOGICAL3
:
3028 = ffetarget_convert_character1_logical3
3029 (ffebld_cu_ptr_character1 (u
),
3031 ffebld_constant_logical3 (ffebld_conter (l
)),
3032 ffebld_constant_pool ());
3036 #if FFETARGET_okLOGICAL4
3037 case FFEINFO_kindtypeLOGICAL4
:
3039 = ffetarget_convert_character1_logical4
3040 (ffebld_cu_ptr_character1 (u
),
3042 ffebld_constant_logical4 (ffebld_conter (l
)),
3043 ffebld_constant_pool ());
3048 assert ("CHARACTER1/LOGICAL bad source kind type" == NULL
);
3053 case FFEINFO_basictypeHOLLERITH
:
3055 = ffetarget_convert_character1_hollerith
3056 (ffebld_cu_ptr_character1 (u
),
3058 ffebld_constant_hollerith (ffebld_conter (l
)),
3059 ffebld_constant_pool ());
3062 case FFEINFO_basictypeTYPELESS
:
3064 = ffetarget_convert_character1_typeless
3065 (ffebld_cu_ptr_character1 (u
),
3067 ffebld_constant_typeless (ffebld_conter (l
)),
3068 ffebld_constant_pool ());
3072 assert ("CHARACTER1 bad type" == NULL
);
3076 = ffebld_new_conter_with_orig
3077 (ffebld_constant_new_character1_val
3078 (ffebld_cu_val_character1 (u
)),
3084 assert ("bad character kind type" == NULL
);
3090 assert ("bad type" == NULL
);
3094 ffebld_set_info (expr
, ffeinfo_new
3099 FFEINFO_whereCONSTANT
,
3102 if ((error
!= FFEBAD
)
3103 && ffebad_start (error
))
3106 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
3113 /* ffeexpr_collapse_paren -- Collapse paren expr
3117 expr = ffeexpr_collapse_paren(expr,token);
3119 If the result of the expr is a constant, replaces the expr with the
3120 computed constant. */
3123 ffeexpr_collapse_paren (ffebld expr
, ffelexToken t UNUSED
)
3126 ffeinfoBasictype bt
;
3128 ffetargetCharacterSize len
;
3130 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
3133 r
= ffebld_left (expr
);
3135 if (ffebld_op (r
) != FFEBLD_opCONTER
)
3138 bt
= ffeinfo_basictype (ffebld_info (r
));
3139 kt
= ffeinfo_kindtype (ffebld_info (r
));
3140 len
= ffebld_size (r
);
3142 expr
= ffebld_new_conter_with_orig (ffebld_constant_copy (ffebld_conter (r
)),
3145 ffebld_set_info (expr
, ffeinfo_new
3150 FFEINFO_whereCONSTANT
,
3156 /* ffeexpr_collapse_uplus -- Collapse uplus expr
3160 expr = ffeexpr_collapse_uplus(expr,token);
3162 If the result of the expr is a constant, replaces the expr with the
3163 computed constant. */
3166 ffeexpr_collapse_uplus (ffebld expr
, ffelexToken t UNUSED
)
3169 ffeinfoBasictype bt
;
3171 ffetargetCharacterSize len
;
3173 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
3176 r
= ffebld_left (expr
);
3178 if (ffebld_op (r
) != FFEBLD_opCONTER
)
3181 bt
= ffeinfo_basictype (ffebld_info (r
));
3182 kt
= ffeinfo_kindtype (ffebld_info (r
));
3183 len
= ffebld_size (r
);
3185 expr
= ffebld_new_conter_with_orig (ffebld_constant_copy (ffebld_conter (r
)),
3188 ffebld_set_info (expr
, ffeinfo_new
3193 FFEINFO_whereCONSTANT
,
3199 /* ffeexpr_collapse_uminus -- Collapse uminus expr
3203 expr = ffeexpr_collapse_uminus(expr,token);
3205 If the result of the expr is a constant, replaces the expr with the
3206 computed constant. */
3209 ffeexpr_collapse_uminus (ffebld expr
, ffelexToken t
)
3211 ffebad error
= FFEBAD
;
3213 ffebldConstantUnion u
;
3214 ffeinfoBasictype bt
;
3217 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
3220 r
= ffebld_left (expr
);
3222 if (ffebld_op (r
) != FFEBLD_opCONTER
)
3225 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
3227 case FFEINFO_basictypeANY
:
3230 case FFEINFO_basictypeINTEGER
:
3231 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3233 #if FFETARGET_okINTEGER1
3234 case FFEINFO_kindtypeINTEGER1
:
3235 error
= ffetarget_uminus_integer1 (ffebld_cu_ptr_integer1 (u
),
3236 ffebld_constant_integer1 (ffebld_conter (r
)));
3237 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
3238 (ffebld_cu_val_integer1 (u
)), expr
);
3242 #if FFETARGET_okINTEGER2
3243 case FFEINFO_kindtypeINTEGER2
:
3244 error
= ffetarget_uminus_integer2 (ffebld_cu_ptr_integer2 (u
),
3245 ffebld_constant_integer2 (ffebld_conter (r
)));
3246 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
3247 (ffebld_cu_val_integer2 (u
)), expr
);
3251 #if FFETARGET_okINTEGER3
3252 case FFEINFO_kindtypeINTEGER3
:
3253 error
= ffetarget_uminus_integer3 (ffebld_cu_ptr_integer3 (u
),
3254 ffebld_constant_integer3 (ffebld_conter (r
)));
3255 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
3256 (ffebld_cu_val_integer3 (u
)), expr
);
3260 #if FFETARGET_okINTEGER4
3261 case FFEINFO_kindtypeINTEGER4
:
3262 error
= ffetarget_uminus_integer4 (ffebld_cu_ptr_integer4 (u
),
3263 ffebld_constant_integer4 (ffebld_conter (r
)));
3264 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
3265 (ffebld_cu_val_integer4 (u
)), expr
);
3270 assert ("bad integer kind type" == NULL
);
3275 case FFEINFO_basictypeREAL
:
3276 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3278 #if FFETARGET_okREAL1
3279 case FFEINFO_kindtypeREAL1
:
3280 error
= ffetarget_uminus_real1 (ffebld_cu_ptr_real1 (u
),
3281 ffebld_constant_real1 (ffebld_conter (r
)));
3282 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real1_val
3283 (ffebld_cu_val_real1 (u
)), expr
);
3287 #if FFETARGET_okREAL2
3288 case FFEINFO_kindtypeREAL2
:
3289 error
= ffetarget_uminus_real2 (ffebld_cu_ptr_real2 (u
),
3290 ffebld_constant_real2 (ffebld_conter (r
)));
3291 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real2_val
3292 (ffebld_cu_val_real2 (u
)), expr
);
3296 #if FFETARGET_okREAL3
3297 case FFEINFO_kindtypeREAL3
:
3298 error
= ffetarget_uminus_real3 (ffebld_cu_ptr_real3 (u
),
3299 ffebld_constant_real3 (ffebld_conter (r
)));
3300 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real3_val
3301 (ffebld_cu_val_real3 (u
)), expr
);
3305 #if FFETARGET_okREAL4
3306 case FFEINFO_kindtypeREAL4
:
3307 error
= ffetarget_uminus_real4 (ffebld_cu_ptr_real4 (u
),
3308 ffebld_constant_real4 (ffebld_conter (r
)));
3309 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real4_val
3310 (ffebld_cu_val_real4 (u
)), expr
);
3315 assert ("bad real kind type" == NULL
);
3320 case FFEINFO_basictypeCOMPLEX
:
3321 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3323 #if FFETARGET_okCOMPLEX1
3324 case FFEINFO_kindtypeREAL1
:
3325 error
= ffetarget_uminus_complex1 (ffebld_cu_ptr_complex1 (u
),
3326 ffebld_constant_complex1 (ffebld_conter (r
)));
3327 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex1_val
3328 (ffebld_cu_val_complex1 (u
)), expr
);
3332 #if FFETARGET_okCOMPLEX2
3333 case FFEINFO_kindtypeREAL2
:
3334 error
= ffetarget_uminus_complex2 (ffebld_cu_ptr_complex2 (u
),
3335 ffebld_constant_complex2 (ffebld_conter (r
)));
3336 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex2_val
3337 (ffebld_cu_val_complex2 (u
)), expr
);
3341 #if FFETARGET_okCOMPLEX3
3342 case FFEINFO_kindtypeREAL3
:
3343 error
= ffetarget_uminus_complex3 (ffebld_cu_ptr_complex3 (u
),
3344 ffebld_constant_complex3 (ffebld_conter (r
)));
3345 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex3_val
3346 (ffebld_cu_val_complex3 (u
)), expr
);
3350 #if FFETARGET_okCOMPLEX4
3351 case FFEINFO_kindtypeREAL4
:
3352 error
= ffetarget_uminus_complex4 (ffebld_cu_ptr_complex4 (u
),
3353 ffebld_constant_complex4 (ffebld_conter (r
)));
3354 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex4_val
3355 (ffebld_cu_val_complex4 (u
)), expr
);
3360 assert ("bad complex kind type" == NULL
);
3366 assert ("bad type" == NULL
);
3370 ffebld_set_info (expr
, ffeinfo_new
3375 FFEINFO_whereCONSTANT
,
3376 FFETARGET_charactersizeNONE
));
3378 if ((error
!= FFEBAD
)
3379 && ffebad_start (error
))
3381 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
3388 /* ffeexpr_collapse_not -- Collapse not expr
3392 expr = ffeexpr_collapse_not(expr,token);
3394 If the result of the expr is a constant, replaces the expr with the
3395 computed constant. */
3398 ffeexpr_collapse_not (ffebld expr
, ffelexToken t
)
3400 ffebad error
= FFEBAD
;
3402 ffebldConstantUnion u
;
3403 ffeinfoBasictype bt
;
3406 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
3409 r
= ffebld_left (expr
);
3411 if (ffebld_op (r
) != FFEBLD_opCONTER
)
3414 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
3416 case FFEINFO_basictypeANY
:
3419 case FFEINFO_basictypeINTEGER
:
3420 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3422 #if FFETARGET_okINTEGER1
3423 case FFEINFO_kindtypeINTEGER1
:
3424 error
= ffetarget_not_integer1 (ffebld_cu_ptr_integer1 (u
),
3425 ffebld_constant_integer1 (ffebld_conter (r
)));
3426 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
3427 (ffebld_cu_val_integer1 (u
)), expr
);
3431 #if FFETARGET_okINTEGER2
3432 case FFEINFO_kindtypeINTEGER2
:
3433 error
= ffetarget_not_integer2 (ffebld_cu_ptr_integer2 (u
),
3434 ffebld_constant_integer2 (ffebld_conter (r
)));
3435 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
3436 (ffebld_cu_val_integer2 (u
)), expr
);
3440 #if FFETARGET_okINTEGER3
3441 case FFEINFO_kindtypeINTEGER3
:
3442 error
= ffetarget_not_integer3 (ffebld_cu_ptr_integer3 (u
),
3443 ffebld_constant_integer3 (ffebld_conter (r
)));
3444 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
3445 (ffebld_cu_val_integer3 (u
)), expr
);
3449 #if FFETARGET_okINTEGER4
3450 case FFEINFO_kindtypeINTEGER4
:
3451 error
= ffetarget_not_integer4 (ffebld_cu_ptr_integer4 (u
),
3452 ffebld_constant_integer4 (ffebld_conter (r
)));
3453 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
3454 (ffebld_cu_val_integer4 (u
)), expr
);
3459 assert ("bad integer kind type" == NULL
);
3464 case FFEINFO_basictypeLOGICAL
:
3465 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3467 #if FFETARGET_okLOGICAL1
3468 case FFEINFO_kindtypeLOGICAL1
:
3469 error
= ffetarget_not_logical1 (ffebld_cu_ptr_logical1 (u
),
3470 ffebld_constant_logical1 (ffebld_conter (r
)));
3471 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical1_val
3472 (ffebld_cu_val_logical1 (u
)), expr
);
3476 #if FFETARGET_okLOGICAL2
3477 case FFEINFO_kindtypeLOGICAL2
:
3478 error
= ffetarget_not_logical2 (ffebld_cu_ptr_logical2 (u
),
3479 ffebld_constant_logical2 (ffebld_conter (r
)));
3480 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical2_val
3481 (ffebld_cu_val_logical2 (u
)), expr
);
3485 #if FFETARGET_okLOGICAL3
3486 case FFEINFO_kindtypeLOGICAL3
:
3487 error
= ffetarget_not_logical3 (ffebld_cu_ptr_logical3 (u
),
3488 ffebld_constant_logical3 (ffebld_conter (r
)));
3489 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical3_val
3490 (ffebld_cu_val_logical3 (u
)), expr
);
3494 #if FFETARGET_okLOGICAL4
3495 case FFEINFO_kindtypeLOGICAL4
:
3496 error
= ffetarget_not_logical4 (ffebld_cu_ptr_logical4 (u
),
3497 ffebld_constant_logical4 (ffebld_conter (r
)));
3498 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical4_val
3499 (ffebld_cu_val_logical4 (u
)), expr
);
3504 assert ("bad logical kind type" == NULL
);
3510 assert ("bad type" == NULL
);
3514 ffebld_set_info (expr
, ffeinfo_new
3519 FFEINFO_whereCONSTANT
,
3520 FFETARGET_charactersizeNONE
));
3522 if ((error
!= FFEBAD
)
3523 && ffebad_start (error
))
3525 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
3532 /* ffeexpr_collapse_add -- Collapse add expr
3536 expr = ffeexpr_collapse_add(expr,token);
3538 If the result of the expr is a constant, replaces the expr with the
3539 computed constant. */
3542 ffeexpr_collapse_add (ffebld expr
, ffelexToken t
)
3544 ffebad error
= FFEBAD
;
3547 ffebldConstantUnion u
;
3548 ffeinfoBasictype bt
;
3551 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
3554 l
= ffebld_left (expr
);
3555 r
= ffebld_right (expr
);
3557 if (ffebld_op (l
) != FFEBLD_opCONTER
)
3559 if (ffebld_op (r
) != FFEBLD_opCONTER
)
3562 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
3564 case FFEINFO_basictypeANY
:
3567 case FFEINFO_basictypeINTEGER
:
3568 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3570 #if FFETARGET_okINTEGER1
3571 case FFEINFO_kindtypeINTEGER1
:
3572 error
= ffetarget_add_integer1 (ffebld_cu_ptr_integer1 (u
),
3573 ffebld_constant_integer1 (ffebld_conter (l
)),
3574 ffebld_constant_integer1 (ffebld_conter (r
)));
3575 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
3576 (ffebld_cu_val_integer1 (u
)), expr
);
3580 #if FFETARGET_okINTEGER2
3581 case FFEINFO_kindtypeINTEGER2
:
3582 error
= ffetarget_add_integer2 (ffebld_cu_ptr_integer2 (u
),
3583 ffebld_constant_integer2 (ffebld_conter (l
)),
3584 ffebld_constant_integer2 (ffebld_conter (r
)));
3585 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
3586 (ffebld_cu_val_integer2 (u
)), expr
);
3590 #if FFETARGET_okINTEGER3
3591 case FFEINFO_kindtypeINTEGER3
:
3592 error
= ffetarget_add_integer3 (ffebld_cu_ptr_integer3 (u
),
3593 ffebld_constant_integer3 (ffebld_conter (l
)),
3594 ffebld_constant_integer3 (ffebld_conter (r
)));
3595 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
3596 (ffebld_cu_val_integer3 (u
)), expr
);
3600 #if FFETARGET_okINTEGER4
3601 case FFEINFO_kindtypeINTEGER4
:
3602 error
= ffetarget_add_integer4 (ffebld_cu_ptr_integer4 (u
),
3603 ffebld_constant_integer4 (ffebld_conter (l
)),
3604 ffebld_constant_integer4 (ffebld_conter (r
)));
3605 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
3606 (ffebld_cu_val_integer4 (u
)), expr
);
3611 assert ("bad integer kind type" == NULL
);
3616 case FFEINFO_basictypeREAL
:
3617 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3619 #if FFETARGET_okREAL1
3620 case FFEINFO_kindtypeREAL1
:
3621 error
= ffetarget_add_real1 (ffebld_cu_ptr_real1 (u
),
3622 ffebld_constant_real1 (ffebld_conter (l
)),
3623 ffebld_constant_real1 (ffebld_conter (r
)));
3624 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real1_val
3625 (ffebld_cu_val_real1 (u
)), expr
);
3629 #if FFETARGET_okREAL2
3630 case FFEINFO_kindtypeREAL2
:
3631 error
= ffetarget_add_real2 (ffebld_cu_ptr_real2 (u
),
3632 ffebld_constant_real2 (ffebld_conter (l
)),
3633 ffebld_constant_real2 (ffebld_conter (r
)));
3634 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real2_val
3635 (ffebld_cu_val_real2 (u
)), expr
);
3639 #if FFETARGET_okREAL3
3640 case FFEINFO_kindtypeREAL3
:
3641 error
= ffetarget_add_real3 (ffebld_cu_ptr_real3 (u
),
3642 ffebld_constant_real3 (ffebld_conter (l
)),
3643 ffebld_constant_real3 (ffebld_conter (r
)));
3644 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real3_val
3645 (ffebld_cu_val_real3 (u
)), expr
);
3649 #if FFETARGET_okREAL4
3650 case FFEINFO_kindtypeREAL4
:
3651 error
= ffetarget_add_real4 (ffebld_cu_ptr_real4 (u
),
3652 ffebld_constant_real4 (ffebld_conter (l
)),
3653 ffebld_constant_real4 (ffebld_conter (r
)));
3654 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real4_val
3655 (ffebld_cu_val_real4 (u
)), expr
);
3660 assert ("bad real kind type" == NULL
);
3665 case FFEINFO_basictypeCOMPLEX
:
3666 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3668 #if FFETARGET_okCOMPLEX1
3669 case FFEINFO_kindtypeREAL1
:
3670 error
= ffetarget_add_complex1 (ffebld_cu_ptr_complex1 (u
),
3671 ffebld_constant_complex1 (ffebld_conter (l
)),
3672 ffebld_constant_complex1 (ffebld_conter (r
)));
3673 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex1_val
3674 (ffebld_cu_val_complex1 (u
)), expr
);
3678 #if FFETARGET_okCOMPLEX2
3679 case FFEINFO_kindtypeREAL2
:
3680 error
= ffetarget_add_complex2 (ffebld_cu_ptr_complex2 (u
),
3681 ffebld_constant_complex2 (ffebld_conter (l
)),
3682 ffebld_constant_complex2 (ffebld_conter (r
)));
3683 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex2_val
3684 (ffebld_cu_val_complex2 (u
)), expr
);
3688 #if FFETARGET_okCOMPLEX3
3689 case FFEINFO_kindtypeREAL3
:
3690 error
= ffetarget_add_complex3 (ffebld_cu_ptr_complex3 (u
),
3691 ffebld_constant_complex3 (ffebld_conter (l
)),
3692 ffebld_constant_complex3 (ffebld_conter (r
)));
3693 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex3_val
3694 (ffebld_cu_val_complex3 (u
)), expr
);
3698 #if FFETARGET_okCOMPLEX4
3699 case FFEINFO_kindtypeREAL4
:
3700 error
= ffetarget_add_complex4 (ffebld_cu_ptr_complex4 (u
),
3701 ffebld_constant_complex4 (ffebld_conter (l
)),
3702 ffebld_constant_complex4 (ffebld_conter (r
)));
3703 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex4_val
3704 (ffebld_cu_val_complex4 (u
)), expr
);
3709 assert ("bad complex kind type" == NULL
);
3715 assert ("bad type" == NULL
);
3719 ffebld_set_info (expr
, ffeinfo_new
3724 FFEINFO_whereCONSTANT
,
3725 FFETARGET_charactersizeNONE
));
3727 if ((error
!= FFEBAD
)
3728 && ffebad_start (error
))
3730 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
3737 /* ffeexpr_collapse_subtract -- Collapse subtract expr
3741 expr = ffeexpr_collapse_subtract(expr,token);
3743 If the result of the expr is a constant, replaces the expr with the
3744 computed constant. */
3747 ffeexpr_collapse_subtract (ffebld expr
, ffelexToken t
)
3749 ffebad error
= FFEBAD
;
3752 ffebldConstantUnion u
;
3753 ffeinfoBasictype bt
;
3756 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
3759 l
= ffebld_left (expr
);
3760 r
= ffebld_right (expr
);
3762 if (ffebld_op (l
) != FFEBLD_opCONTER
)
3764 if (ffebld_op (r
) != FFEBLD_opCONTER
)
3767 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
3769 case FFEINFO_basictypeANY
:
3772 case FFEINFO_basictypeINTEGER
:
3773 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3775 #if FFETARGET_okINTEGER1
3776 case FFEINFO_kindtypeINTEGER1
:
3777 error
= ffetarget_subtract_integer1 (ffebld_cu_ptr_integer1 (u
),
3778 ffebld_constant_integer1 (ffebld_conter (l
)),
3779 ffebld_constant_integer1 (ffebld_conter (r
)));
3780 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
3781 (ffebld_cu_val_integer1 (u
)), expr
);
3785 #if FFETARGET_okINTEGER2
3786 case FFEINFO_kindtypeINTEGER2
:
3787 error
= ffetarget_subtract_integer2 (ffebld_cu_ptr_integer2 (u
),
3788 ffebld_constant_integer2 (ffebld_conter (l
)),
3789 ffebld_constant_integer2 (ffebld_conter (r
)));
3790 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
3791 (ffebld_cu_val_integer2 (u
)), expr
);
3795 #if FFETARGET_okINTEGER3
3796 case FFEINFO_kindtypeINTEGER3
:
3797 error
= ffetarget_subtract_integer3 (ffebld_cu_ptr_integer3 (u
),
3798 ffebld_constant_integer3 (ffebld_conter (l
)),
3799 ffebld_constant_integer3 (ffebld_conter (r
)));
3800 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
3801 (ffebld_cu_val_integer3 (u
)), expr
);
3805 #if FFETARGET_okINTEGER4
3806 case FFEINFO_kindtypeINTEGER4
:
3807 error
= ffetarget_subtract_integer4 (ffebld_cu_ptr_integer4 (u
),
3808 ffebld_constant_integer4 (ffebld_conter (l
)),
3809 ffebld_constant_integer4 (ffebld_conter (r
)));
3810 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
3811 (ffebld_cu_val_integer4 (u
)), expr
);
3816 assert ("bad integer kind type" == NULL
);
3821 case FFEINFO_basictypeREAL
:
3822 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3824 #if FFETARGET_okREAL1
3825 case FFEINFO_kindtypeREAL1
:
3826 error
= ffetarget_subtract_real1 (ffebld_cu_ptr_real1 (u
),
3827 ffebld_constant_real1 (ffebld_conter (l
)),
3828 ffebld_constant_real1 (ffebld_conter (r
)));
3829 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real1_val
3830 (ffebld_cu_val_real1 (u
)), expr
);
3834 #if FFETARGET_okREAL2
3835 case FFEINFO_kindtypeREAL2
:
3836 error
= ffetarget_subtract_real2 (ffebld_cu_ptr_real2 (u
),
3837 ffebld_constant_real2 (ffebld_conter (l
)),
3838 ffebld_constant_real2 (ffebld_conter (r
)));
3839 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real2_val
3840 (ffebld_cu_val_real2 (u
)), expr
);
3844 #if FFETARGET_okREAL3
3845 case FFEINFO_kindtypeREAL3
:
3846 error
= ffetarget_subtract_real3 (ffebld_cu_ptr_real3 (u
),
3847 ffebld_constant_real3 (ffebld_conter (l
)),
3848 ffebld_constant_real3 (ffebld_conter (r
)));
3849 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real3_val
3850 (ffebld_cu_val_real3 (u
)), expr
);
3854 #if FFETARGET_okREAL4
3855 case FFEINFO_kindtypeREAL4
:
3856 error
= ffetarget_subtract_real4 (ffebld_cu_ptr_real4 (u
),
3857 ffebld_constant_real4 (ffebld_conter (l
)),
3858 ffebld_constant_real4 (ffebld_conter (r
)));
3859 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real4_val
3860 (ffebld_cu_val_real4 (u
)), expr
);
3865 assert ("bad real kind type" == NULL
);
3870 case FFEINFO_basictypeCOMPLEX
:
3871 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3873 #if FFETARGET_okCOMPLEX1
3874 case FFEINFO_kindtypeREAL1
:
3875 error
= ffetarget_subtract_complex1 (ffebld_cu_ptr_complex1 (u
),
3876 ffebld_constant_complex1 (ffebld_conter (l
)),
3877 ffebld_constant_complex1 (ffebld_conter (r
)));
3878 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex1_val
3879 (ffebld_cu_val_complex1 (u
)), expr
);
3883 #if FFETARGET_okCOMPLEX2
3884 case FFEINFO_kindtypeREAL2
:
3885 error
= ffetarget_subtract_complex2 (ffebld_cu_ptr_complex2 (u
),
3886 ffebld_constant_complex2 (ffebld_conter (l
)),
3887 ffebld_constant_complex2 (ffebld_conter (r
)));
3888 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex2_val
3889 (ffebld_cu_val_complex2 (u
)), expr
);
3893 #if FFETARGET_okCOMPLEX3
3894 case FFEINFO_kindtypeREAL3
:
3895 error
= ffetarget_subtract_complex3 (ffebld_cu_ptr_complex3 (u
),
3896 ffebld_constant_complex3 (ffebld_conter (l
)),
3897 ffebld_constant_complex3 (ffebld_conter (r
)));
3898 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex3_val
3899 (ffebld_cu_val_complex3 (u
)), expr
);
3903 #if FFETARGET_okCOMPLEX4
3904 case FFEINFO_kindtypeREAL4
:
3905 error
= ffetarget_subtract_complex4 (ffebld_cu_ptr_complex4 (u
),
3906 ffebld_constant_complex4 (ffebld_conter (l
)),
3907 ffebld_constant_complex4 (ffebld_conter (r
)));
3908 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex4_val
3909 (ffebld_cu_val_complex4 (u
)), expr
);
3914 assert ("bad complex kind type" == NULL
);
3920 assert ("bad type" == NULL
);
3924 ffebld_set_info (expr
, ffeinfo_new
3929 FFEINFO_whereCONSTANT
,
3930 FFETARGET_charactersizeNONE
));
3932 if ((error
!= FFEBAD
)
3933 && ffebad_start (error
))
3935 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
3942 /* ffeexpr_collapse_multiply -- Collapse multiply expr
3946 expr = ffeexpr_collapse_multiply(expr,token);
3948 If the result of the expr is a constant, replaces the expr with the
3949 computed constant. */
3952 ffeexpr_collapse_multiply (ffebld expr
, ffelexToken t
)
3954 ffebad error
= FFEBAD
;
3957 ffebldConstantUnion u
;
3958 ffeinfoBasictype bt
;
3961 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
3964 l
= ffebld_left (expr
);
3965 r
= ffebld_right (expr
);
3967 if (ffebld_op (l
) != FFEBLD_opCONTER
)
3969 if (ffebld_op (r
) != FFEBLD_opCONTER
)
3972 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
3974 case FFEINFO_basictypeANY
:
3977 case FFEINFO_basictypeINTEGER
:
3978 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
3980 #if FFETARGET_okINTEGER1
3981 case FFEINFO_kindtypeINTEGER1
:
3982 error
= ffetarget_multiply_integer1 (ffebld_cu_ptr_integer1 (u
),
3983 ffebld_constant_integer1 (ffebld_conter (l
)),
3984 ffebld_constant_integer1 (ffebld_conter (r
)));
3985 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
3986 (ffebld_cu_val_integer1 (u
)), expr
);
3990 #if FFETARGET_okINTEGER2
3991 case FFEINFO_kindtypeINTEGER2
:
3992 error
= ffetarget_multiply_integer2 (ffebld_cu_ptr_integer2 (u
),
3993 ffebld_constant_integer2 (ffebld_conter (l
)),
3994 ffebld_constant_integer2 (ffebld_conter (r
)));
3995 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
3996 (ffebld_cu_val_integer2 (u
)), expr
);
4000 #if FFETARGET_okINTEGER3
4001 case FFEINFO_kindtypeINTEGER3
:
4002 error
= ffetarget_multiply_integer3 (ffebld_cu_ptr_integer3 (u
),
4003 ffebld_constant_integer3 (ffebld_conter (l
)),
4004 ffebld_constant_integer3 (ffebld_conter (r
)));
4005 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
4006 (ffebld_cu_val_integer3 (u
)), expr
);
4010 #if FFETARGET_okINTEGER4
4011 case FFEINFO_kindtypeINTEGER4
:
4012 error
= ffetarget_multiply_integer4 (ffebld_cu_ptr_integer4 (u
),
4013 ffebld_constant_integer4 (ffebld_conter (l
)),
4014 ffebld_constant_integer4 (ffebld_conter (r
)));
4015 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
4016 (ffebld_cu_val_integer4 (u
)), expr
);
4021 assert ("bad integer kind type" == NULL
);
4026 case FFEINFO_basictypeREAL
:
4027 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4029 #if FFETARGET_okREAL1
4030 case FFEINFO_kindtypeREAL1
:
4031 error
= ffetarget_multiply_real1 (ffebld_cu_ptr_real1 (u
),
4032 ffebld_constant_real1 (ffebld_conter (l
)),
4033 ffebld_constant_real1 (ffebld_conter (r
)));
4034 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real1_val
4035 (ffebld_cu_val_real1 (u
)), expr
);
4039 #if FFETARGET_okREAL2
4040 case FFEINFO_kindtypeREAL2
:
4041 error
= ffetarget_multiply_real2 (ffebld_cu_ptr_real2 (u
),
4042 ffebld_constant_real2 (ffebld_conter (l
)),
4043 ffebld_constant_real2 (ffebld_conter (r
)));
4044 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real2_val
4045 (ffebld_cu_val_real2 (u
)), expr
);
4049 #if FFETARGET_okREAL3
4050 case FFEINFO_kindtypeREAL3
:
4051 error
= ffetarget_multiply_real3 (ffebld_cu_ptr_real3 (u
),
4052 ffebld_constant_real3 (ffebld_conter (l
)),
4053 ffebld_constant_real3 (ffebld_conter (r
)));
4054 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real3_val
4055 (ffebld_cu_val_real3 (u
)), expr
);
4059 #if FFETARGET_okREAL4
4060 case FFEINFO_kindtypeREAL4
:
4061 error
= ffetarget_multiply_real4 (ffebld_cu_ptr_real4 (u
),
4062 ffebld_constant_real4 (ffebld_conter (l
)),
4063 ffebld_constant_real4 (ffebld_conter (r
)));
4064 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real4_val
4065 (ffebld_cu_val_real4 (u
)), expr
);
4070 assert ("bad real kind type" == NULL
);
4075 case FFEINFO_basictypeCOMPLEX
:
4076 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4078 #if FFETARGET_okCOMPLEX1
4079 case FFEINFO_kindtypeREAL1
:
4080 error
= ffetarget_multiply_complex1 (ffebld_cu_ptr_complex1 (u
),
4081 ffebld_constant_complex1 (ffebld_conter (l
)),
4082 ffebld_constant_complex1 (ffebld_conter (r
)));
4083 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex1_val
4084 (ffebld_cu_val_complex1 (u
)), expr
);
4088 #if FFETARGET_okCOMPLEX2
4089 case FFEINFO_kindtypeREAL2
:
4090 error
= ffetarget_multiply_complex2 (ffebld_cu_ptr_complex2 (u
),
4091 ffebld_constant_complex2 (ffebld_conter (l
)),
4092 ffebld_constant_complex2 (ffebld_conter (r
)));
4093 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex2_val
4094 (ffebld_cu_val_complex2 (u
)), expr
);
4098 #if FFETARGET_okCOMPLEX3
4099 case FFEINFO_kindtypeREAL3
:
4100 error
= ffetarget_multiply_complex3 (ffebld_cu_ptr_complex3 (u
),
4101 ffebld_constant_complex3 (ffebld_conter (l
)),
4102 ffebld_constant_complex3 (ffebld_conter (r
)));
4103 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex3_val
4104 (ffebld_cu_val_complex3 (u
)), expr
);
4108 #if FFETARGET_okCOMPLEX4
4109 case FFEINFO_kindtypeREAL4
:
4110 error
= ffetarget_multiply_complex4 (ffebld_cu_ptr_complex4 (u
),
4111 ffebld_constant_complex4 (ffebld_conter (l
)),
4112 ffebld_constant_complex4 (ffebld_conter (r
)));
4113 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex4_val
4114 (ffebld_cu_val_complex4 (u
)), expr
);
4119 assert ("bad complex kind type" == NULL
);
4125 assert ("bad type" == NULL
);
4129 ffebld_set_info (expr
, ffeinfo_new
4134 FFEINFO_whereCONSTANT
,
4135 FFETARGET_charactersizeNONE
));
4137 if ((error
!= FFEBAD
)
4138 && ffebad_start (error
))
4140 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
4147 /* ffeexpr_collapse_divide -- Collapse divide expr
4151 expr = ffeexpr_collapse_divide(expr,token);
4153 If the result of the expr is a constant, replaces the expr with the
4154 computed constant. */
4157 ffeexpr_collapse_divide (ffebld expr
, ffelexToken t
)
4159 ffebad error
= FFEBAD
;
4162 ffebldConstantUnion u
;
4163 ffeinfoBasictype bt
;
4166 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
4169 l
= ffebld_left (expr
);
4170 r
= ffebld_right (expr
);
4172 if (ffebld_op (l
) != FFEBLD_opCONTER
)
4174 if (ffebld_op (r
) != FFEBLD_opCONTER
)
4177 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
4179 case FFEINFO_basictypeANY
:
4182 case FFEINFO_basictypeINTEGER
:
4183 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4185 #if FFETARGET_okINTEGER1
4186 case FFEINFO_kindtypeINTEGER1
:
4187 error
= ffetarget_divide_integer1 (ffebld_cu_ptr_integer1 (u
),
4188 ffebld_constant_integer1 (ffebld_conter (l
)),
4189 ffebld_constant_integer1 (ffebld_conter (r
)));
4190 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
4191 (ffebld_cu_val_integer1 (u
)), expr
);
4195 #if FFETARGET_okINTEGER2
4196 case FFEINFO_kindtypeINTEGER2
:
4197 error
= ffetarget_divide_integer2 (ffebld_cu_ptr_integer2 (u
),
4198 ffebld_constant_integer2 (ffebld_conter (l
)),
4199 ffebld_constant_integer2 (ffebld_conter (r
)));
4200 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
4201 (ffebld_cu_val_integer2 (u
)), expr
);
4205 #if FFETARGET_okINTEGER3
4206 case FFEINFO_kindtypeINTEGER3
:
4207 error
= ffetarget_divide_integer3 (ffebld_cu_ptr_integer3 (u
),
4208 ffebld_constant_integer3 (ffebld_conter (l
)),
4209 ffebld_constant_integer3 (ffebld_conter (r
)));
4210 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
4211 (ffebld_cu_val_integer3 (u
)), expr
);
4215 #if FFETARGET_okINTEGER4
4216 case FFEINFO_kindtypeINTEGER4
:
4217 error
= ffetarget_divide_integer4 (ffebld_cu_ptr_integer4 (u
),
4218 ffebld_constant_integer4 (ffebld_conter (l
)),
4219 ffebld_constant_integer4 (ffebld_conter (r
)));
4220 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
4221 (ffebld_cu_val_integer4 (u
)), expr
);
4226 assert ("bad integer kind type" == NULL
);
4231 case FFEINFO_basictypeREAL
:
4232 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4234 #if FFETARGET_okREAL1
4235 case FFEINFO_kindtypeREAL1
:
4236 error
= ffetarget_divide_real1 (ffebld_cu_ptr_real1 (u
),
4237 ffebld_constant_real1 (ffebld_conter (l
)),
4238 ffebld_constant_real1 (ffebld_conter (r
)));
4239 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real1_val
4240 (ffebld_cu_val_real1 (u
)), expr
);
4244 #if FFETARGET_okREAL2
4245 case FFEINFO_kindtypeREAL2
:
4246 error
= ffetarget_divide_real2 (ffebld_cu_ptr_real2 (u
),
4247 ffebld_constant_real2 (ffebld_conter (l
)),
4248 ffebld_constant_real2 (ffebld_conter (r
)));
4249 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real2_val
4250 (ffebld_cu_val_real2 (u
)), expr
);
4254 #if FFETARGET_okREAL3
4255 case FFEINFO_kindtypeREAL3
:
4256 error
= ffetarget_divide_real3 (ffebld_cu_ptr_real3 (u
),
4257 ffebld_constant_real3 (ffebld_conter (l
)),
4258 ffebld_constant_real3 (ffebld_conter (r
)));
4259 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real3_val
4260 (ffebld_cu_val_real3 (u
)), expr
);
4264 #if FFETARGET_okREAL4
4265 case FFEINFO_kindtypeREAL4
:
4266 error
= ffetarget_divide_real4 (ffebld_cu_ptr_real4 (u
),
4267 ffebld_constant_real4 (ffebld_conter (l
)),
4268 ffebld_constant_real4 (ffebld_conter (r
)));
4269 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_real4_val
4270 (ffebld_cu_val_real4 (u
)), expr
);
4275 assert ("bad real kind type" == NULL
);
4280 case FFEINFO_basictypeCOMPLEX
:
4281 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4283 #if FFETARGET_okCOMPLEX1
4284 case FFEINFO_kindtypeREAL1
:
4285 error
= ffetarget_divide_complex1 (ffebld_cu_ptr_complex1 (u
),
4286 ffebld_constant_complex1 (ffebld_conter (l
)),
4287 ffebld_constant_complex1 (ffebld_conter (r
)));
4288 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex1_val
4289 (ffebld_cu_val_complex1 (u
)), expr
);
4293 #if FFETARGET_okCOMPLEX2
4294 case FFEINFO_kindtypeREAL2
:
4295 error
= ffetarget_divide_complex2 (ffebld_cu_ptr_complex2 (u
),
4296 ffebld_constant_complex2 (ffebld_conter (l
)),
4297 ffebld_constant_complex2 (ffebld_conter (r
)));
4298 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex2_val
4299 (ffebld_cu_val_complex2 (u
)), expr
);
4303 #if FFETARGET_okCOMPLEX3
4304 case FFEINFO_kindtypeREAL3
:
4305 error
= ffetarget_divide_complex3 (ffebld_cu_ptr_complex3 (u
),
4306 ffebld_constant_complex3 (ffebld_conter (l
)),
4307 ffebld_constant_complex3 (ffebld_conter (r
)));
4308 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex3_val
4309 (ffebld_cu_val_complex3 (u
)), expr
);
4313 #if FFETARGET_okCOMPLEX4
4314 case FFEINFO_kindtypeREAL4
:
4315 error
= ffetarget_divide_complex4 (ffebld_cu_ptr_complex4 (u
),
4316 ffebld_constant_complex4 (ffebld_conter (l
)),
4317 ffebld_constant_complex4 (ffebld_conter (r
)));
4318 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_complex4_val
4319 (ffebld_cu_val_complex4 (u
)), expr
);
4324 assert ("bad complex kind type" == NULL
);
4330 assert ("bad type" == NULL
);
4334 ffebld_set_info (expr
, ffeinfo_new
4339 FFEINFO_whereCONSTANT
,
4340 FFETARGET_charactersizeNONE
));
4342 if ((error
!= FFEBAD
)
4343 && ffebad_start (error
))
4345 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
4352 /* ffeexpr_collapse_power -- Collapse power expr
4356 expr = ffeexpr_collapse_power(expr,token);
4358 If the result of the expr is a constant, replaces the expr with the
4359 computed constant. */
4362 ffeexpr_collapse_power (ffebld expr
, ffelexToken t
)
4364 ffebad error
= FFEBAD
;
4367 ffebldConstantUnion u
;
4368 ffeinfoBasictype bt
;
4371 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
4374 l
= ffebld_left (expr
);
4375 r
= ffebld_right (expr
);
4377 if (ffebld_op (l
) != FFEBLD_opCONTER
)
4379 if (ffebld_op (r
) != FFEBLD_opCONTER
)
4382 if ((ffeinfo_basictype (ffebld_info (r
)) != FFEINFO_basictypeINTEGER
)
4383 || (ffeinfo_kindtype (ffebld_info (r
)) != FFEINFO_kindtypeINTEGERDEFAULT
))
4386 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
4388 case FFEINFO_basictypeANY
:
4391 case FFEINFO_basictypeINTEGER
:
4392 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4394 case FFEINFO_kindtypeINTEGERDEFAULT
:
4395 error
= ffetarget_power_integerdefault_integerdefault
4396 (ffebld_cu_ptr_integerdefault (u
),
4397 ffebld_constant_integerdefault (ffebld_conter (l
)),
4398 ffebld_constant_integerdefault (ffebld_conter (r
)));
4399 expr
= ffebld_new_conter_with_orig
4400 (ffebld_constant_new_integerdefault_val
4401 (ffebld_cu_val_integerdefault (u
)), expr
);
4405 assert ("bad integer kind type" == NULL
);
4410 case FFEINFO_basictypeREAL
:
4411 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4413 case FFEINFO_kindtypeREALDEFAULT
:
4414 error
= ffetarget_power_realdefault_integerdefault
4415 (ffebld_cu_ptr_realdefault (u
),
4416 ffebld_constant_realdefault (ffebld_conter (l
)),
4417 ffebld_constant_integerdefault (ffebld_conter (r
)));
4418 expr
= ffebld_new_conter_with_orig
4419 (ffebld_constant_new_realdefault_val
4420 (ffebld_cu_val_realdefault (u
)), expr
);
4423 case FFEINFO_kindtypeREALDOUBLE
:
4424 error
= ffetarget_power_realdouble_integerdefault
4425 (ffebld_cu_ptr_realdouble (u
),
4426 ffebld_constant_realdouble (ffebld_conter (l
)),
4427 ffebld_constant_integerdefault (ffebld_conter (r
)));
4428 expr
= ffebld_new_conter_with_orig
4429 (ffebld_constant_new_realdouble_val
4430 (ffebld_cu_val_realdouble (u
)), expr
);
4433 #if FFETARGET_okREALQUAD
4434 case FFEINFO_kindtypeREALQUAD
:
4435 error
= ffetarget_power_realquad_integerdefault
4436 (ffebld_cu_ptr_realquad (u
),
4437 ffebld_constant_realquad (ffebld_conter (l
)),
4438 ffebld_constant_integerdefault (ffebld_conter (r
)));
4439 expr
= ffebld_new_conter_with_orig
4440 (ffebld_constant_new_realquad_val
4441 (ffebld_cu_val_realquad (u
)), expr
);
4445 assert ("bad real kind type" == NULL
);
4450 case FFEINFO_basictypeCOMPLEX
:
4451 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4453 case FFEINFO_kindtypeREALDEFAULT
:
4454 error
= ffetarget_power_complexdefault_integerdefault
4455 (ffebld_cu_ptr_complexdefault (u
),
4456 ffebld_constant_complexdefault (ffebld_conter (l
)),
4457 ffebld_constant_integerdefault (ffebld_conter (r
)));
4458 expr
= ffebld_new_conter_with_orig
4459 (ffebld_constant_new_complexdefault_val
4460 (ffebld_cu_val_complexdefault (u
)), expr
);
4463 #if FFETARGET_okCOMPLEXDOUBLE
4464 case FFEINFO_kindtypeREALDOUBLE
:
4465 error
= ffetarget_power_complexdouble_integerdefault
4466 (ffebld_cu_ptr_complexdouble (u
),
4467 ffebld_constant_complexdouble (ffebld_conter (l
)),
4468 ffebld_constant_integerdefault (ffebld_conter (r
)));
4469 expr
= ffebld_new_conter_with_orig
4470 (ffebld_constant_new_complexdouble_val
4471 (ffebld_cu_val_complexdouble (u
)), expr
);
4475 #if FFETARGET_okCOMPLEXQUAD
4476 case FFEINFO_kindtypeREALQUAD
:
4477 error
= ffetarget_power_complexquad_integerdefault
4478 (ffebld_cu_ptr_complexquad (u
),
4479 ffebld_constant_complexquad (ffebld_conter (l
)),
4480 ffebld_constant_integerdefault (ffebld_conter (r
)));
4481 expr
= ffebld_new_conter_with_orig
4482 (ffebld_constant_new_complexquad_val
4483 (ffebld_cu_val_complexquad (u
)), expr
);
4488 assert ("bad complex kind type" == NULL
);
4494 assert ("bad type" == NULL
);
4498 ffebld_set_info (expr
, ffeinfo_new
4503 FFEINFO_whereCONSTANT
,
4504 FFETARGET_charactersizeNONE
));
4506 if ((error
!= FFEBAD
)
4507 && ffebad_start (error
))
4509 ffebad_here (0, ffelex_token_where_line (t
),
4510 ffelex_token_where_column (t
));
4517 /* ffeexpr_collapse_concatenate -- Collapse concatenate expr
4521 expr = ffeexpr_collapse_concatenate(expr,token);
4523 If the result of the expr is a constant, replaces the expr with the
4524 computed constant. */
4527 ffeexpr_collapse_concatenate (ffebld expr
, ffelexToken t
)
4529 ffebad error
= FFEBAD
;
4532 ffebldConstantUnion u
;
4534 ffetargetCharacterSize len
;
4536 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
4539 l
= ffebld_left (expr
);
4540 r
= ffebld_right (expr
);
4542 if (ffebld_op (l
) != FFEBLD_opCONTER
)
4544 if (ffebld_op (r
) != FFEBLD_opCONTER
)
4547 switch (ffeinfo_basictype (ffebld_info (expr
)))
4549 case FFEINFO_basictypeANY
:
4552 case FFEINFO_basictypeCHARACTER
:
4553 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
4555 #if FFETARGET_okCHARACTER1
4556 case FFEINFO_kindtypeCHARACTER1
:
4557 error
= ffetarget_concatenate_character1 (ffebld_cu_ptr_character1 (u
),
4558 ffebld_constant_character1 (ffebld_conter (l
)),
4559 ffebld_constant_character1 (ffebld_conter (r
)),
4560 ffebld_constant_pool (), &len
);
4561 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character1_val
4562 (ffebld_cu_val_character1 (u
)), expr
);
4566 #if FFETARGET_okCHARACTER2
4567 case FFEINFO_kindtypeCHARACTER2
:
4568 error
= ffetarget_concatenate_character2 (ffebld_cu_ptr_character2 (u
),
4569 ffebld_constant_character2 (ffebld_conter (l
)),
4570 ffebld_constant_character2 (ffebld_conter (r
)),
4571 ffebld_constant_pool (), &len
);
4572 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character2_val
4573 (ffebld_cu_val_character2 (u
)), expr
);
4577 #if FFETARGET_okCHARACTER3
4578 case FFEINFO_kindtypeCHARACTER3
:
4579 error
= ffetarget_concatenate_character3 (ffebld_cu_ptr_character3 (u
),
4580 ffebld_constant_character3 (ffebld_conter (l
)),
4581 ffebld_constant_character3 (ffebld_conter (r
)),
4582 ffebld_constant_pool (), &len
);
4583 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character3_val
4584 (ffebld_cu_val_character3 (u
)), expr
);
4588 #if FFETARGET_okCHARACTER4
4589 case FFEINFO_kindtypeCHARACTER4
:
4590 error
= ffetarget_concatenate_character4 (ffebld_cu_ptr_character4 (u
),
4591 ffebld_constant_character4 (ffebld_conter (l
)),
4592 ffebld_constant_character4 (ffebld_conter (r
)),
4593 ffebld_constant_pool (), &len
);
4594 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character4_val
4595 (ffebld_cu_val_character4 (u
)), expr
);
4600 assert ("bad character kind type" == NULL
);
4606 assert ("bad type" == NULL
);
4610 ffebld_set_info (expr
, ffeinfo_new
4611 (FFEINFO_basictypeCHARACTER
,
4615 FFEINFO_whereCONSTANT
,
4618 if ((error
!= FFEBAD
)
4619 && ffebad_start (error
))
4621 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
4628 /* ffeexpr_collapse_eq -- Collapse eq expr
4632 expr = ffeexpr_collapse_eq(expr,token);
4634 If the result of the expr is a constant, replaces the expr with the
4635 computed constant. */
4638 ffeexpr_collapse_eq (ffebld expr
, ffelexToken t
)
4640 ffebad error
= FFEBAD
;
4645 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
4648 l
= ffebld_left (expr
);
4649 r
= ffebld_right (expr
);
4651 if (ffebld_op (l
) != FFEBLD_opCONTER
)
4653 if (ffebld_op (r
) != FFEBLD_opCONTER
)
4656 switch (ffeinfo_basictype (ffebld_info (ffebld_left (expr
))))
4658 case FFEINFO_basictypeANY
:
4661 case FFEINFO_basictypeINTEGER
:
4662 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
4664 #if FFETARGET_okINTEGER1
4665 case FFEINFO_kindtypeINTEGER1
:
4666 error
= ffetarget_eq_integer1 (&val
,
4667 ffebld_constant_integer1 (ffebld_conter (l
)),
4668 ffebld_constant_integer1 (ffebld_conter (r
)));
4669 expr
= ffebld_new_conter_with_orig
4670 (ffebld_constant_new_logicaldefault (val
), expr
);
4674 #if FFETARGET_okINTEGER2
4675 case FFEINFO_kindtypeINTEGER2
:
4676 error
= ffetarget_eq_integer2 (&val
,
4677 ffebld_constant_integer2 (ffebld_conter (l
)),
4678 ffebld_constant_integer2 (ffebld_conter (r
)));
4679 expr
= ffebld_new_conter_with_orig
4680 (ffebld_constant_new_logicaldefault (val
), expr
);
4684 #if FFETARGET_okINTEGER3
4685 case FFEINFO_kindtypeINTEGER3
:
4686 error
= ffetarget_eq_integer3 (&val
,
4687 ffebld_constant_integer3 (ffebld_conter (l
)),
4688 ffebld_constant_integer3 (ffebld_conter (r
)));
4689 expr
= ffebld_new_conter_with_orig
4690 (ffebld_constant_new_logicaldefault (val
), expr
);
4694 #if FFETARGET_okINTEGER4
4695 case FFEINFO_kindtypeINTEGER4
:
4696 error
= ffetarget_eq_integer4 (&val
,
4697 ffebld_constant_integer4 (ffebld_conter (l
)),
4698 ffebld_constant_integer4 (ffebld_conter (r
)));
4699 expr
= ffebld_new_conter_with_orig
4700 (ffebld_constant_new_logicaldefault (val
), expr
);
4705 assert ("bad integer kind type" == NULL
);
4710 case FFEINFO_basictypeREAL
:
4711 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
4713 #if FFETARGET_okREAL1
4714 case FFEINFO_kindtypeREAL1
:
4715 error
= ffetarget_eq_real1 (&val
,
4716 ffebld_constant_real1 (ffebld_conter (l
)),
4717 ffebld_constant_real1 (ffebld_conter (r
)));
4718 expr
= ffebld_new_conter_with_orig
4719 (ffebld_constant_new_logicaldefault (val
), expr
);
4723 #if FFETARGET_okREAL2
4724 case FFEINFO_kindtypeREAL2
:
4725 error
= ffetarget_eq_real2 (&val
,
4726 ffebld_constant_real2 (ffebld_conter (l
)),
4727 ffebld_constant_real2 (ffebld_conter (r
)));
4728 expr
= ffebld_new_conter_with_orig
4729 (ffebld_constant_new_logicaldefault (val
), expr
);
4733 #if FFETARGET_okREAL3
4734 case FFEINFO_kindtypeREAL3
:
4735 error
= ffetarget_eq_real3 (&val
,
4736 ffebld_constant_real3 (ffebld_conter (l
)),
4737 ffebld_constant_real3 (ffebld_conter (r
)));
4738 expr
= ffebld_new_conter_with_orig
4739 (ffebld_constant_new_logicaldefault (val
), expr
);
4743 #if FFETARGET_okREAL4
4744 case FFEINFO_kindtypeREAL4
:
4745 error
= ffetarget_eq_real4 (&val
,
4746 ffebld_constant_real4 (ffebld_conter (l
)),
4747 ffebld_constant_real4 (ffebld_conter (r
)));
4748 expr
= ffebld_new_conter_with_orig
4749 (ffebld_constant_new_logicaldefault (val
), expr
);
4754 assert ("bad real kind type" == NULL
);
4759 case FFEINFO_basictypeCOMPLEX
:
4760 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
4762 #if FFETARGET_okCOMPLEX1
4763 case FFEINFO_kindtypeREAL1
:
4764 error
= ffetarget_eq_complex1 (&val
,
4765 ffebld_constant_complex1 (ffebld_conter (l
)),
4766 ffebld_constant_complex1 (ffebld_conter (r
)));
4767 expr
= ffebld_new_conter_with_orig
4768 (ffebld_constant_new_logicaldefault (val
), expr
);
4772 #if FFETARGET_okCOMPLEX2
4773 case FFEINFO_kindtypeREAL2
:
4774 error
= ffetarget_eq_complex2 (&val
,
4775 ffebld_constant_complex2 (ffebld_conter (l
)),
4776 ffebld_constant_complex2 (ffebld_conter (r
)));
4777 expr
= ffebld_new_conter_with_orig
4778 (ffebld_constant_new_logicaldefault (val
), expr
);
4782 #if FFETARGET_okCOMPLEX3
4783 case FFEINFO_kindtypeREAL3
:
4784 error
= ffetarget_eq_complex3 (&val
,
4785 ffebld_constant_complex3 (ffebld_conter (l
)),
4786 ffebld_constant_complex3 (ffebld_conter (r
)));
4787 expr
= ffebld_new_conter_with_orig
4788 (ffebld_constant_new_logicaldefault (val
), expr
);
4792 #if FFETARGET_okCOMPLEX4
4793 case FFEINFO_kindtypeREAL4
:
4794 error
= ffetarget_eq_complex4 (&val
,
4795 ffebld_constant_complex4 (ffebld_conter (l
)),
4796 ffebld_constant_complex4 (ffebld_conter (r
)));
4797 expr
= ffebld_new_conter_with_orig
4798 (ffebld_constant_new_logicaldefault (val
), expr
);
4803 assert ("bad complex kind type" == NULL
);
4808 case FFEINFO_basictypeCHARACTER
:
4809 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
4811 #if FFETARGET_okCHARACTER1
4812 case FFEINFO_kindtypeCHARACTER1
:
4813 error
= ffetarget_eq_character1 (&val
,
4814 ffebld_constant_character1 (ffebld_conter (l
)),
4815 ffebld_constant_character1 (ffebld_conter (r
)));
4816 expr
= ffebld_new_conter_with_orig
4817 (ffebld_constant_new_logicaldefault (val
), expr
);
4821 #if FFETARGET_okCHARACTER2
4822 case FFEINFO_kindtypeCHARACTER2
:
4823 error
= ffetarget_eq_character2 (&val
,
4824 ffebld_constant_character2 (ffebld_conter (l
)),
4825 ffebld_constant_character2 (ffebld_conter (r
)));
4826 expr
= ffebld_new_conter_with_orig
4827 (ffebld_constant_new_logicaldefault (val
), expr
);
4831 #if FFETARGET_okCHARACTER3
4832 case FFEINFO_kindtypeCHARACTER3
:
4833 error
= ffetarget_eq_character3 (&val
,
4834 ffebld_constant_character3 (ffebld_conter (l
)),
4835 ffebld_constant_character3 (ffebld_conter (r
)));
4836 expr
= ffebld_new_conter_with_orig
4837 (ffebld_constant_new_logicaldefault (val
), expr
);
4841 #if FFETARGET_okCHARACTER4
4842 case FFEINFO_kindtypeCHARACTER4
:
4843 error
= ffetarget_eq_character4 (&val
,
4844 ffebld_constant_character4 (ffebld_conter (l
)),
4845 ffebld_constant_character4 (ffebld_conter (r
)));
4846 expr
= ffebld_new_conter_with_orig
4847 (ffebld_constant_new_logicaldefault (val
), expr
);
4852 assert ("bad character kind type" == NULL
);
4858 assert ("bad type" == NULL
);
4862 ffebld_set_info (expr
, ffeinfo_new
4863 (FFEINFO_basictypeLOGICAL
,
4864 FFEINFO_kindtypeLOGICALDEFAULT
,
4867 FFEINFO_whereCONSTANT
,
4868 FFETARGET_charactersizeNONE
));
4870 if ((error
!= FFEBAD
)
4871 && ffebad_start (error
))
4873 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
4880 /* ffeexpr_collapse_ne -- Collapse ne expr
4884 expr = ffeexpr_collapse_ne(expr,token);
4886 If the result of the expr is a constant, replaces the expr with the
4887 computed constant. */
4890 ffeexpr_collapse_ne (ffebld expr
, ffelexToken t
)
4892 ffebad error
= FFEBAD
;
4897 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
4900 l
= ffebld_left (expr
);
4901 r
= ffebld_right (expr
);
4903 if (ffebld_op (l
) != FFEBLD_opCONTER
)
4905 if (ffebld_op (r
) != FFEBLD_opCONTER
)
4908 switch (ffeinfo_basictype (ffebld_info (ffebld_left (expr
))))
4910 case FFEINFO_basictypeANY
:
4913 case FFEINFO_basictypeINTEGER
:
4914 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
4916 #if FFETARGET_okINTEGER1
4917 case FFEINFO_kindtypeINTEGER1
:
4918 error
= ffetarget_ne_integer1 (&val
,
4919 ffebld_constant_integer1 (ffebld_conter (l
)),
4920 ffebld_constant_integer1 (ffebld_conter (r
)));
4921 expr
= ffebld_new_conter_with_orig
4922 (ffebld_constant_new_logicaldefault (val
), expr
);
4926 #if FFETARGET_okINTEGER2
4927 case FFEINFO_kindtypeINTEGER2
:
4928 error
= ffetarget_ne_integer2 (&val
,
4929 ffebld_constant_integer2 (ffebld_conter (l
)),
4930 ffebld_constant_integer2 (ffebld_conter (r
)));
4931 expr
= ffebld_new_conter_with_orig
4932 (ffebld_constant_new_logicaldefault (val
), expr
);
4936 #if FFETARGET_okINTEGER3
4937 case FFEINFO_kindtypeINTEGER3
:
4938 error
= ffetarget_ne_integer3 (&val
,
4939 ffebld_constant_integer3 (ffebld_conter (l
)),
4940 ffebld_constant_integer3 (ffebld_conter (r
)));
4941 expr
= ffebld_new_conter_with_orig
4942 (ffebld_constant_new_logicaldefault (val
), expr
);
4946 #if FFETARGET_okINTEGER4
4947 case FFEINFO_kindtypeINTEGER4
:
4948 error
= ffetarget_ne_integer4 (&val
,
4949 ffebld_constant_integer4 (ffebld_conter (l
)),
4950 ffebld_constant_integer4 (ffebld_conter (r
)));
4951 expr
= ffebld_new_conter_with_orig
4952 (ffebld_constant_new_logicaldefault (val
), expr
);
4957 assert ("bad integer kind type" == NULL
);
4962 case FFEINFO_basictypeREAL
:
4963 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
4965 #if FFETARGET_okREAL1
4966 case FFEINFO_kindtypeREAL1
:
4967 error
= ffetarget_ne_real1 (&val
,
4968 ffebld_constant_real1 (ffebld_conter (l
)),
4969 ffebld_constant_real1 (ffebld_conter (r
)));
4970 expr
= ffebld_new_conter_with_orig
4971 (ffebld_constant_new_logicaldefault (val
), expr
);
4975 #if FFETARGET_okREAL2
4976 case FFEINFO_kindtypeREAL2
:
4977 error
= ffetarget_ne_real2 (&val
,
4978 ffebld_constant_real2 (ffebld_conter (l
)),
4979 ffebld_constant_real2 (ffebld_conter (r
)));
4980 expr
= ffebld_new_conter_with_orig
4981 (ffebld_constant_new_logicaldefault (val
), expr
);
4985 #if FFETARGET_okREAL3
4986 case FFEINFO_kindtypeREAL3
:
4987 error
= ffetarget_ne_real3 (&val
,
4988 ffebld_constant_real3 (ffebld_conter (l
)),
4989 ffebld_constant_real3 (ffebld_conter (r
)));
4990 expr
= ffebld_new_conter_with_orig
4991 (ffebld_constant_new_logicaldefault (val
), expr
);
4995 #if FFETARGET_okREAL4
4996 case FFEINFO_kindtypeREAL4
:
4997 error
= ffetarget_ne_real4 (&val
,
4998 ffebld_constant_real4 (ffebld_conter (l
)),
4999 ffebld_constant_real4 (ffebld_conter (r
)));
5000 expr
= ffebld_new_conter_with_orig
5001 (ffebld_constant_new_logicaldefault (val
), expr
);
5006 assert ("bad real kind type" == NULL
);
5011 case FFEINFO_basictypeCOMPLEX
:
5012 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5014 #if FFETARGET_okCOMPLEX1
5015 case FFEINFO_kindtypeREAL1
:
5016 error
= ffetarget_ne_complex1 (&val
,
5017 ffebld_constant_complex1 (ffebld_conter (l
)),
5018 ffebld_constant_complex1 (ffebld_conter (r
)));
5019 expr
= ffebld_new_conter_with_orig
5020 (ffebld_constant_new_logicaldefault (val
), expr
);
5024 #if FFETARGET_okCOMPLEX2
5025 case FFEINFO_kindtypeREAL2
:
5026 error
= ffetarget_ne_complex2 (&val
,
5027 ffebld_constant_complex2 (ffebld_conter (l
)),
5028 ffebld_constant_complex2 (ffebld_conter (r
)));
5029 expr
= ffebld_new_conter_with_orig
5030 (ffebld_constant_new_logicaldefault (val
), expr
);
5034 #if FFETARGET_okCOMPLEX3
5035 case FFEINFO_kindtypeREAL3
:
5036 error
= ffetarget_ne_complex3 (&val
,
5037 ffebld_constant_complex3 (ffebld_conter (l
)),
5038 ffebld_constant_complex3 (ffebld_conter (r
)));
5039 expr
= ffebld_new_conter_with_orig
5040 (ffebld_constant_new_logicaldefault (val
), expr
);
5044 #if FFETARGET_okCOMPLEX4
5045 case FFEINFO_kindtypeREAL4
:
5046 error
= ffetarget_ne_complex4 (&val
,
5047 ffebld_constant_complex4 (ffebld_conter (l
)),
5048 ffebld_constant_complex4 (ffebld_conter (r
)));
5049 expr
= ffebld_new_conter_with_orig
5050 (ffebld_constant_new_logicaldefault (val
), expr
);
5055 assert ("bad complex kind type" == NULL
);
5060 case FFEINFO_basictypeCHARACTER
:
5061 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5063 #if FFETARGET_okCHARACTER1
5064 case FFEINFO_kindtypeCHARACTER1
:
5065 error
= ffetarget_ne_character1 (&val
,
5066 ffebld_constant_character1 (ffebld_conter (l
)),
5067 ffebld_constant_character1 (ffebld_conter (r
)));
5068 expr
= ffebld_new_conter_with_orig
5069 (ffebld_constant_new_logicaldefault (val
), expr
);
5073 #if FFETARGET_okCHARACTER2
5074 case FFEINFO_kindtypeCHARACTER2
:
5075 error
= ffetarget_ne_character2 (&val
,
5076 ffebld_constant_character2 (ffebld_conter (l
)),
5077 ffebld_constant_character2 (ffebld_conter (r
)));
5078 expr
= ffebld_new_conter_with_orig
5079 (ffebld_constant_new_logicaldefault (val
), expr
);
5083 #if FFETARGET_okCHARACTER3
5084 case FFEINFO_kindtypeCHARACTER3
:
5085 error
= ffetarget_ne_character3 (&val
,
5086 ffebld_constant_character3 (ffebld_conter (l
)),
5087 ffebld_constant_character3 (ffebld_conter (r
)));
5088 expr
= ffebld_new_conter_with_orig
5089 (ffebld_constant_new_logicaldefault (val
), expr
);
5093 #if FFETARGET_okCHARACTER4
5094 case FFEINFO_kindtypeCHARACTER4
:
5095 error
= ffetarget_ne_character4 (&val
,
5096 ffebld_constant_character4 (ffebld_conter (l
)),
5097 ffebld_constant_character4 (ffebld_conter (r
)));
5098 expr
= ffebld_new_conter_with_orig
5099 (ffebld_constant_new_logicaldefault (val
), expr
);
5104 assert ("bad character kind type" == NULL
);
5110 assert ("bad type" == NULL
);
5114 ffebld_set_info (expr
, ffeinfo_new
5115 (FFEINFO_basictypeLOGICAL
,
5116 FFEINFO_kindtypeLOGICALDEFAULT
,
5119 FFEINFO_whereCONSTANT
,
5120 FFETARGET_charactersizeNONE
));
5122 if ((error
!= FFEBAD
)
5123 && ffebad_start (error
))
5125 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
5132 /* ffeexpr_collapse_ge -- Collapse ge expr
5136 expr = ffeexpr_collapse_ge(expr,token);
5138 If the result of the expr is a constant, replaces the expr with the
5139 computed constant. */
5142 ffeexpr_collapse_ge (ffebld expr
, ffelexToken t
)
5144 ffebad error
= FFEBAD
;
5149 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
5152 l
= ffebld_left (expr
);
5153 r
= ffebld_right (expr
);
5155 if (ffebld_op (l
) != FFEBLD_opCONTER
)
5157 if (ffebld_op (r
) != FFEBLD_opCONTER
)
5160 switch (ffeinfo_basictype (ffebld_info (ffebld_left (expr
))))
5162 case FFEINFO_basictypeANY
:
5165 case FFEINFO_basictypeINTEGER
:
5166 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5168 #if FFETARGET_okINTEGER1
5169 case FFEINFO_kindtypeINTEGER1
:
5170 error
= ffetarget_ge_integer1 (&val
,
5171 ffebld_constant_integer1 (ffebld_conter (l
)),
5172 ffebld_constant_integer1 (ffebld_conter (r
)));
5173 expr
= ffebld_new_conter_with_orig
5174 (ffebld_constant_new_logicaldefault (val
), expr
);
5178 #if FFETARGET_okINTEGER2
5179 case FFEINFO_kindtypeINTEGER2
:
5180 error
= ffetarget_ge_integer2 (&val
,
5181 ffebld_constant_integer2 (ffebld_conter (l
)),
5182 ffebld_constant_integer2 (ffebld_conter (r
)));
5183 expr
= ffebld_new_conter_with_orig
5184 (ffebld_constant_new_logicaldefault (val
), expr
);
5188 #if FFETARGET_okINTEGER3
5189 case FFEINFO_kindtypeINTEGER3
:
5190 error
= ffetarget_ge_integer3 (&val
,
5191 ffebld_constant_integer3 (ffebld_conter (l
)),
5192 ffebld_constant_integer3 (ffebld_conter (r
)));
5193 expr
= ffebld_new_conter_with_orig
5194 (ffebld_constant_new_logicaldefault (val
), expr
);
5198 #if FFETARGET_okINTEGER4
5199 case FFEINFO_kindtypeINTEGER4
:
5200 error
= ffetarget_ge_integer4 (&val
,
5201 ffebld_constant_integer4 (ffebld_conter (l
)),
5202 ffebld_constant_integer4 (ffebld_conter (r
)));
5203 expr
= ffebld_new_conter_with_orig
5204 (ffebld_constant_new_logicaldefault (val
), expr
);
5209 assert ("bad integer kind type" == NULL
);
5214 case FFEINFO_basictypeREAL
:
5215 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5217 #if FFETARGET_okREAL1
5218 case FFEINFO_kindtypeREAL1
:
5219 error
= ffetarget_ge_real1 (&val
,
5220 ffebld_constant_real1 (ffebld_conter (l
)),
5221 ffebld_constant_real1 (ffebld_conter (r
)));
5222 expr
= ffebld_new_conter_with_orig
5223 (ffebld_constant_new_logicaldefault (val
), expr
);
5227 #if FFETARGET_okREAL2
5228 case FFEINFO_kindtypeREAL2
:
5229 error
= ffetarget_ge_real2 (&val
,
5230 ffebld_constant_real2 (ffebld_conter (l
)),
5231 ffebld_constant_real2 (ffebld_conter (r
)));
5232 expr
= ffebld_new_conter_with_orig
5233 (ffebld_constant_new_logicaldefault (val
), expr
);
5237 #if FFETARGET_okREAL3
5238 case FFEINFO_kindtypeREAL3
:
5239 error
= ffetarget_ge_real3 (&val
,
5240 ffebld_constant_real3 (ffebld_conter (l
)),
5241 ffebld_constant_real3 (ffebld_conter (r
)));
5242 expr
= ffebld_new_conter_with_orig
5243 (ffebld_constant_new_logicaldefault (val
), expr
);
5247 #if FFETARGET_okREAL4
5248 case FFEINFO_kindtypeREAL4
:
5249 error
= ffetarget_ge_real4 (&val
,
5250 ffebld_constant_real4 (ffebld_conter (l
)),
5251 ffebld_constant_real4 (ffebld_conter (r
)));
5252 expr
= ffebld_new_conter_with_orig
5253 (ffebld_constant_new_logicaldefault (val
), expr
);
5258 assert ("bad real kind type" == NULL
);
5263 case FFEINFO_basictypeCHARACTER
:
5264 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5266 #if FFETARGET_okCHARACTER1
5267 case FFEINFO_kindtypeCHARACTER1
:
5268 error
= ffetarget_ge_character1 (&val
,
5269 ffebld_constant_character1 (ffebld_conter (l
)),
5270 ffebld_constant_character1 (ffebld_conter (r
)));
5271 expr
= ffebld_new_conter_with_orig
5272 (ffebld_constant_new_logicaldefault (val
), expr
);
5276 #if FFETARGET_okCHARACTER2
5277 case FFEINFO_kindtypeCHARACTER2
:
5278 error
= ffetarget_ge_character2 (&val
,
5279 ffebld_constant_character2 (ffebld_conter (l
)),
5280 ffebld_constant_character2 (ffebld_conter (r
)));
5281 expr
= ffebld_new_conter_with_orig
5282 (ffebld_constant_new_logicaldefault (val
), expr
);
5286 #if FFETARGET_okCHARACTER3
5287 case FFEINFO_kindtypeCHARACTER3
:
5288 error
= ffetarget_ge_character3 (&val
,
5289 ffebld_constant_character3 (ffebld_conter (l
)),
5290 ffebld_constant_character3 (ffebld_conter (r
)));
5291 expr
= ffebld_new_conter_with_orig
5292 (ffebld_constant_new_logicaldefault (val
), expr
);
5296 #if FFETARGET_okCHARACTER4
5297 case FFEINFO_kindtypeCHARACTER4
:
5298 error
= ffetarget_ge_character4 (&val
,
5299 ffebld_constant_character4 (ffebld_conter (l
)),
5300 ffebld_constant_character4 (ffebld_conter (r
)));
5301 expr
= ffebld_new_conter_with_orig
5302 (ffebld_constant_new_logicaldefault (val
), expr
);
5307 assert ("bad character kind type" == NULL
);
5313 assert ("bad type" == NULL
);
5317 ffebld_set_info (expr
, ffeinfo_new
5318 (FFEINFO_basictypeLOGICAL
,
5319 FFEINFO_kindtypeLOGICALDEFAULT
,
5322 FFEINFO_whereCONSTANT
,
5323 FFETARGET_charactersizeNONE
));
5325 if ((error
!= FFEBAD
)
5326 && ffebad_start (error
))
5328 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
5335 /* ffeexpr_collapse_gt -- Collapse gt expr
5339 expr = ffeexpr_collapse_gt(expr,token);
5341 If the result of the expr is a constant, replaces the expr with the
5342 computed constant. */
5345 ffeexpr_collapse_gt (ffebld expr
, ffelexToken t
)
5347 ffebad error
= FFEBAD
;
5352 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
5355 l
= ffebld_left (expr
);
5356 r
= ffebld_right (expr
);
5358 if (ffebld_op (l
) != FFEBLD_opCONTER
)
5360 if (ffebld_op (r
) != FFEBLD_opCONTER
)
5363 switch (ffeinfo_basictype (ffebld_info (ffebld_left (expr
))))
5365 case FFEINFO_basictypeANY
:
5368 case FFEINFO_basictypeINTEGER
:
5369 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5371 #if FFETARGET_okINTEGER1
5372 case FFEINFO_kindtypeINTEGER1
:
5373 error
= ffetarget_gt_integer1 (&val
,
5374 ffebld_constant_integer1 (ffebld_conter (l
)),
5375 ffebld_constant_integer1 (ffebld_conter (r
)));
5376 expr
= ffebld_new_conter_with_orig
5377 (ffebld_constant_new_logicaldefault (val
), expr
);
5381 #if FFETARGET_okINTEGER2
5382 case FFEINFO_kindtypeINTEGER2
:
5383 error
= ffetarget_gt_integer2 (&val
,
5384 ffebld_constant_integer2 (ffebld_conter (l
)),
5385 ffebld_constant_integer2 (ffebld_conter (r
)));
5386 expr
= ffebld_new_conter_with_orig
5387 (ffebld_constant_new_logicaldefault (val
), expr
);
5391 #if FFETARGET_okINTEGER3
5392 case FFEINFO_kindtypeINTEGER3
:
5393 error
= ffetarget_gt_integer3 (&val
,
5394 ffebld_constant_integer3 (ffebld_conter (l
)),
5395 ffebld_constant_integer3 (ffebld_conter (r
)));
5396 expr
= ffebld_new_conter_with_orig
5397 (ffebld_constant_new_logicaldefault (val
), expr
);
5401 #if FFETARGET_okINTEGER4
5402 case FFEINFO_kindtypeINTEGER4
:
5403 error
= ffetarget_gt_integer4 (&val
,
5404 ffebld_constant_integer4 (ffebld_conter (l
)),
5405 ffebld_constant_integer4 (ffebld_conter (r
)));
5406 expr
= ffebld_new_conter_with_orig
5407 (ffebld_constant_new_logicaldefault (val
), expr
);
5412 assert ("bad integer kind type" == NULL
);
5417 case FFEINFO_basictypeREAL
:
5418 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5420 #if FFETARGET_okREAL1
5421 case FFEINFO_kindtypeREAL1
:
5422 error
= ffetarget_gt_real1 (&val
,
5423 ffebld_constant_real1 (ffebld_conter (l
)),
5424 ffebld_constant_real1 (ffebld_conter (r
)));
5425 expr
= ffebld_new_conter_with_orig
5426 (ffebld_constant_new_logicaldefault (val
), expr
);
5430 #if FFETARGET_okREAL2
5431 case FFEINFO_kindtypeREAL2
:
5432 error
= ffetarget_gt_real2 (&val
,
5433 ffebld_constant_real2 (ffebld_conter (l
)),
5434 ffebld_constant_real2 (ffebld_conter (r
)));
5435 expr
= ffebld_new_conter_with_orig
5436 (ffebld_constant_new_logicaldefault (val
), expr
);
5440 #if FFETARGET_okREAL3
5441 case FFEINFO_kindtypeREAL3
:
5442 error
= ffetarget_gt_real3 (&val
,
5443 ffebld_constant_real3 (ffebld_conter (l
)),
5444 ffebld_constant_real3 (ffebld_conter (r
)));
5445 expr
= ffebld_new_conter_with_orig
5446 (ffebld_constant_new_logicaldefault (val
), expr
);
5450 #if FFETARGET_okREAL4
5451 case FFEINFO_kindtypeREAL4
:
5452 error
= ffetarget_gt_real4 (&val
,
5453 ffebld_constant_real4 (ffebld_conter (l
)),
5454 ffebld_constant_real4 (ffebld_conter (r
)));
5455 expr
= ffebld_new_conter_with_orig
5456 (ffebld_constant_new_logicaldefault (val
), expr
);
5461 assert ("bad real kind type" == NULL
);
5466 case FFEINFO_basictypeCHARACTER
:
5467 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5469 #if FFETARGET_okCHARACTER1
5470 case FFEINFO_kindtypeCHARACTER1
:
5471 error
= ffetarget_gt_character1 (&val
,
5472 ffebld_constant_character1 (ffebld_conter (l
)),
5473 ffebld_constant_character1 (ffebld_conter (r
)));
5474 expr
= ffebld_new_conter_with_orig
5475 (ffebld_constant_new_logicaldefault (val
), expr
);
5479 #if FFETARGET_okCHARACTER2
5480 case FFEINFO_kindtypeCHARACTER2
:
5481 error
= ffetarget_gt_character2 (&val
,
5482 ffebld_constant_character2 (ffebld_conter (l
)),
5483 ffebld_constant_character2 (ffebld_conter (r
)));
5484 expr
= ffebld_new_conter_with_orig
5485 (ffebld_constant_new_logicaldefault (val
), expr
);
5489 #if FFETARGET_okCHARACTER3
5490 case FFEINFO_kindtypeCHARACTER3
:
5491 error
= ffetarget_gt_character3 (&val
,
5492 ffebld_constant_character3 (ffebld_conter (l
)),
5493 ffebld_constant_character3 (ffebld_conter (r
)));
5494 expr
= ffebld_new_conter_with_orig
5495 (ffebld_constant_new_logicaldefault (val
), expr
);
5499 #if FFETARGET_okCHARACTER4
5500 case FFEINFO_kindtypeCHARACTER4
:
5501 error
= ffetarget_gt_character4 (&val
,
5502 ffebld_constant_character4 (ffebld_conter (l
)),
5503 ffebld_constant_character4 (ffebld_conter (r
)));
5504 expr
= ffebld_new_conter_with_orig
5505 (ffebld_constant_new_logicaldefault (val
), expr
);
5510 assert ("bad character kind type" == NULL
);
5516 assert ("bad type" == NULL
);
5520 ffebld_set_info (expr
, ffeinfo_new
5521 (FFEINFO_basictypeLOGICAL
,
5522 FFEINFO_kindtypeLOGICALDEFAULT
,
5525 FFEINFO_whereCONSTANT
,
5526 FFETARGET_charactersizeNONE
));
5528 if ((error
!= FFEBAD
)
5529 && ffebad_start (error
))
5531 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
5538 /* ffeexpr_collapse_le -- Collapse le expr
5542 expr = ffeexpr_collapse_le(expr,token);
5544 If the result of the expr is a constant, replaces the expr with the
5545 computed constant. */
5548 ffeexpr_collapse_le (ffebld expr
, ffelexToken t
)
5550 ffebad error
= FFEBAD
;
5555 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
5558 l
= ffebld_left (expr
);
5559 r
= ffebld_right (expr
);
5561 if (ffebld_op (l
) != FFEBLD_opCONTER
)
5563 if (ffebld_op (r
) != FFEBLD_opCONTER
)
5566 switch (ffeinfo_basictype (ffebld_info (ffebld_left (expr
))))
5568 case FFEINFO_basictypeANY
:
5571 case FFEINFO_basictypeINTEGER
:
5572 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5574 #if FFETARGET_okINTEGER1
5575 case FFEINFO_kindtypeINTEGER1
:
5576 error
= ffetarget_le_integer1 (&val
,
5577 ffebld_constant_integer1 (ffebld_conter (l
)),
5578 ffebld_constant_integer1 (ffebld_conter (r
)));
5579 expr
= ffebld_new_conter_with_orig
5580 (ffebld_constant_new_logicaldefault (val
), expr
);
5584 #if FFETARGET_okINTEGER2
5585 case FFEINFO_kindtypeINTEGER2
:
5586 error
= ffetarget_le_integer2 (&val
,
5587 ffebld_constant_integer2 (ffebld_conter (l
)),
5588 ffebld_constant_integer2 (ffebld_conter (r
)));
5589 expr
= ffebld_new_conter_with_orig
5590 (ffebld_constant_new_logicaldefault (val
), expr
);
5594 #if FFETARGET_okINTEGER3
5595 case FFEINFO_kindtypeINTEGER3
:
5596 error
= ffetarget_le_integer3 (&val
,
5597 ffebld_constant_integer3 (ffebld_conter (l
)),
5598 ffebld_constant_integer3 (ffebld_conter (r
)));
5599 expr
= ffebld_new_conter_with_orig
5600 (ffebld_constant_new_logicaldefault (val
), expr
);
5604 #if FFETARGET_okINTEGER4
5605 case FFEINFO_kindtypeINTEGER4
:
5606 error
= ffetarget_le_integer4 (&val
,
5607 ffebld_constant_integer4 (ffebld_conter (l
)),
5608 ffebld_constant_integer4 (ffebld_conter (r
)));
5609 expr
= ffebld_new_conter_with_orig
5610 (ffebld_constant_new_logicaldefault (val
), expr
);
5615 assert ("bad integer kind type" == NULL
);
5620 case FFEINFO_basictypeREAL
:
5621 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5623 #if FFETARGET_okREAL1
5624 case FFEINFO_kindtypeREAL1
:
5625 error
= ffetarget_le_real1 (&val
,
5626 ffebld_constant_real1 (ffebld_conter (l
)),
5627 ffebld_constant_real1 (ffebld_conter (r
)));
5628 expr
= ffebld_new_conter_with_orig
5629 (ffebld_constant_new_logicaldefault (val
), expr
);
5633 #if FFETARGET_okREAL2
5634 case FFEINFO_kindtypeREAL2
:
5635 error
= ffetarget_le_real2 (&val
,
5636 ffebld_constant_real2 (ffebld_conter (l
)),
5637 ffebld_constant_real2 (ffebld_conter (r
)));
5638 expr
= ffebld_new_conter_with_orig
5639 (ffebld_constant_new_logicaldefault (val
), expr
);
5643 #if FFETARGET_okREAL3
5644 case FFEINFO_kindtypeREAL3
:
5645 error
= ffetarget_le_real3 (&val
,
5646 ffebld_constant_real3 (ffebld_conter (l
)),
5647 ffebld_constant_real3 (ffebld_conter (r
)));
5648 expr
= ffebld_new_conter_with_orig
5649 (ffebld_constant_new_logicaldefault (val
), expr
);
5653 #if FFETARGET_okREAL4
5654 case FFEINFO_kindtypeREAL4
:
5655 error
= ffetarget_le_real4 (&val
,
5656 ffebld_constant_real4 (ffebld_conter (l
)),
5657 ffebld_constant_real4 (ffebld_conter (r
)));
5658 expr
= ffebld_new_conter_with_orig
5659 (ffebld_constant_new_logicaldefault (val
), expr
);
5664 assert ("bad real kind type" == NULL
);
5669 case FFEINFO_basictypeCHARACTER
:
5670 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5672 #if FFETARGET_okCHARACTER1
5673 case FFEINFO_kindtypeCHARACTER1
:
5674 error
= ffetarget_le_character1 (&val
,
5675 ffebld_constant_character1 (ffebld_conter (l
)),
5676 ffebld_constant_character1 (ffebld_conter (r
)));
5677 expr
= ffebld_new_conter_with_orig
5678 (ffebld_constant_new_logicaldefault (val
), expr
);
5682 #if FFETARGET_okCHARACTER2
5683 case FFEINFO_kindtypeCHARACTER2
:
5684 error
= ffetarget_le_character2 (&val
,
5685 ffebld_constant_character2 (ffebld_conter (l
)),
5686 ffebld_constant_character2 (ffebld_conter (r
)));
5687 expr
= ffebld_new_conter_with_orig
5688 (ffebld_constant_new_logicaldefault (val
), expr
);
5692 #if FFETARGET_okCHARACTER3
5693 case FFEINFO_kindtypeCHARACTER3
:
5694 error
= ffetarget_le_character3 (&val
,
5695 ffebld_constant_character3 (ffebld_conter (l
)),
5696 ffebld_constant_character3 (ffebld_conter (r
)));
5697 expr
= ffebld_new_conter_with_orig
5698 (ffebld_constant_new_logicaldefault (val
), expr
);
5702 #if FFETARGET_okCHARACTER4
5703 case FFEINFO_kindtypeCHARACTER4
:
5704 error
= ffetarget_le_character4 (&val
,
5705 ffebld_constant_character4 (ffebld_conter (l
)),
5706 ffebld_constant_character4 (ffebld_conter (r
)));
5707 expr
= ffebld_new_conter_with_orig
5708 (ffebld_constant_new_logicaldefault (val
), expr
);
5713 assert ("bad character kind type" == NULL
);
5719 assert ("bad type" == NULL
);
5723 ffebld_set_info (expr
, ffeinfo_new
5724 (FFEINFO_basictypeLOGICAL
,
5725 FFEINFO_kindtypeLOGICALDEFAULT
,
5728 FFEINFO_whereCONSTANT
,
5729 FFETARGET_charactersizeNONE
));
5731 if ((error
!= FFEBAD
)
5732 && ffebad_start (error
))
5734 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
5741 /* ffeexpr_collapse_lt -- Collapse lt expr
5745 expr = ffeexpr_collapse_lt(expr,token);
5747 If the result of the expr is a constant, replaces the expr with the
5748 computed constant. */
5751 ffeexpr_collapse_lt (ffebld expr
, ffelexToken t
)
5753 ffebad error
= FFEBAD
;
5758 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
5761 l
= ffebld_left (expr
);
5762 r
= ffebld_right (expr
);
5764 if (ffebld_op (l
) != FFEBLD_opCONTER
)
5766 if (ffebld_op (r
) != FFEBLD_opCONTER
)
5769 switch (ffeinfo_basictype (ffebld_info (ffebld_left (expr
))))
5771 case FFEINFO_basictypeANY
:
5774 case FFEINFO_basictypeINTEGER
:
5775 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5777 #if FFETARGET_okINTEGER1
5778 case FFEINFO_kindtypeINTEGER1
:
5779 error
= ffetarget_lt_integer1 (&val
,
5780 ffebld_constant_integer1 (ffebld_conter (l
)),
5781 ffebld_constant_integer1 (ffebld_conter (r
)));
5782 expr
= ffebld_new_conter_with_orig
5783 (ffebld_constant_new_logicaldefault (val
), expr
);
5787 #if FFETARGET_okINTEGER2
5788 case FFEINFO_kindtypeINTEGER2
:
5789 error
= ffetarget_lt_integer2 (&val
,
5790 ffebld_constant_integer2 (ffebld_conter (l
)),
5791 ffebld_constant_integer2 (ffebld_conter (r
)));
5792 expr
= ffebld_new_conter_with_orig
5793 (ffebld_constant_new_logicaldefault (val
), expr
);
5797 #if FFETARGET_okINTEGER3
5798 case FFEINFO_kindtypeINTEGER3
:
5799 error
= ffetarget_lt_integer3 (&val
,
5800 ffebld_constant_integer3 (ffebld_conter (l
)),
5801 ffebld_constant_integer3 (ffebld_conter (r
)));
5802 expr
= ffebld_new_conter_with_orig
5803 (ffebld_constant_new_logicaldefault (val
), expr
);
5807 #if FFETARGET_okINTEGER4
5808 case FFEINFO_kindtypeINTEGER4
:
5809 error
= ffetarget_lt_integer4 (&val
,
5810 ffebld_constant_integer4 (ffebld_conter (l
)),
5811 ffebld_constant_integer4 (ffebld_conter (r
)));
5812 expr
= ffebld_new_conter_with_orig
5813 (ffebld_constant_new_logicaldefault (val
), expr
);
5818 assert ("bad integer kind type" == NULL
);
5823 case FFEINFO_basictypeREAL
:
5824 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5826 #if FFETARGET_okREAL1
5827 case FFEINFO_kindtypeREAL1
:
5828 error
= ffetarget_lt_real1 (&val
,
5829 ffebld_constant_real1 (ffebld_conter (l
)),
5830 ffebld_constant_real1 (ffebld_conter (r
)));
5831 expr
= ffebld_new_conter_with_orig
5832 (ffebld_constant_new_logicaldefault (val
), expr
);
5836 #if FFETARGET_okREAL2
5837 case FFEINFO_kindtypeREAL2
:
5838 error
= ffetarget_lt_real2 (&val
,
5839 ffebld_constant_real2 (ffebld_conter (l
)),
5840 ffebld_constant_real2 (ffebld_conter (r
)));
5841 expr
= ffebld_new_conter_with_orig
5842 (ffebld_constant_new_logicaldefault (val
), expr
);
5846 #if FFETARGET_okREAL3
5847 case FFEINFO_kindtypeREAL3
:
5848 error
= ffetarget_lt_real3 (&val
,
5849 ffebld_constant_real3 (ffebld_conter (l
)),
5850 ffebld_constant_real3 (ffebld_conter (r
)));
5851 expr
= ffebld_new_conter_with_orig
5852 (ffebld_constant_new_logicaldefault (val
), expr
);
5856 #if FFETARGET_okREAL4
5857 case FFEINFO_kindtypeREAL4
:
5858 error
= ffetarget_lt_real4 (&val
,
5859 ffebld_constant_real4 (ffebld_conter (l
)),
5860 ffebld_constant_real4 (ffebld_conter (r
)));
5861 expr
= ffebld_new_conter_with_orig
5862 (ffebld_constant_new_logicaldefault (val
), expr
);
5867 assert ("bad real kind type" == NULL
);
5872 case FFEINFO_basictypeCHARACTER
:
5873 switch (ffeinfo_kindtype (ffebld_info (ffebld_left (expr
))))
5875 #if FFETARGET_okCHARACTER1
5876 case FFEINFO_kindtypeCHARACTER1
:
5877 error
= ffetarget_lt_character1 (&val
,
5878 ffebld_constant_character1 (ffebld_conter (l
)),
5879 ffebld_constant_character1 (ffebld_conter (r
)));
5880 expr
= ffebld_new_conter_with_orig
5881 (ffebld_constant_new_logicaldefault (val
), expr
);
5885 #if FFETARGET_okCHARACTER2
5886 case FFEINFO_kindtypeCHARACTER2
:
5887 error
= ffetarget_lt_character2 (&val
,
5888 ffebld_constant_character2 (ffebld_conter (l
)),
5889 ffebld_constant_character2 (ffebld_conter (r
)));
5890 expr
= ffebld_new_conter_with_orig
5891 (ffebld_constant_new_logicaldefault (val
), expr
);
5895 #if FFETARGET_okCHARACTER3
5896 case FFEINFO_kindtypeCHARACTER3
:
5897 error
= ffetarget_lt_character3 (&val
,
5898 ffebld_constant_character3 (ffebld_conter (l
)),
5899 ffebld_constant_character3 (ffebld_conter (r
)));
5900 expr
= ffebld_new_conter_with_orig
5901 (ffebld_constant_new_logicaldefault (val
), expr
);
5905 #if FFETARGET_okCHARACTER4
5906 case FFEINFO_kindtypeCHARACTER4
:
5907 error
= ffetarget_lt_character4 (&val
,
5908 ffebld_constant_character4 (ffebld_conter (l
)),
5909 ffebld_constant_character4 (ffebld_conter (r
)));
5910 expr
= ffebld_new_conter_with_orig
5911 (ffebld_constant_new_logicaldefault (val
), expr
);
5916 assert ("bad character kind type" == NULL
);
5922 assert ("bad type" == NULL
);
5926 ffebld_set_info (expr
, ffeinfo_new
5927 (FFEINFO_basictypeLOGICAL
,
5928 FFEINFO_kindtypeLOGICALDEFAULT
,
5931 FFEINFO_whereCONSTANT
,
5932 FFETARGET_charactersizeNONE
));
5934 if ((error
!= FFEBAD
)
5935 && ffebad_start (error
))
5937 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
5944 /* ffeexpr_collapse_and -- Collapse and expr
5948 expr = ffeexpr_collapse_and(expr,token);
5950 If the result of the expr is a constant, replaces the expr with the
5951 computed constant. */
5954 ffeexpr_collapse_and (ffebld expr
, ffelexToken t
)
5956 ffebad error
= FFEBAD
;
5959 ffebldConstantUnion u
;
5960 ffeinfoBasictype bt
;
5963 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
5966 l
= ffebld_left (expr
);
5967 r
= ffebld_right (expr
);
5969 if (ffebld_op (l
) != FFEBLD_opCONTER
)
5971 if (ffebld_op (r
) != FFEBLD_opCONTER
)
5974 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
5976 case FFEINFO_basictypeANY
:
5979 case FFEINFO_basictypeINTEGER
:
5980 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
5982 #if FFETARGET_okINTEGER1
5983 case FFEINFO_kindtypeINTEGER1
:
5984 error
= ffetarget_and_integer1 (ffebld_cu_ptr_integer1 (u
),
5985 ffebld_constant_integer1 (ffebld_conter (l
)),
5986 ffebld_constant_integer1 (ffebld_conter (r
)));
5987 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
5988 (ffebld_cu_val_integer1 (u
)), expr
);
5992 #if FFETARGET_okINTEGER2
5993 case FFEINFO_kindtypeINTEGER2
:
5994 error
= ffetarget_and_integer2 (ffebld_cu_ptr_integer2 (u
),
5995 ffebld_constant_integer2 (ffebld_conter (l
)),
5996 ffebld_constant_integer2 (ffebld_conter (r
)));
5997 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
5998 (ffebld_cu_val_integer2 (u
)), expr
);
6002 #if FFETARGET_okINTEGER3
6003 case FFEINFO_kindtypeINTEGER3
:
6004 error
= ffetarget_and_integer3 (ffebld_cu_ptr_integer3 (u
),
6005 ffebld_constant_integer3 (ffebld_conter (l
)),
6006 ffebld_constant_integer3 (ffebld_conter (r
)));
6007 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
6008 (ffebld_cu_val_integer3 (u
)), expr
);
6012 #if FFETARGET_okINTEGER4
6013 case FFEINFO_kindtypeINTEGER4
:
6014 error
= ffetarget_and_integer4 (ffebld_cu_ptr_integer4 (u
),
6015 ffebld_constant_integer4 (ffebld_conter (l
)),
6016 ffebld_constant_integer4 (ffebld_conter (r
)));
6017 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
6018 (ffebld_cu_val_integer4 (u
)), expr
);
6023 assert ("bad integer kind type" == NULL
);
6028 case FFEINFO_basictypeLOGICAL
:
6029 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6031 #if FFETARGET_okLOGICAL1
6032 case FFEINFO_kindtypeLOGICAL1
:
6033 error
= ffetarget_and_logical1 (ffebld_cu_ptr_logical1 (u
),
6034 ffebld_constant_logical1 (ffebld_conter (l
)),
6035 ffebld_constant_logical1 (ffebld_conter (r
)));
6036 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical1_val
6037 (ffebld_cu_val_logical1 (u
)), expr
);
6041 #if FFETARGET_okLOGICAL2
6042 case FFEINFO_kindtypeLOGICAL2
:
6043 error
= ffetarget_and_logical2 (ffebld_cu_ptr_logical2 (u
),
6044 ffebld_constant_logical2 (ffebld_conter (l
)),
6045 ffebld_constant_logical2 (ffebld_conter (r
)));
6046 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical2_val
6047 (ffebld_cu_val_logical2 (u
)), expr
);
6051 #if FFETARGET_okLOGICAL3
6052 case FFEINFO_kindtypeLOGICAL3
:
6053 error
= ffetarget_and_logical3 (ffebld_cu_ptr_logical3 (u
),
6054 ffebld_constant_logical3 (ffebld_conter (l
)),
6055 ffebld_constant_logical3 (ffebld_conter (r
)));
6056 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical3_val
6057 (ffebld_cu_val_logical3 (u
)), expr
);
6061 #if FFETARGET_okLOGICAL4
6062 case FFEINFO_kindtypeLOGICAL4
:
6063 error
= ffetarget_and_logical4 (ffebld_cu_ptr_logical4 (u
),
6064 ffebld_constant_logical4 (ffebld_conter (l
)),
6065 ffebld_constant_logical4 (ffebld_conter (r
)));
6066 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical4_val
6067 (ffebld_cu_val_logical4 (u
)), expr
);
6072 assert ("bad logical kind type" == NULL
);
6078 assert ("bad type" == NULL
);
6082 ffebld_set_info (expr
, ffeinfo_new
6087 FFEINFO_whereCONSTANT
,
6088 FFETARGET_charactersizeNONE
));
6090 if ((error
!= FFEBAD
)
6091 && ffebad_start (error
))
6093 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
6100 /* ffeexpr_collapse_or -- Collapse or expr
6104 expr = ffeexpr_collapse_or(expr,token);
6106 If the result of the expr is a constant, replaces the expr with the
6107 computed constant. */
6110 ffeexpr_collapse_or (ffebld expr
, ffelexToken t
)
6112 ffebad error
= FFEBAD
;
6115 ffebldConstantUnion u
;
6116 ffeinfoBasictype bt
;
6119 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
6122 l
= ffebld_left (expr
);
6123 r
= ffebld_right (expr
);
6125 if (ffebld_op (l
) != FFEBLD_opCONTER
)
6127 if (ffebld_op (r
) != FFEBLD_opCONTER
)
6130 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
6132 case FFEINFO_basictypeANY
:
6135 case FFEINFO_basictypeINTEGER
:
6136 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6138 #if FFETARGET_okINTEGER1
6139 case FFEINFO_kindtypeINTEGER1
:
6140 error
= ffetarget_or_integer1 (ffebld_cu_ptr_integer1 (u
),
6141 ffebld_constant_integer1 (ffebld_conter (l
)),
6142 ffebld_constant_integer1 (ffebld_conter (r
)));
6143 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
6144 (ffebld_cu_val_integer1 (u
)), expr
);
6148 #if FFETARGET_okINTEGER2
6149 case FFEINFO_kindtypeINTEGER2
:
6150 error
= ffetarget_or_integer2 (ffebld_cu_ptr_integer2 (u
),
6151 ffebld_constant_integer2 (ffebld_conter (l
)),
6152 ffebld_constant_integer2 (ffebld_conter (r
)));
6153 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
6154 (ffebld_cu_val_integer2 (u
)), expr
);
6158 #if FFETARGET_okINTEGER3
6159 case FFEINFO_kindtypeINTEGER3
:
6160 error
= ffetarget_or_integer3 (ffebld_cu_ptr_integer3 (u
),
6161 ffebld_constant_integer3 (ffebld_conter (l
)),
6162 ffebld_constant_integer3 (ffebld_conter (r
)));
6163 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
6164 (ffebld_cu_val_integer3 (u
)), expr
);
6168 #if FFETARGET_okINTEGER4
6169 case FFEINFO_kindtypeINTEGER4
:
6170 error
= ffetarget_or_integer4 (ffebld_cu_ptr_integer4 (u
),
6171 ffebld_constant_integer4 (ffebld_conter (l
)),
6172 ffebld_constant_integer4 (ffebld_conter (r
)));
6173 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
6174 (ffebld_cu_val_integer4 (u
)), expr
);
6179 assert ("bad integer kind type" == NULL
);
6184 case FFEINFO_basictypeLOGICAL
:
6185 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6187 #if FFETARGET_okLOGICAL1
6188 case FFEINFO_kindtypeLOGICAL1
:
6189 error
= ffetarget_or_logical1 (ffebld_cu_ptr_logical1 (u
),
6190 ffebld_constant_logical1 (ffebld_conter (l
)),
6191 ffebld_constant_logical1 (ffebld_conter (r
)));
6192 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical1_val
6193 (ffebld_cu_val_logical1 (u
)), expr
);
6197 #if FFETARGET_okLOGICAL2
6198 case FFEINFO_kindtypeLOGICAL2
:
6199 error
= ffetarget_or_logical2 (ffebld_cu_ptr_logical2 (u
),
6200 ffebld_constant_logical2 (ffebld_conter (l
)),
6201 ffebld_constant_logical2 (ffebld_conter (r
)));
6202 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical2_val
6203 (ffebld_cu_val_logical2 (u
)), expr
);
6207 #if FFETARGET_okLOGICAL3
6208 case FFEINFO_kindtypeLOGICAL3
:
6209 error
= ffetarget_or_logical3 (ffebld_cu_ptr_logical3 (u
),
6210 ffebld_constant_logical3 (ffebld_conter (l
)),
6211 ffebld_constant_logical3 (ffebld_conter (r
)));
6212 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical3_val
6213 (ffebld_cu_val_logical3 (u
)), expr
);
6217 #if FFETARGET_okLOGICAL4
6218 case FFEINFO_kindtypeLOGICAL4
:
6219 error
= ffetarget_or_logical4 (ffebld_cu_ptr_logical4 (u
),
6220 ffebld_constant_logical4 (ffebld_conter (l
)),
6221 ffebld_constant_logical4 (ffebld_conter (r
)));
6222 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical4_val
6223 (ffebld_cu_val_logical4 (u
)), expr
);
6228 assert ("bad logical kind type" == NULL
);
6234 assert ("bad type" == NULL
);
6238 ffebld_set_info (expr
, ffeinfo_new
6243 FFEINFO_whereCONSTANT
,
6244 FFETARGET_charactersizeNONE
));
6246 if ((error
!= FFEBAD
)
6247 && ffebad_start (error
))
6249 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
6256 /* ffeexpr_collapse_xor -- Collapse xor expr
6260 expr = ffeexpr_collapse_xor(expr,token);
6262 If the result of the expr is a constant, replaces the expr with the
6263 computed constant. */
6266 ffeexpr_collapse_xor (ffebld expr
, ffelexToken t
)
6268 ffebad error
= FFEBAD
;
6271 ffebldConstantUnion u
;
6272 ffeinfoBasictype bt
;
6275 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
6278 l
= ffebld_left (expr
);
6279 r
= ffebld_right (expr
);
6281 if (ffebld_op (l
) != FFEBLD_opCONTER
)
6283 if (ffebld_op (r
) != FFEBLD_opCONTER
)
6286 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
6288 case FFEINFO_basictypeANY
:
6291 case FFEINFO_basictypeINTEGER
:
6292 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6294 #if FFETARGET_okINTEGER1
6295 case FFEINFO_kindtypeINTEGER1
:
6296 error
= ffetarget_xor_integer1 (ffebld_cu_ptr_integer1 (u
),
6297 ffebld_constant_integer1 (ffebld_conter (l
)),
6298 ffebld_constant_integer1 (ffebld_conter (r
)));
6299 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
6300 (ffebld_cu_val_integer1 (u
)), expr
);
6304 #if FFETARGET_okINTEGER2
6305 case FFEINFO_kindtypeINTEGER2
:
6306 error
= ffetarget_xor_integer2 (ffebld_cu_ptr_integer2 (u
),
6307 ffebld_constant_integer2 (ffebld_conter (l
)),
6308 ffebld_constant_integer2 (ffebld_conter (r
)));
6309 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
6310 (ffebld_cu_val_integer2 (u
)), expr
);
6314 #if FFETARGET_okINTEGER3
6315 case FFEINFO_kindtypeINTEGER3
:
6316 error
= ffetarget_xor_integer3 (ffebld_cu_ptr_integer3 (u
),
6317 ffebld_constant_integer3 (ffebld_conter (l
)),
6318 ffebld_constant_integer3 (ffebld_conter (r
)));
6319 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
6320 (ffebld_cu_val_integer3 (u
)), expr
);
6324 #if FFETARGET_okINTEGER4
6325 case FFEINFO_kindtypeINTEGER4
:
6326 error
= ffetarget_xor_integer4 (ffebld_cu_ptr_integer4 (u
),
6327 ffebld_constant_integer4 (ffebld_conter (l
)),
6328 ffebld_constant_integer4 (ffebld_conter (r
)));
6329 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
6330 (ffebld_cu_val_integer4 (u
)), expr
);
6335 assert ("bad integer kind type" == NULL
);
6340 case FFEINFO_basictypeLOGICAL
:
6341 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6343 #if FFETARGET_okLOGICAL1
6344 case FFEINFO_kindtypeLOGICAL1
:
6345 error
= ffetarget_xor_logical1 (ffebld_cu_ptr_logical1 (u
),
6346 ffebld_constant_logical1 (ffebld_conter (l
)),
6347 ffebld_constant_logical1 (ffebld_conter (r
)));
6348 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical1_val
6349 (ffebld_cu_val_logical1 (u
)), expr
);
6353 #if FFETARGET_okLOGICAL2
6354 case FFEINFO_kindtypeLOGICAL2
:
6355 error
= ffetarget_xor_logical2 (ffebld_cu_ptr_logical2 (u
),
6356 ffebld_constant_logical2 (ffebld_conter (l
)),
6357 ffebld_constant_logical2 (ffebld_conter (r
)));
6358 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical2_val
6359 (ffebld_cu_val_logical2 (u
)), expr
);
6363 #if FFETARGET_okLOGICAL3
6364 case FFEINFO_kindtypeLOGICAL3
:
6365 error
= ffetarget_xor_logical3 (ffebld_cu_ptr_logical3 (u
),
6366 ffebld_constant_logical3 (ffebld_conter (l
)),
6367 ffebld_constant_logical3 (ffebld_conter (r
)));
6368 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical3_val
6369 (ffebld_cu_val_logical3 (u
)), expr
);
6373 #if FFETARGET_okLOGICAL4
6374 case FFEINFO_kindtypeLOGICAL4
:
6375 error
= ffetarget_xor_logical4 (ffebld_cu_ptr_logical4 (u
),
6376 ffebld_constant_logical4 (ffebld_conter (l
)),
6377 ffebld_constant_logical4 (ffebld_conter (r
)));
6378 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical4_val
6379 (ffebld_cu_val_logical4 (u
)), expr
);
6384 assert ("bad logical kind type" == NULL
);
6390 assert ("bad type" == NULL
);
6394 ffebld_set_info (expr
, ffeinfo_new
6399 FFEINFO_whereCONSTANT
,
6400 FFETARGET_charactersizeNONE
));
6402 if ((error
!= FFEBAD
)
6403 && ffebad_start (error
))
6405 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
6412 /* ffeexpr_collapse_eqv -- Collapse eqv expr
6416 expr = ffeexpr_collapse_eqv(expr,token);
6418 If the result of the expr is a constant, replaces the expr with the
6419 computed constant. */
6422 ffeexpr_collapse_eqv (ffebld expr
, ffelexToken t
)
6424 ffebad error
= FFEBAD
;
6427 ffebldConstantUnion u
;
6428 ffeinfoBasictype bt
;
6431 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
6434 l
= ffebld_left (expr
);
6435 r
= ffebld_right (expr
);
6437 if (ffebld_op (l
) != FFEBLD_opCONTER
)
6439 if (ffebld_op (r
) != FFEBLD_opCONTER
)
6442 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
6444 case FFEINFO_basictypeANY
:
6447 case FFEINFO_basictypeINTEGER
:
6448 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6450 #if FFETARGET_okINTEGER1
6451 case FFEINFO_kindtypeINTEGER1
:
6452 error
= ffetarget_eqv_integer1 (ffebld_cu_ptr_integer1 (u
),
6453 ffebld_constant_integer1 (ffebld_conter (l
)),
6454 ffebld_constant_integer1 (ffebld_conter (r
)));
6455 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
6456 (ffebld_cu_val_integer1 (u
)), expr
);
6460 #if FFETARGET_okINTEGER2
6461 case FFEINFO_kindtypeINTEGER2
:
6462 error
= ffetarget_eqv_integer2 (ffebld_cu_ptr_integer2 (u
),
6463 ffebld_constant_integer2 (ffebld_conter (l
)),
6464 ffebld_constant_integer2 (ffebld_conter (r
)));
6465 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
6466 (ffebld_cu_val_integer2 (u
)), expr
);
6470 #if FFETARGET_okINTEGER3
6471 case FFEINFO_kindtypeINTEGER3
:
6472 error
= ffetarget_eqv_integer3 (ffebld_cu_ptr_integer3 (u
),
6473 ffebld_constant_integer3 (ffebld_conter (l
)),
6474 ffebld_constant_integer3 (ffebld_conter (r
)));
6475 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
6476 (ffebld_cu_val_integer3 (u
)), expr
);
6480 #if FFETARGET_okINTEGER4
6481 case FFEINFO_kindtypeINTEGER4
:
6482 error
= ffetarget_eqv_integer4 (ffebld_cu_ptr_integer4 (u
),
6483 ffebld_constant_integer4 (ffebld_conter (l
)),
6484 ffebld_constant_integer4 (ffebld_conter (r
)));
6485 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
6486 (ffebld_cu_val_integer4 (u
)), expr
);
6491 assert ("bad integer kind type" == NULL
);
6496 case FFEINFO_basictypeLOGICAL
:
6497 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6499 #if FFETARGET_okLOGICAL1
6500 case FFEINFO_kindtypeLOGICAL1
:
6501 error
= ffetarget_eqv_logical1 (ffebld_cu_ptr_logical1 (u
),
6502 ffebld_constant_logical1 (ffebld_conter (l
)),
6503 ffebld_constant_logical1 (ffebld_conter (r
)));
6504 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical1_val
6505 (ffebld_cu_val_logical1 (u
)), expr
);
6509 #if FFETARGET_okLOGICAL2
6510 case FFEINFO_kindtypeLOGICAL2
:
6511 error
= ffetarget_eqv_logical2 (ffebld_cu_ptr_logical2 (u
),
6512 ffebld_constant_logical2 (ffebld_conter (l
)),
6513 ffebld_constant_logical2 (ffebld_conter (r
)));
6514 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical2_val
6515 (ffebld_cu_val_logical2 (u
)), expr
);
6519 #if FFETARGET_okLOGICAL3
6520 case FFEINFO_kindtypeLOGICAL3
:
6521 error
= ffetarget_eqv_logical3 (ffebld_cu_ptr_logical3 (u
),
6522 ffebld_constant_logical3 (ffebld_conter (l
)),
6523 ffebld_constant_logical3 (ffebld_conter (r
)));
6524 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical3_val
6525 (ffebld_cu_val_logical3 (u
)), expr
);
6529 #if FFETARGET_okLOGICAL4
6530 case FFEINFO_kindtypeLOGICAL4
:
6531 error
= ffetarget_eqv_logical4 (ffebld_cu_ptr_logical4 (u
),
6532 ffebld_constant_logical4 (ffebld_conter (l
)),
6533 ffebld_constant_logical4 (ffebld_conter (r
)));
6534 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical4_val
6535 (ffebld_cu_val_logical4 (u
)), expr
);
6540 assert ("bad logical kind type" == NULL
);
6546 assert ("bad type" == NULL
);
6550 ffebld_set_info (expr
, ffeinfo_new
6555 FFEINFO_whereCONSTANT
,
6556 FFETARGET_charactersizeNONE
));
6558 if ((error
!= FFEBAD
)
6559 && ffebad_start (error
))
6561 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
6568 /* ffeexpr_collapse_neqv -- Collapse neqv expr
6572 expr = ffeexpr_collapse_neqv(expr,token);
6574 If the result of the expr is a constant, replaces the expr with the
6575 computed constant. */
6578 ffeexpr_collapse_neqv (ffebld expr
, ffelexToken t
)
6580 ffebad error
= FFEBAD
;
6583 ffebldConstantUnion u
;
6584 ffeinfoBasictype bt
;
6587 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
6590 l
= ffebld_left (expr
);
6591 r
= ffebld_right (expr
);
6593 if (ffebld_op (l
) != FFEBLD_opCONTER
)
6595 if (ffebld_op (r
) != FFEBLD_opCONTER
)
6598 switch (bt
= ffeinfo_basictype (ffebld_info (expr
)))
6600 case FFEINFO_basictypeANY
:
6603 case FFEINFO_basictypeINTEGER
:
6604 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6606 #if FFETARGET_okINTEGER1
6607 case FFEINFO_kindtypeINTEGER1
:
6608 error
= ffetarget_neqv_integer1 (ffebld_cu_ptr_integer1 (u
),
6609 ffebld_constant_integer1 (ffebld_conter (l
)),
6610 ffebld_constant_integer1 (ffebld_conter (r
)));
6611 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val
6612 (ffebld_cu_val_integer1 (u
)), expr
);
6616 #if FFETARGET_okINTEGER2
6617 case FFEINFO_kindtypeINTEGER2
:
6618 error
= ffetarget_neqv_integer2 (ffebld_cu_ptr_integer2 (u
),
6619 ffebld_constant_integer2 (ffebld_conter (l
)),
6620 ffebld_constant_integer2 (ffebld_conter (r
)));
6621 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer2_val
6622 (ffebld_cu_val_integer2 (u
)), expr
);
6626 #if FFETARGET_okINTEGER3
6627 case FFEINFO_kindtypeINTEGER3
:
6628 error
= ffetarget_neqv_integer3 (ffebld_cu_ptr_integer3 (u
),
6629 ffebld_constant_integer3 (ffebld_conter (l
)),
6630 ffebld_constant_integer3 (ffebld_conter (r
)));
6631 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer3_val
6632 (ffebld_cu_val_integer3 (u
)), expr
);
6636 #if FFETARGET_okINTEGER4
6637 case FFEINFO_kindtypeINTEGER4
:
6638 error
= ffetarget_neqv_integer4 (ffebld_cu_ptr_integer4 (u
),
6639 ffebld_constant_integer4 (ffebld_conter (l
)),
6640 ffebld_constant_integer4 (ffebld_conter (r
)));
6641 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_integer4_val
6642 (ffebld_cu_val_integer4 (u
)), expr
);
6647 assert ("bad integer kind type" == NULL
);
6652 case FFEINFO_basictypeLOGICAL
:
6653 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6655 #if FFETARGET_okLOGICAL1
6656 case FFEINFO_kindtypeLOGICAL1
:
6657 error
= ffetarget_neqv_logical1 (ffebld_cu_ptr_logical1 (u
),
6658 ffebld_constant_logical1 (ffebld_conter (l
)),
6659 ffebld_constant_logical1 (ffebld_conter (r
)));
6660 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical1_val
6661 (ffebld_cu_val_logical1 (u
)), expr
);
6665 #if FFETARGET_okLOGICAL2
6666 case FFEINFO_kindtypeLOGICAL2
:
6667 error
= ffetarget_neqv_logical2 (ffebld_cu_ptr_logical2 (u
),
6668 ffebld_constant_logical2 (ffebld_conter (l
)),
6669 ffebld_constant_logical2 (ffebld_conter (r
)));
6670 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical2_val
6671 (ffebld_cu_val_logical2 (u
)), expr
);
6675 #if FFETARGET_okLOGICAL3
6676 case FFEINFO_kindtypeLOGICAL3
:
6677 error
= ffetarget_neqv_logical3 (ffebld_cu_ptr_logical3 (u
),
6678 ffebld_constant_logical3 (ffebld_conter (l
)),
6679 ffebld_constant_logical3 (ffebld_conter (r
)));
6680 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical3_val
6681 (ffebld_cu_val_logical3 (u
)), expr
);
6685 #if FFETARGET_okLOGICAL4
6686 case FFEINFO_kindtypeLOGICAL4
:
6687 error
= ffetarget_neqv_logical4 (ffebld_cu_ptr_logical4 (u
),
6688 ffebld_constant_logical4 (ffebld_conter (l
)),
6689 ffebld_constant_logical4 (ffebld_conter (r
)));
6690 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_logical4_val
6691 (ffebld_cu_val_logical4 (u
)), expr
);
6696 assert ("bad logical kind type" == NULL
);
6702 assert ("bad type" == NULL
);
6706 ffebld_set_info (expr
, ffeinfo_new
6711 FFEINFO_whereCONSTANT
,
6712 FFETARGET_charactersizeNONE
));
6714 if ((error
!= FFEBAD
)
6715 && ffebad_start (error
))
6717 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
6724 /* ffeexpr_collapse_symter -- Collapse symter expr
6728 expr = ffeexpr_collapse_symter(expr,token);
6730 If the result of the expr is a constant, replaces the expr with the
6731 computed constant. */
6734 ffeexpr_collapse_symter (ffebld expr
, ffelexToken t UNUSED
)
6737 ffeinfoBasictype bt
;
6739 ffetargetCharacterSize len
;
6741 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
6744 if ((r
= ffesymbol_init (ffebld_symter (expr
))) == NULL
)
6745 return expr
; /* A PARAMETER lhs in progress. */
6747 switch (ffebld_op (r
))
6749 case FFEBLD_opCONTER
:
6759 bt
= ffeinfo_basictype (ffebld_info (r
));
6760 kt
= ffeinfo_kindtype (ffebld_info (r
));
6761 len
= ffebld_size (r
);
6763 expr
= ffebld_new_conter_with_orig (ffebld_constant_copy (ffebld_conter (r
)),
6766 ffebld_set_info (expr
, ffeinfo_new
6771 FFEINFO_whereCONSTANT
,
6777 /* ffeexpr_collapse_funcref -- Collapse funcref expr
6781 expr = ffeexpr_collapse_funcref(expr,token);
6783 If the result of the expr is a constant, replaces the expr with the
6784 computed constant. */
6787 ffeexpr_collapse_funcref (ffebld expr
, ffelexToken t UNUSED
)
6789 return expr
; /* ~~someday go ahead and collapse these,
6790 though not required */
6793 /* ffeexpr_collapse_arrayref -- Collapse arrayref expr
6797 expr = ffeexpr_collapse_arrayref(expr,token);
6799 If the result of the expr is a constant, replaces the expr with the
6800 computed constant. */
6803 ffeexpr_collapse_arrayref (ffebld expr
, ffelexToken t UNUSED
)
6808 /* ffeexpr_collapse_substr -- Collapse substr expr
6812 expr = ffeexpr_collapse_substr(expr,token);
6814 If the result of the expr is a constant, replaces the expr with the
6815 computed constant. */
6818 ffeexpr_collapse_substr (ffebld expr
, ffelexToken t
)
6820 ffebad error
= FFEBAD
;
6825 ffebldConstantUnion u
;
6827 ffetargetCharacterSize len
;
6828 ffetargetIntegerDefault first
;
6829 ffetargetIntegerDefault last
;
6831 if (ffeinfo_where (ffebld_info (expr
)) != FFEINFO_whereCONSTANT
)
6834 l
= ffebld_left (expr
);
6835 r
= ffebld_right (expr
); /* opITEM. */
6837 if (ffebld_op (l
) != FFEBLD_opCONTER
)
6840 kt
= ffeinfo_kindtype (ffebld_info (l
));
6841 len
= ffebld_size (l
);
6843 start
= ffebld_head (r
);
6844 stop
= ffebld_head (ffebld_trail (r
));
6849 if ((ffebld_op (start
) != FFEBLD_opCONTER
)
6850 || (ffeinfo_basictype (ffebld_info (start
)) != FFEINFO_basictypeINTEGER
)
6851 || (ffeinfo_kindtype (ffebld_info (start
))
6852 != FFEINFO_kindtypeINTEGERDEFAULT
))
6854 first
= ffebld_constant_integerdefault (ffebld_conter (start
));
6860 if ((ffebld_op (stop
) != FFEBLD_opCONTER
)
6861 || (ffeinfo_basictype (ffebld_info (stop
)) != FFEINFO_basictypeINTEGER
)
6862 || (ffeinfo_kindtype (ffebld_info (stop
))
6863 != FFEINFO_kindtypeINTEGERDEFAULT
))
6865 last
= ffebld_constant_integerdefault (ffebld_conter (stop
));
6868 /* Handle problems that should have already been diagnosed, but
6869 left in the expression tree. */
6874 last
= first
+ len
- 1;
6876 if ((first
== 1) && (last
== len
))
6877 { /* Same as original. */
6878 expr
= ffebld_new_conter_with_orig (ffebld_constant_copy
6879 (ffebld_conter (l
)), expr
);
6880 ffebld_set_info (expr
, ffeinfo_new
6881 (FFEINFO_basictypeCHARACTER
,
6885 FFEINFO_whereCONSTANT
,
6891 switch (ffeinfo_basictype (ffebld_info (expr
)))
6893 case FFEINFO_basictypeANY
:
6896 case FFEINFO_basictypeCHARACTER
:
6897 switch (kt
= ffeinfo_kindtype (ffebld_info (expr
)))
6899 #if FFETARGET_okCHARACTER1
6900 case FFEINFO_kindtypeCHARACTER1
:
6901 error
= ffetarget_substr_character1 (ffebld_cu_ptr_character1 (u
),
6902 ffebld_constant_character1 (ffebld_conter (l
)), first
, last
,
6903 ffebld_constant_pool (), &len
);
6904 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character1_val
6905 (ffebld_cu_val_character1 (u
)), expr
);
6909 #if FFETARGET_okCHARACTER2
6910 case FFEINFO_kindtypeCHARACTER2
:
6911 error
= ffetarget_substr_character2 (ffebld_cu_ptr_character2 (u
),
6912 ffebld_constant_character2 (ffebld_conter (l
)), first
, last
,
6913 ffebld_constant_pool (), &len
);
6914 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character2_val
6915 (ffebld_cu_val_character2 (u
)), expr
);
6919 #if FFETARGET_okCHARACTER3
6920 case FFEINFO_kindtypeCHARACTER3
:
6921 error
= ffetarget_substr_character3 (ffebld_cu_ptr_character3 (u
),
6922 ffebld_constant_character3 (ffebld_conter (l
)), first
, last
,
6923 ffebld_constant_pool (), &len
);
6924 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character3_val
6925 (ffebld_cu_val_character3 (u
)), expr
);
6929 #if FFETARGET_okCHARACTER4
6930 case FFEINFO_kindtypeCHARACTER4
:
6931 error
= ffetarget_substr_character4 (ffebld_cu_ptr_character4 (u
),
6932 ffebld_constant_character4 (ffebld_conter (l
)), first
, last
,
6933 ffebld_constant_pool (), &len
);
6934 expr
= ffebld_new_conter_with_orig (ffebld_constant_new_character4_val
6935 (ffebld_cu_val_character4 (u
)), expr
);
6940 assert ("bad character kind type" == NULL
);
6946 assert ("bad type" == NULL
);
6950 ffebld_set_info (expr
, ffeinfo_new
6951 (FFEINFO_basictypeCHARACTER
,
6955 FFEINFO_whereCONSTANT
,
6958 if ((error
!= FFEBAD
)
6959 && ffebad_start (error
))
6961 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
6968 /* ffeexpr_convert -- Convert source expression to given type
6971 ffelexToken source_token;
6972 ffelexToken dest_token; // Any appropriate token for "destination".
6973 ffeinfoBasictype bt;
6975 ffetargetCharactersize sz;
6976 ffeexprContext context; // Mainly LET or DATA.
6977 source = ffeexpr_convert(source,source_token,dest_token,bt,kt,sz,context);
6979 If the expression conforms, returns the source expression. Otherwise
6980 returns source wrapped in a convert node doing the conversion, or
6981 ANY wrapped in convert if there is a conversion error (and issues an
6982 error message). Be sensitive to the context for certain aspects of
6986 ffeexpr_convert (ffebld source
, ffelexToken source_token
, ffelexToken dest_token
,
6987 ffeinfoBasictype bt
, ffeinfoKindtype kt
, ffeinfoRank rk
,
6988 ffetargetCharacterSize sz
, ffeexprContext context
)
6994 info
= ffebld_info (source
);
6995 if ((bt
!= ffeinfo_basictype (info
))
6996 || (kt
!= ffeinfo_kindtype (info
))
6997 || (rk
!= 0) /* Can't convert from or to arrays yet. */
6998 || (ffeinfo_rank (info
) != 0)
6999 || (sz
!= ffebld_size_known (source
)))
7000 #if 0 /* Nobody seems to need this spurious CONVERT node. */
7001 || ((context
!= FFEEXPR_contextLET
)
7002 && (bt
== FFEINFO_basictypeCHARACTER
)
7003 && (sz
== FFETARGET_charactersizeNONE
)))
7006 switch (ffeinfo_basictype (info
))
7008 case FFEINFO_basictypeLOGICAL
:
7011 case FFEINFO_basictypeLOGICAL
:
7015 case FFEINFO_basictypeINTEGER
:
7016 bad
= !ffe_is_ugly_logint ();
7019 case FFEINFO_basictypeCHARACTER
:
7020 bad
= ffe_is_pedantic ()
7021 || !(ffe_is_ugly_init ()
7022 && (context
== FFEEXPR_contextDATA
));
7031 case FFEINFO_basictypeINTEGER
:
7034 case FFEINFO_basictypeINTEGER
:
7035 case FFEINFO_basictypeREAL
:
7036 case FFEINFO_basictypeCOMPLEX
:
7040 case FFEINFO_basictypeLOGICAL
:
7041 bad
= !ffe_is_ugly_logint ();
7044 case FFEINFO_basictypeCHARACTER
:
7045 bad
= ffe_is_pedantic ()
7046 || !(ffe_is_ugly_init ()
7047 && (context
== FFEEXPR_contextDATA
));
7056 case FFEINFO_basictypeREAL
:
7057 case FFEINFO_basictypeCOMPLEX
:
7060 case FFEINFO_basictypeINTEGER
:
7061 case FFEINFO_basictypeREAL
:
7062 case FFEINFO_basictypeCOMPLEX
:
7066 case FFEINFO_basictypeCHARACTER
:
7076 case FFEINFO_basictypeCHARACTER
:
7077 bad
= (bt
!= FFEINFO_basictypeCHARACTER
)
7078 && (ffe_is_pedantic ()
7079 || (bt
!= FFEINFO_basictypeINTEGER
)
7080 || !(ffe_is_ugly_init ()
7081 && (context
== FFEEXPR_contextDATA
)));
7084 case FFEINFO_basictypeTYPELESS
:
7085 case FFEINFO_basictypeHOLLERITH
:
7086 bad
= ffe_is_pedantic ()
7087 || !(ffe_is_ugly_init ()
7088 && ((context
== FFEEXPR_contextDATA
)
7089 || (context
== FFEEXPR_contextLET
)));
7097 if (!bad
&& ((rk
!= 0) || (ffeinfo_rank (info
) != 0)))
7100 if (bad
&& (bt
!= FFEINFO_basictypeANY
) && (kt
!= FFEINFO_kindtypeANY
)
7101 && (ffeinfo_basictype (info
) != FFEINFO_basictypeANY
)
7102 && (ffeinfo_kindtype (info
) != FFEINFO_kindtypeANY
)
7103 && (ffeinfo_where (info
) != FFEINFO_whereANY
))
7105 if (ffebad_start (FFEBAD_BAD_TYPES
))
7107 if (dest_token
== NULL
)
7108 ffebad_here (0, ffewhere_line_unknown (),
7109 ffewhere_column_unknown ());
7111 ffebad_here (0, ffelex_token_where_line (dest_token
),
7112 ffelex_token_where_column (dest_token
));
7113 assert (source_token
!= NULL
);
7114 ffebad_here (1, ffelex_token_where_line (source_token
),
7115 ffelex_token_where_column (source_token
));
7119 source
= ffebld_new_any ();
7120 ffebld_set_info (source
, ffeinfo_new_any ());
7124 switch (ffeinfo_where (info
))
7126 case FFEINFO_whereCONSTANT
:
7127 wh
= FFEINFO_whereCONSTANT
;
7130 case FFEINFO_whereIMMEDIATE
:
7131 wh
= FFEINFO_whereIMMEDIATE
;
7135 wh
= FFEINFO_whereFLEETING
;
7138 source
= ffebld_new_convert (source
);
7139 ffebld_set_info (source
, ffeinfo_new
7146 source
= ffeexpr_collapse_convert (source
, source_token
);
7153 /* ffeexpr_convert_expr -- Convert source expr to conform to dest expr
7157 ffelexToken source_token;
7158 ffelexToken dest_token;
7159 ffeexprContext context;
7160 source = ffeexpr_convert_expr(source,source_token,dest,dest_token,context);
7162 If the expressions conform, returns the source expression. Otherwise
7163 returns source wrapped in a convert node doing the conversion, or
7164 ANY wrapped in convert if there is a conversion error (and issues an
7165 error message). Be sensitive to the context, such as LET or DATA. */
7168 ffeexpr_convert_expr (ffebld source
, ffelexToken source_token
, ffebld dest
,
7169 ffelexToken dest_token
, ffeexprContext context
)
7173 info
= ffebld_info (dest
);
7174 return ffeexpr_convert (source
, source_token
, dest_token
,
7175 ffeinfo_basictype (info
),
7176 ffeinfo_kindtype (info
),
7177 ffeinfo_rank (info
),
7178 ffebld_size_known (dest
),
7182 /* ffeexpr_convert_to_sym -- Convert source expression to conform to symbol
7186 ffelexToken source_token;
7187 ffelexToken dest_token;
7188 source = ffeexpr_convert_to_sym(source,source_token,dest,dest_token);
7190 If the expressions conform, returns the source expression. Otherwise
7191 returns source wrapped in a convert node doing the conversion, or
7192 ANY wrapped in convert if there is a conversion error (and issues an
7196 ffeexpr_convert_to_sym (ffebld source
, ffelexToken source_token
,
7197 ffesymbol dest
, ffelexToken dest_token
)
7199 return ffeexpr_convert (source
, source_token
, dest_token
, ffesymbol_basictype (dest
),
7200 ffesymbol_kindtype (dest
), ffesymbol_rank (dest
), ffesymbol_size (dest
),
7201 FFEEXPR_contextLET
);
7204 /* Initializes the module. */
7209 ffeexpr_stack_
= NULL
;
7213 /* ffeexpr_lhs -- Begin processing left-hand-side-context expression
7215 Prepares cluster for delivery of lexer tokens representing an expression
7216 in a left-hand-side context (A in A=B, for example). ffebld is used
7217 to build expressions in the given pool. The appropriate lexer-token
7218 handling routine within ffeexpr is returned. When the end of the
7219 expression is detected, mycallbackroutine is called with the resulting
7220 single ffebld object specifying the entire expression and the first
7221 lexer token that is not considered part of the expression. This caller-
7222 supplied routine itself returns a lexer-token handling routine. Thus,
7223 if necessary, ffeexpr can return several tokens as end-of-expression
7224 tokens if it needs to scan forward more than one in any instance. */
7227 ffeexpr_lhs (mallocPool pool
, ffeexprContext context
, ffeexprCallback callback
)
7231 ffebld_pool_push (pool
);
7232 s
= malloc_new_ks (ffe_pool_program_unit (), "FFEEXPR stack", sizeof (*s
));
7233 s
->previous
= ffeexpr_stack_
;
7235 s
->context
= context
;
7236 s
->callback
= callback
;
7237 s
->first_token
= NULL
;
7238 s
->exprstack
= NULL
;
7241 return (ffelexHandler
) ffeexpr_token_first_lhs_
;
7244 /* ffeexpr_rhs -- Begin processing right-hand-side-context expression
7246 return ffeexpr_rhs(malloc_pool_image(),mycallbackroutine); // to lexer.
7248 Prepares cluster for delivery of lexer tokens representing an expression
7249 in a right-hand-side context (B in A=B, for example). ffebld is used
7250 to build expressions in the given pool. The appropriate lexer-token
7251 handling routine within ffeexpr is returned. When the end of the
7252 expression is detected, mycallbackroutine is called with the resulting
7253 single ffebld object specifying the entire expression and the first
7254 lexer token that is not considered part of the expression. This caller-
7255 supplied routine itself returns a lexer-token handling routine. Thus,
7256 if necessary, ffeexpr can return several tokens as end-of-expression
7257 tokens if it needs to scan forward more than one in any instance. */
7260 ffeexpr_rhs (mallocPool pool
, ffeexprContext context
, ffeexprCallback callback
)
7264 ffebld_pool_push (pool
);
7265 s
= malloc_new_ks (ffe_pool_program_unit (), "FFEEXPR stack", sizeof (*s
));
7266 s
->previous
= ffeexpr_stack_
;
7268 s
->context
= context
;
7269 s
->callback
= callback
;
7270 s
->first_token
= NULL
;
7271 s
->exprstack
= NULL
;
7274 return (ffelexHandler
) ffeexpr_token_first_rhs_
;
7277 /* ffeexpr_cb_close_paren_ -- OPEN_PAREN expr
7279 Pass it to ffeexpr_rhs as the callback routine.
7281 Makes sure the end token is close-paren and swallows it, else issues
7282 an error message and doesn't swallow the token (passing it along instead).
7283 In either case wraps up subexpression construction by enclosing the
7284 ffebld expression in a paren. */
7286 static ffelexHandler
7287 ffeexpr_cb_close_paren_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7291 if (ffelex_token_type (t
) != FFELEX_typeCLOSE_PAREN
)
7293 /* Oops, naughty user didn't specify the close paren! */
7295 if (ffest_ffebad_start (FFEBAD_MISSING_CLOSE_PAREN
))
7297 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
7298 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
7299 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
7303 e
= ffeexpr_expr_new_ ();
7304 e
->type
= FFEEXPR_exprtypeOPERAND_
;
7305 e
->u
.operand
= ffebld_new_any ();
7306 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
7307 ffeexpr_exprstack_push_operand_ (e
);
7310 (ffelexHandler
) ffeexpr_find_close_paren_ (t
,
7312 ffeexpr_token_binary_
);
7315 if (expr
->op
== FFEBLD_opIMPDO
)
7317 if (ffest_ffebad_start (FFEBAD_IMPDO_PAREN
))
7319 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
7320 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
7326 expr
= ffebld_new_paren (expr
);
7327 ffebld_set_info (expr
, ffeinfo_use (ffebld_info (ffebld_left (expr
))));
7330 /* Now push the (parenthesized) expression as an operand onto the
7331 expression stack. */
7333 e
= ffeexpr_expr_new_ ();
7334 e
->type
= FFEEXPR_exprtypeOPERAND_
;
7335 e
->u
.operand
= expr
;
7336 e
->u
.operand
= ffeexpr_collapse_paren (e
->u
.operand
, ft
);
7337 e
->token
= ffeexpr_stack_
->tokens
[0];
7338 ffeexpr_exprstack_push_operand_ (e
);
7340 return (ffelexHandler
) ffeexpr_token_binary_
;
7343 /* ffeexpr_cb_close_paren_ambig_ -- OPEN_PAREN expr
7345 Pass it to ffeexpr_rhs as the callback routine.
7347 We get here in the READ/BACKEND/ENDFILE/REWIND case "READ(expr)"
7348 with the next token in t. If the next token is possibly a binary
7349 operator, continue processing the outer expression. If the next
7350 token is COMMA, then the expression is a unit specifier, and
7351 parentheses should not be added to it because it surrounds the
7352 I/O control list that starts with the unit specifier (and continues
7353 on from here -- we haven't seen the CLOSE_PAREN that matches the
7354 OPEN_PAREN, it is up to the callback function to expect to see it
7355 at some point). In this case, we notify the callback function that
7356 the COMMA is inside, not outside, the parens by wrapping the expression
7357 in an opITEM (with a NULL trail) -- the callback function presumably
7358 unwraps it after seeing this kludgey indicator.
7360 If the next token is CLOSE_PAREN, then we go to the _1_ state to
7361 decide what to do with the token after that.
7364 Use an extra state for the CLOSE_PAREN case to make READ &co really
7367 static ffelexHandler
7368 ffeexpr_cb_close_paren_ambig_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7370 ffeexprCallback callback
;
7373 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
7374 { /* Need to see the next token before we
7376 ffeexpr_stack_
->expr
= expr
;
7377 ffeexpr_tokens_
[0] = ffelex_token_use (ft
);
7378 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
7379 return (ffelexHandler
) ffeexpr_cb_close_paren_ambig_1_
;
7382 expr
= ffeexpr_finished_ambig_ (ft
, expr
);
7384 /* Let the callback function handle the case where t isn't COMMA. */
7386 /* Here is a kludge whereby we tell the callback function the OPEN_PAREN
7387 that preceded the expression starts a list of expressions, and the expr
7388 hasn't been wrapped in a corresponding (and possibly collapsed) opPAREN
7389 node. The callback function should extract the real expr from the head
7390 of this opITEM node after testing it. */
7392 expr
= ffebld_new_item (expr
, NULL
);
7395 callback
= ffeexpr_stack_
->callback
;
7396 ffelex_token_kill (ffeexpr_stack_
->first_token
);
7397 s
= ffeexpr_stack_
->previous
;
7398 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
, sizeof (*ffeexpr_stack_
));
7400 return (ffelexHandler
) (*callback
) (ft
, expr
, t
);
7403 /* ffeexpr_cb_close_paren_ambig_1_ -- OPEN_PAREN expr CLOSE_PAREN
7405 See ffeexpr_cb_close_paren_ambig_.
7407 We get here in the READ/BACKEND/ENDFILE/REWIND case "READ(expr)"
7408 with the next token in t. If the next token is possibly a binary
7409 operator, continue processing the outer expression. If the next
7410 token is COMMA, the expression is a parenthesized format specifier.
7411 If the next token is not EOS or SEMICOLON, then because it is not a
7412 binary operator (it is NAME, OPEN_PAREN, &c), the expression is
7413 a unit specifier, and parentheses should not be added to it because
7414 they surround the I/O control list that consists of only the unit
7415 specifier. If the next token is EOS or SEMICOLON, the statement
7416 must be disambiguated by looking at the type of the expression -- a
7417 character expression is a parenthesized format specifier, while a
7418 non-character expression is a unit specifier.
7420 Another issue is how to do the callback so the recipient of the
7421 next token knows how to handle it if it is a COMMA. In all other
7422 cases, disambiguation is straightforward: the same approach as the
7425 EXTENSION: in COMMA case, if not pedantic, use same disambiguation
7426 as for EOS/SEMICOLON case; f2c allows "READ (cilist) [[,]iolist]"
7427 and apparently other compilers do, as well, and some code out there
7428 uses this "feature".
7431 Extend to allow COMMA as nondisambiguating by itself. Remember
7432 to not try and check info field for opSTAR, since that expr doesn't
7433 have a valid info field. */
7435 static ffelexHandler
7436 ffeexpr_cb_close_paren_ambig_1_ (ffelexToken t
)
7438 ffeexprCallback callback
;
7441 ffelexToken orig_ft
= ffeexpr_tokens_
[0]; /* In case callback clobbers
7443 ffelexToken orig_t
= ffeexpr_tokens_
[1];
7444 ffebld expr
= ffeexpr_stack_
->expr
;
7446 switch (ffelex_token_type (t
))
7448 case FFELEX_typeCOMMA
: /* Subexpr is parenthesized format specifier. */
7449 if (ffe_is_pedantic ())
7450 goto pedantic_comma
; /* :::::::::::::::::::: */
7452 case FFELEX_typeEOS
: /* Ambiguous; use type of expr to
7454 case FFELEX_typeSEMICOLON
:
7455 if ((expr
== NULL
) || (ffebld_op (expr
) == FFEBLD_opANY
)
7456 || (ffebld_op (expr
) == FFEBLD_opSTAR
)
7457 || (ffeinfo_basictype (ffebld_info (expr
))
7458 != FFEINFO_basictypeCHARACTER
))
7459 break; /* Not a valid CHARACTER entity, can't be a
7462 default: /* Binary op (we assume; error otherwise);
7463 format specifier. */
7465 pedantic_comma
: /* :::::::::::::::::::: */
7467 switch (ffeexpr_stack_
->context
)
7469 case FFEEXPR_contextFILENUMAMBIG
:
7470 ffeexpr_stack_
->context
= FFEEXPR_contextFILENUM
;
7473 case FFEEXPR_contextFILEUNITAMBIG
:
7474 ffeexpr_stack_
->context
= FFEEXPR_contextFILEFORMAT
;
7478 assert ("bad context" == NULL
);
7482 ffeexpr_stack_
->tokens
[0] = ffelex_token_use (ffeexpr_stack_
->first_token
);
7483 next
= (ffelexHandler
) ffeexpr_cb_close_paren_ (orig_ft
, expr
, orig_t
);
7484 ffelex_token_kill (orig_ft
);
7485 ffelex_token_kill (orig_t
);
7486 return (ffelexHandler
) (*next
) (t
);
7488 case FFELEX_typeOPEN_PAREN
:/* Non-binary op; beginning of I/O list. */
7489 case FFELEX_typeNAME
:
7493 expr
= ffeexpr_finished_ambig_ (orig_ft
, expr
);
7495 /* Here is a kludge whereby we tell the callback function the OPEN_PAREN
7496 that preceded the expression starts a list of expressions, and the expr
7497 hasn't been wrapped in a corresponding (and possibly collapsed) opPAREN
7498 node. The callback function should extract the real expr from the head
7499 of this opITEM node after testing it. */
7501 expr
= ffebld_new_item (expr
, NULL
);
7504 callback
= ffeexpr_stack_
->callback
;
7505 ffelex_token_kill (ffeexpr_stack_
->first_token
);
7506 s
= ffeexpr_stack_
->previous
;
7507 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
, sizeof (*ffeexpr_stack_
));
7509 next
= (ffelexHandler
) (*callback
) (orig_ft
, expr
, orig_t
);
7510 ffelex_token_kill (orig_ft
);
7511 ffelex_token_kill (orig_t
);
7512 return (ffelexHandler
) (*next
) (t
);
7515 /* ffeexpr_cb_close_paren_c_ -- OPEN_PAREN expr (possible complex)
7517 Pass it to ffeexpr_rhs as the callback routine.
7519 Makes sure the end token is close-paren and swallows it, or a comma
7520 and handles complex/implied-do possibilities, else issues
7521 an error message and doesn't swallow the token (passing it along instead). */
7523 static ffelexHandler
7524 ffeexpr_cb_close_paren_c_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7526 /* First check to see if this is a possible complex entity. It is if the
7527 token is a comma. */
7529 if (ffelex_token_type (t
) == FFELEX_typeCOMMA
)
7531 ffeexpr_stack_
->tokens
[1] = ffelex_token_use (ft
);
7532 ffeexpr_stack_
->expr
= expr
;
7533 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
7534 FFEEXPR_contextPAREN_
, ffeexpr_cb_comma_c_
);
7537 return (ffelexHandler
) ffeexpr_cb_close_paren_ (ft
, expr
, t
);
7540 /* ffeexpr_cb_comma_c_ -- OPEN_PAREN expr COMMA expr
7542 Pass it to ffeexpr_rhs as the callback routine.
7544 If this token is not a comma, we have a complex constant (or an attempt
7545 at one), so handle it accordingly, displaying error messages if the token
7546 is not a close-paren. */
7548 static ffelexHandler
7549 ffeexpr_cb_comma_c_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7552 ffeinfoBasictype lty
= (ffeexpr_stack_
->expr
== NULL
)
7553 ? FFEINFO_basictypeNONE
: ffeinfo_basictype (ffebld_info (ffeexpr_stack_
->expr
));
7554 ffeinfoBasictype rty
= (expr
== NULL
)
7555 ? FFEINFO_basictypeNONE
: ffeinfo_basictype (ffebld_info (expr
));
7556 ffeinfoKindtype lkt
;
7557 ffeinfoKindtype rkt
;
7558 ffeinfoKindtype nkt
;
7562 if ((ffeexpr_stack_
->expr
== NULL
)
7563 || (ffebld_op (ffeexpr_stack_
->expr
) != FFEBLD_opCONTER
)
7564 || (((orig
= ffebld_conter_orig (ffeexpr_stack_
->expr
)) != NULL
)
7565 && (((ffebld_op (orig
) != FFEBLD_opUMINUS
)
7566 && (ffebld_op (orig
) != FFEBLD_opUPLUS
))
7567 || (ffebld_conter_orig (ffebld_left (orig
)) != NULL
)))
7568 || ((lty
!= FFEINFO_basictypeINTEGER
)
7569 && (lty
!= FFEINFO_basictypeREAL
)))
7571 if ((lty
!= FFEINFO_basictypeANY
)
7572 && ffebad_start (FFEBAD_INVALID_COMPLEX_PART
))
7574 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->tokens
[1]),
7575 ffelex_token_where_column (ffeexpr_stack_
->tokens
[1]));
7576 ffebad_string ("Real");
7582 || (ffebld_op (expr
) != FFEBLD_opCONTER
)
7583 || (((orig
= ffebld_conter_orig (expr
)) != NULL
)
7584 && (((ffebld_op (orig
) != FFEBLD_opUMINUS
)
7585 && (ffebld_op (orig
) != FFEBLD_opUPLUS
))
7586 || (ffebld_conter_orig (ffebld_left (orig
)) != NULL
)))
7587 || ((rty
!= FFEINFO_basictypeINTEGER
)
7588 && (rty
!= FFEINFO_basictypeREAL
)))
7590 if ((rty
!= FFEINFO_basictypeANY
)
7591 && ffebad_start (FFEBAD_INVALID_COMPLEX_PART
))
7593 ffebad_here (0, ffelex_token_where_line (ft
),
7594 ffelex_token_where_column (ft
));
7595 ffebad_string ("Imaginary");
7601 ffelex_token_kill (ffeexpr_stack_
->tokens
[1]);
7603 /* Push the (parenthesized) expression as an operand onto the expression
7606 e
= ffeexpr_expr_new_ ();
7607 e
->type
= FFEEXPR_exprtypeOPERAND_
;
7608 e
->token
= ffeexpr_stack_
->tokens
[0];
7612 if (lty
== FFEINFO_basictypeINTEGER
)
7613 lkt
= FFEINFO_kindtypeREALDEFAULT
;
7615 lkt
= ffeinfo_kindtype (ffebld_info (ffeexpr_stack_
->expr
));
7616 if (rty
== FFEINFO_basictypeINTEGER
)
7617 rkt
= FFEINFO_kindtypeREALDEFAULT
;
7619 rkt
= ffeinfo_kindtype (ffebld_info (expr
));
7621 nkt
= ffeinfo_kindtype_max (FFEINFO_basictypeCOMPLEX
, lkt
, rkt
);
7622 ffeexpr_stack_
->expr
= ffeexpr_convert (ffeexpr_stack_
->expr
,
7623 ffeexpr_stack_
->tokens
[1], ffeexpr_stack_
->tokens
[0],
7624 FFEINFO_basictypeREAL
, nkt
, 0, FFETARGET_charactersizeNONE
,
7625 FFEEXPR_contextLET
);
7626 expr
= ffeexpr_convert (expr
,
7627 ffeexpr_stack_
->tokens
[1], ffeexpr_stack_
->tokens
[0],
7628 FFEINFO_basictypeREAL
, nkt
, 0, FFETARGET_charactersizeNONE
,
7629 FFEEXPR_contextLET
);
7632 nkt
= FFEINFO_kindtypeANY
;
7636 #if FFETARGET_okCOMPLEX1
7637 case FFEINFO_kindtypeREAL1
:
7638 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_complex1
7639 (ffebld_conter (ffeexpr_stack_
->expr
), ffebld_conter (expr
)));
7640 ffebld_set_info (e
->u
.operand
,
7641 ffeinfo_new (FFEINFO_basictypeCOMPLEX
, nkt
, 0,
7642 FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
7643 FFETARGET_charactersizeNONE
));
7647 #if FFETARGET_okCOMPLEX2
7648 case FFEINFO_kindtypeREAL2
:
7649 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_complex2
7650 (ffebld_conter (ffeexpr_stack_
->expr
), ffebld_conter (expr
)));
7651 ffebld_set_info (e
->u
.operand
,
7652 ffeinfo_new (FFEINFO_basictypeCOMPLEX
, nkt
, 0,
7653 FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
7654 FFETARGET_charactersizeNONE
));
7658 #if FFETARGET_okCOMPLEX3
7659 case FFEINFO_kindtypeREAL3
:
7660 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_complex3
7661 (ffebld_conter (ffeexpr_stack_
->expr
), ffebld_conter (expr
)));
7662 ffebld_set_info (e
->u
.operand
,
7663 ffeinfo_new (FFEINFO_basictypeCOMPLEX
, nkt
, 0,
7664 FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
7665 FFETARGET_charactersizeNONE
));
7669 #if FFETARGET_okCOMPLEX4
7670 case FFEINFO_kindtypeREAL4
:
7671 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_complex4
7672 (ffebld_conter (ffeexpr_stack_
->expr
), ffebld_conter (expr
)));
7673 ffebld_set_info (e
->u
.operand
,
7674 ffeinfo_new (FFEINFO_basictypeCOMPLEX
, nkt
, 0,
7675 FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
7676 FFETARGET_charactersizeNONE
));
7681 if (ffebad_start ((nkt
== FFEINFO_kindtypeREALDOUBLE
)
7682 ? FFEBAD_BAD_DBLCMPLX
: FFEBAD_BAD_COMPLEX
))
7684 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
7685 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
7689 case FFEINFO_kindtypeANY
:
7690 e
->u
.operand
= ffebld_new_any ();
7691 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
7694 ffeexpr_exprstack_push_operand_ (e
);
7696 /* Now, if the token is a close parenthese, we're in great shape so return
7697 the next handler. */
7699 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
7700 return (ffelexHandler
) ffeexpr_token_binary_
;
7702 /* Oops, naughty user didn't specify the close paren! */
7704 if (ffest_ffebad_start (FFEBAD_MISSING_CLOSE_PAREN
))
7706 ffebad_here (0, ffelex_token_where_line (t
),
7707 ffelex_token_where_column (t
));
7708 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
7709 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
7714 (ffelexHandler
) ffeexpr_find_close_paren_ (t
,
7716 ffeexpr_token_binary_
);
7719 /* ffeexpr_cb_close_paren_ci_ -- OPEN_PAREN expr (possible complex or
7720 implied-DO construct)
7722 Pass it to ffeexpr_rhs as the callback routine.
7724 Makes sure the end token is close-paren and swallows it, or a comma
7725 and handles complex/implied-do possibilities, else issues
7726 an error message and doesn't swallow the token (passing it along instead). */
7728 static ffelexHandler
7729 ffeexpr_cb_close_paren_ci_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7733 /* First check to see if this is a possible complex or implied-DO entity.
7734 It is if the token is a comma. */
7736 if (ffelex_token_type (t
) == FFELEX_typeCOMMA
)
7738 switch (ffeexpr_stack_
->context
)
7740 case FFEEXPR_contextIOLIST
:
7741 case FFEEXPR_contextIMPDOITEM_
:
7742 ctx
= FFEEXPR_contextIMPDOITEM_
;
7745 case FFEEXPR_contextIOLISTDF
:
7746 case FFEEXPR_contextIMPDOITEMDF_
:
7747 ctx
= FFEEXPR_contextIMPDOITEMDF_
;
7751 assert ("bad context" == NULL
);
7752 ctx
= FFEEXPR_contextIMPDOITEM_
;
7756 ffeexpr_stack_
->tokens
[0] = ffelex_token_use (ft
);
7757 ffeexpr_stack_
->expr
= expr
;
7758 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
7759 ctx
, ffeexpr_cb_comma_ci_
);
7762 ffeexpr_stack_
->tokens
[0] = ffelex_token_use (ffeexpr_stack_
->first_token
);
7763 return (ffelexHandler
) ffeexpr_cb_close_paren_ (ft
, expr
, t
);
7766 /* ffeexpr_cb_comma_ci_ -- OPEN_PAREN expr COMMA expr
7768 Pass it to ffeexpr_rhs as the callback routine.
7770 If this token is not a comma, we have a complex constant (or an attempt
7771 at one), so handle it accordingly, displaying error messages if the token
7772 is not a close-paren. If we have a comma here, it is an attempt at an
7773 implied-DO, so start making a list accordingly. Oh, it might be an
7774 equal sign also, meaning an implied-DO with only one item in its list. */
7776 static ffelexHandler
7777 ffeexpr_cb_comma_ci_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7781 /* First check to see if this is a possible complex constant. It is if the
7782 token is not a comma or an equals sign, in which case it should be a
7785 if ((ffelex_token_type (t
) != FFELEX_typeCOMMA
)
7786 && (ffelex_token_type (t
) != FFELEX_typeEQUALS
))
7788 ffeexpr_stack_
->tokens
[1] = ffeexpr_stack_
->tokens
[0];
7789 ffeexpr_stack_
->tokens
[0] = ffelex_token_use (ffeexpr_stack_
->first_token
);
7790 return (ffelexHandler
) ffeexpr_cb_comma_c_ (ft
, expr
, t
);
7793 /* Here we have either EQUALS or COMMA, meaning we are in an implied-DO
7794 construct. Make a list and handle accordingly. */
7796 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
7797 fexpr
= ffeexpr_stack_
->expr
;
7798 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
7799 ffebld_append_item (&ffeexpr_stack_
->bottom
, fexpr
);
7800 return (ffelexHandler
) ffeexpr_cb_comma_i_1_ (ft
, expr
, t
);
7803 /* ffeexpr_cb_comma_i_ -- OPEN_PAREN expr
7805 Pass it to ffeexpr_rhs as the callback routine.
7807 Handle first item in an implied-DO construct. */
7809 static ffelexHandler
7810 ffeexpr_cb_comma_i_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7812 if (ffelex_token_type (t
) != FFELEX_typeCOMMA
)
7814 if (ffest_ffebad_start (FFEBAD_BAD_IMPDO
))
7816 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
7817 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->first_token
),
7818 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
7821 ffebld_end_list (&ffeexpr_stack_
->bottom
);
7822 ffeexpr_stack_
->expr
= ffebld_new_any ();
7823 ffebld_set_info (ffeexpr_stack_
->expr
, ffeinfo_new_any ());
7824 if (ffelex_token_type (t
) != FFELEX_typeCLOSE_PAREN
)
7825 return (ffelexHandler
) ffeexpr_cb_comma_i_5_ (t
);
7826 return (ffelexHandler
) ffeexpr_cb_comma_i_5_
;
7829 return (ffelexHandler
) ffeexpr_cb_comma_i_1_ (ft
, expr
, t
);
7832 /* ffeexpr_cb_comma_i_1_ -- OPEN_PAREN expr
7834 Pass it to ffeexpr_rhs as the callback routine.
7836 Handle first item in an implied-DO construct. */
7838 static ffelexHandler
7839 ffeexpr_cb_comma_i_1_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
7841 ffeexprContext ctxi
;
7842 ffeexprContext ctxc
;
7844 switch (ffeexpr_stack_
->context
)
7846 case FFEEXPR_contextDATA
:
7847 case FFEEXPR_contextDATAIMPDOITEM_
:
7848 ctxi
= FFEEXPR_contextDATAIMPDOITEM_
;
7849 ctxc
= FFEEXPR_contextDATAIMPDOCTRL_
;
7852 case FFEEXPR_contextIOLIST
:
7853 case FFEEXPR_contextIMPDOITEM_
:
7854 ctxi
= FFEEXPR_contextIMPDOITEM_
;
7855 ctxc
= FFEEXPR_contextIMPDOCTRL_
;
7858 case FFEEXPR_contextIOLISTDF
:
7859 case FFEEXPR_contextIMPDOITEMDF_
:
7860 ctxi
= FFEEXPR_contextIMPDOITEMDF_
;
7861 ctxc
= FFEEXPR_contextIMPDOCTRL_
;
7865 assert ("bad context" == NULL
);
7866 ctxi
= FFEEXPR_context
;
7867 ctxc
= FFEEXPR_context
;
7871 switch (ffelex_token_type (t
))
7873 case FFELEX_typeCOMMA
:
7874 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
7875 if (ffeexpr_stack_
->is_rhs
)
7876 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
7877 ctxi
, ffeexpr_cb_comma_i_1_
);
7878 return (ffelexHandler
) ffeexpr_lhs (ffeexpr_stack_
->pool
,
7879 ctxi
, ffeexpr_cb_comma_i_1_
);
7881 case FFELEX_typeEQUALS
:
7882 ffebld_end_list (&ffeexpr_stack_
->bottom
);
7884 /* Complain if implied-DO variable in list of items to be read. */
7886 if ((ctxc
== FFEEXPR_contextIMPDOCTRL_
) && !ffeexpr_stack_
->is_rhs
)
7887 ffeexpr_check_impdo_ (ffeexpr_stack_
->expr
,
7888 ffeexpr_stack_
->first_token
, expr
, ft
);
7890 /* Set doiter flag for all appropriate SYMTERs. */
7892 ffeexpr_update_impdo_ (ffeexpr_stack_
->expr
, expr
);
7894 ffeexpr_stack_
->expr
= ffebld_new_impdo (ffeexpr_stack_
->expr
, NULL
);
7895 ffebld_set_info (ffeexpr_stack_
->expr
,
7896 ffeinfo_new (FFEINFO_basictypeNONE
,
7897 FFEINFO_kindtypeNONE
,
7901 FFETARGET_charactersizeNONE
));
7902 ffebld_init_list (&(ffebld_right (ffeexpr_stack_
->expr
)),
7903 &ffeexpr_stack_
->bottom
);
7904 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
7905 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
7906 ctxc
, ffeexpr_cb_comma_i_2_
);
7909 if (ffest_ffebad_start (FFEBAD_BAD_IMPDO
))
7911 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
7912 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->first_token
),
7913 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
7916 ffebld_end_list (&ffeexpr_stack_
->bottom
);
7917 ffeexpr_stack_
->expr
= ffebld_new_any ();
7918 ffebld_set_info (ffeexpr_stack_
->expr
, ffeinfo_new_any ());
7919 if (ffelex_token_type (t
) != FFELEX_typeCLOSE_PAREN
)
7920 return (ffelexHandler
) ffeexpr_cb_comma_i_5_ (t
);
7921 return (ffelexHandler
) ffeexpr_cb_comma_i_5_
;
7925 /* ffeexpr_cb_comma_i_2_ -- OPEN_PAREN expr-list EQUALS expr
7927 Pass it to ffeexpr_rhs as the callback routine.
7929 Handle start-value in an implied-DO construct. */
7931 static ffelexHandler
7932 ffeexpr_cb_comma_i_2_ (ffelexToken ft UNUSED
, ffebld expr
, ffelexToken t
)
7936 switch (ffeexpr_stack_
->context
)
7938 case FFEEXPR_contextDATA
:
7939 case FFEEXPR_contextDATAIMPDOITEM_
:
7940 ctx
= FFEEXPR_contextDATAIMPDOCTRL_
;
7943 case FFEEXPR_contextIOLIST
:
7944 case FFEEXPR_contextIOLISTDF
:
7945 case FFEEXPR_contextIMPDOITEM_
:
7946 case FFEEXPR_contextIMPDOITEMDF_
:
7947 ctx
= FFEEXPR_contextIMPDOCTRL_
;
7951 assert ("bad context" == NULL
);
7952 ctx
= FFEEXPR_context
;
7956 switch (ffelex_token_type (t
))
7958 case FFELEX_typeCOMMA
:
7959 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
7960 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
7961 ctx
, ffeexpr_cb_comma_i_3_
);
7965 if (ffest_ffebad_start (FFEBAD_BAD_IMPDO
))
7967 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
7968 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->first_token
),
7969 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
7972 ffebld_end_list (&ffeexpr_stack_
->bottom
);
7973 ffeexpr_stack_
->expr
= ffebld_new_any ();
7974 ffebld_set_info (ffeexpr_stack_
->expr
, ffeinfo_new_any ());
7975 if (ffelex_token_type (t
) != FFELEX_typeCLOSE_PAREN
)
7976 return (ffelexHandler
) ffeexpr_cb_comma_i_5_ (t
);
7977 return (ffelexHandler
) ffeexpr_cb_comma_i_5_
;
7981 /* ffeexpr_cb_comma_i_3_ -- OPEN_PAREN expr-list EQUALS expr COMMA expr
7983 Pass it to ffeexpr_rhs as the callback routine.
7985 Handle end-value in an implied-DO construct. */
7987 static ffelexHandler
7988 ffeexpr_cb_comma_i_3_ (ffelexToken ft UNUSED
, ffebld expr
, ffelexToken t
)
7992 switch (ffeexpr_stack_
->context
)
7994 case FFEEXPR_contextDATA
:
7995 case FFEEXPR_contextDATAIMPDOITEM_
:
7996 ctx
= FFEEXPR_contextDATAIMPDOCTRL_
;
7999 case FFEEXPR_contextIOLIST
:
8000 case FFEEXPR_contextIOLISTDF
:
8001 case FFEEXPR_contextIMPDOITEM_
:
8002 case FFEEXPR_contextIMPDOITEMDF_
:
8003 ctx
= FFEEXPR_contextIMPDOCTRL_
;
8007 assert ("bad context" == NULL
);
8008 ctx
= FFEEXPR_context
;
8012 switch (ffelex_token_type (t
))
8014 case FFELEX_typeCOMMA
:
8015 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
8016 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
8017 ctx
, ffeexpr_cb_comma_i_4_
);
8020 case FFELEX_typeCLOSE_PAREN
:
8021 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
8022 return (ffelexHandler
) ffeexpr_cb_comma_i_4_ (NULL
, NULL
, t
);
8026 if (ffest_ffebad_start (FFEBAD_BAD_IMPDO
))
8028 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
8029 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->first_token
),
8030 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
8033 ffebld_end_list (&ffeexpr_stack_
->bottom
);
8034 ffeexpr_stack_
->expr
= ffebld_new_any ();
8035 ffebld_set_info (ffeexpr_stack_
->expr
, ffeinfo_new_any ());
8036 if (ffelex_token_type (t
) != FFELEX_typeCLOSE_PAREN
)
8037 return (ffelexHandler
) ffeexpr_cb_comma_i_5_ (t
);
8038 return (ffelexHandler
) ffeexpr_cb_comma_i_5_
;
8042 /* ffeexpr_cb_comma_i_4_ -- OPEN_PAREN expr-list EQUALS expr COMMA expr
8045 Pass it to ffeexpr_rhs as the callback routine.
8047 Handle incr-value in an implied-DO construct. */
8049 static ffelexHandler
8050 ffeexpr_cb_comma_i_4_ (ffelexToken ft UNUSED
, ffebld expr
, ffelexToken t
)
8052 switch (ffelex_token_type (t
))
8054 case FFELEX_typeCLOSE_PAREN
:
8055 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
8056 ffebld_end_list (&ffeexpr_stack_
->bottom
);
8060 for (item
= ffebld_left (ffeexpr_stack_
->expr
);
8062 item
= ffebld_trail (item
))
8063 if (ffebld_op (ffebld_head (item
)) == FFEBLD_opANY
)
8064 goto replace_with_any
; /* :::::::::::::::::::: */
8066 for (item
= ffebld_right (ffeexpr_stack_
->expr
);
8068 item
= ffebld_trail (item
))
8069 if ((ffebld_head (item
) != NULL
) /* Increment may be NULL. */
8070 && (ffebld_op (ffebld_head (item
)) == FFEBLD_opANY
))
8071 goto replace_with_any
; /* :::::::::::::::::::: */
8076 if (ffest_ffebad_start (FFEBAD_BAD_IMPDO
))
8078 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
8079 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->first_token
),
8080 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
8083 ffebld_end_list (&ffeexpr_stack_
->bottom
);
8085 replace_with_any
: /* :::::::::::::::::::: */
8087 ffeexpr_stack_
->expr
= ffebld_new_any ();
8088 ffebld_set_info (ffeexpr_stack_
->expr
, ffeinfo_new_any ());
8092 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
8093 return (ffelexHandler
) ffeexpr_cb_comma_i_5_
;
8094 return (ffelexHandler
) ffeexpr_cb_comma_i_5_ (t
);
8097 /* ffeexpr_cb_comma_i_5_ -- OPEN_PAREN expr-list EQUALS expr COMMA expr
8098 [COMMA expr] CLOSE_PAREN
8100 Pass it to ffeexpr_rhs as the callback routine.
8102 Collects token following implied-DO construct for callback function. */
8104 static ffelexHandler
8105 ffeexpr_cb_comma_i_5_ (ffelexToken t
)
8107 ffeexprCallback callback
;
8114 switch (ffeexpr_stack_
->context
)
8116 case FFEEXPR_contextDATA
:
8117 case FFEEXPR_contextDATAIMPDOITEM_
:
8121 case FFEEXPR_contextIOLIST
:
8122 case FFEEXPR_contextIOLISTDF
:
8123 case FFEEXPR_contextIMPDOITEM_
:
8124 case FFEEXPR_contextIMPDOITEMDF_
:
8129 assert ("bad context" == NULL
);
8135 callback
= ffeexpr_stack_
->callback
;
8136 ft
= ffeexpr_stack_
->first_token
;
8137 expr
= ffeexpr_stack_
->expr
;
8138 s
= ffeexpr_stack_
->previous
;
8139 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
,
8140 sizeof (*ffeexpr_stack_
));
8142 next
= (ffelexHandler
) (*callback
) (ft
, expr
, t
);
8143 ffelex_token_kill (ft
);
8146 ffesymbol_drive_sfnames (ffeexpr_check_impctrl_
);
8148 if (ffeexpr_level_
== 0)
8151 return (ffelexHandler
) next
;
8154 /* ffeexpr_cb_end_loc_ -- Handle end of %LOC subexpression
8156 Makes sure the end token is close-paren and swallows it, else issues
8157 an error message and doesn't swallow the token (passing it along instead).
8158 In either case wraps up subexpression construction by enclosing the
8159 ffebld expression in a %LOC. */
8161 static ffelexHandler
8162 ffeexpr_cb_end_loc_ (ffelexToken ft UNUSED
, ffebld expr
, ffelexToken t
)
8166 /* First push the (%LOC) expression as an operand onto the expression
8169 e
= ffeexpr_expr_new_ ();
8170 e
->type
= FFEEXPR_exprtypeOPERAND_
;
8171 e
->token
= ffeexpr_stack_
->tokens
[0];
8172 e
->u
.operand
= ffebld_new_percent_loc (expr
);
8173 ffebld_set_info (e
->u
.operand
,
8174 ffeinfo_new (FFEINFO_basictypeINTEGER
,
8175 ffecom_pointer_kind (),
8178 FFEINFO_whereFLEETING
,
8179 FFETARGET_charactersizeNONE
));
8181 e
->u
.operand
= ffeexpr_collapse_percent_loc (e
->u
.operand
, ft
);
8183 ffeexpr_exprstack_push_operand_ (e
);
8185 /* Now, if the token is a close parenthese, we're in great shape so return
8186 the next handler. */
8188 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
8190 ffelex_token_kill (ffeexpr_stack_
->tokens
[1]);
8191 return (ffelexHandler
) ffeexpr_token_binary_
;
8194 /* Oops, naughty user didn't specify the close paren! */
8196 if (ffest_ffebad_start (FFEBAD_MISSING_CLOSE_PAREN
))
8198 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
8199 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[1]),
8200 ffelex_token_where_column (ffeexpr_stack_
->tokens
[1]));
8204 ffelex_token_kill (ffeexpr_stack_
->tokens
[1]);
8206 (ffelexHandler
) ffeexpr_find_close_paren_ (t
,
8208 ffeexpr_token_binary_
);
8211 /* ffeexpr_cb_end_notloc_ -- PERCENT NAME(VAL,REF,DESCR) OPEN_PAREN expr
8213 Should be CLOSE_PAREN, and make sure expr isn't a %(VAL,REF,DESCR). */
8215 static ffelexHandler
8216 ffeexpr_cb_end_notloc_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
8221 /* If expression is itself a %(VAL,REF,DESCR), complain and strip off all
8222 such things until the lowest-level expression is reached. */
8224 op
= ffebld_op (expr
);
8225 if ((op
== FFEBLD_opPERCENT_VAL
) || (op
== FFEBLD_opPERCENT_REF
)
8226 || (op
== FFEBLD_opPERCENT_DESCR
))
8228 if (ffebad_start (FFEBAD_NESTED_PERCENT
))
8230 ffebad_here (0, ffelex_token_where_line (ft
),
8231 ffelex_token_where_column (ft
));
8237 expr
= ffebld_left (expr
);
8238 op
= ffebld_op (expr
);
8240 while ((op
== FFEBLD_opPERCENT_VAL
) || (op
== FFEBLD_opPERCENT_REF
)
8241 || (op
== FFEBLD_opPERCENT_DESCR
));
8244 /* Push the expression as an operand onto the expression stack. */
8246 e
= ffeexpr_expr_new_ ();
8247 e
->type
= FFEEXPR_exprtypeOPERAND_
;
8248 e
->token
= ffeexpr_stack_
->tokens
[0];
8249 switch (ffeexpr_stack_
->percent
)
8251 case FFEEXPR_percentVAL_
:
8252 e
->u
.operand
= ffebld_new_percent_val (expr
);
8255 case FFEEXPR_percentREF_
:
8256 e
->u
.operand
= ffebld_new_percent_ref (expr
);
8259 case FFEEXPR_percentDESCR_
:
8260 e
->u
.operand
= ffebld_new_percent_descr (expr
);
8264 assert ("%lossage" == NULL
);
8265 e
->u
.operand
= expr
;
8268 ffebld_set_info (e
->u
.operand
, ffebld_info (expr
));
8270 e
->u
.operand
= ffeexpr_collapse_percent_
? ? ? (e
->u
.operand
, ft
);
8272 ffeexpr_exprstack_push_operand_ (e
);
8274 /* Now, if the token is a close parenthese, we're in great shape so return
8275 the next handler. */
8277 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
8278 return (ffelexHandler
) ffeexpr_cb_end_notloc_1_
;
8280 /* Oops, naughty user didn't specify the close paren! */
8282 if (ffest_ffebad_start (FFEBAD_MISSING_CLOSE_PAREN
))
8284 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
8285 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[1]),
8286 ffelex_token_where_column (ffeexpr_stack_
->tokens
[1]));
8290 ffebld_set_op (e
->u
.operand
, FFEBLD_opPERCENT_LOC
);
8292 switch (ffeexpr_stack_
->context
)
8294 case FFEEXPR_contextACTUALARG_
:
8295 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
8298 case FFEEXPR_contextINDEXORACTUALARG_
:
8299 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
8302 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
8303 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
8306 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
8307 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
8311 assert ("bad context?!?!" == NULL
);
8315 ffelex_token_kill (ffeexpr_stack_
->tokens
[1]);
8317 (ffelexHandler
) ffeexpr_find_close_paren_ (t
,
8319 ffeexpr_cb_end_notloc_1_
);
8322 /* ffeexpr_cb_end_notloc_1_ -- PERCENT NAME(VAL,REF,DESCR) OPEN_PAREN expr
8325 Should be COMMA or CLOSE_PAREN, else change back to %LOC. */
8327 static ffelexHandler
8328 ffeexpr_cb_end_notloc_1_ (ffelexToken t
)
8330 switch (ffelex_token_type (t
))
8332 case FFELEX_typeCOMMA
:
8333 case FFELEX_typeCLOSE_PAREN
:
8334 switch (ffeexpr_stack_
->context
)
8336 case FFEEXPR_contextACTUALARG_
:
8337 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
8340 case FFEEXPR_contextINDEXORACTUALARG_
:
8341 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARG_
;
8344 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
8345 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARG_
;
8349 assert ("bad context?!?!" == NULL
);
8355 if (ffebad_start (FFEBAD_INVALID_PERCENT
))
8358 ffelex_token_where_line (ffeexpr_stack_
->first_token
),
8359 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
8360 ffebad_string (ffelex_token_text (ffeexpr_stack_
->tokens
[1]));
8364 ffebld_set_op (ffeexpr_stack_
->exprstack
->u
.operand
,
8365 FFEBLD_opPERCENT_LOC
);
8367 switch (ffeexpr_stack_
->context
)
8369 case FFEEXPR_contextACTUALARG_
:
8370 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
8373 case FFEEXPR_contextINDEXORACTUALARG_
:
8374 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
8377 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
8378 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
8381 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
8382 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
8386 assert ("bad context?!?!" == NULL
);
8391 ffelex_token_kill (ffeexpr_stack_
->tokens
[1]);
8393 (ffelexHandler
) ffeexpr_token_binary_ (t
);
8396 /* Process DATA implied-DO iterator variables as this implied-DO level
8397 terminates. At this point, ffeexpr_level_ == 1 when we see the
8398 last right-paren in "DATA (A(I),I=1,10)/.../". */
8401 ffeexpr_check_impctrl_ (ffesymbol s
)
8404 assert (ffesymbol_sfdummyparent (s
) != NULL
);
8406 switch (ffesymbol_state (s
))
8408 case FFESYMBOL_stateNONE
: /* Used as iterator already. Now let symbol
8409 be used as iterator at any level at or
8410 innermore than the outermost of the
8411 current level and the symbol's current
8413 if (ffeexpr_level_
< ffesymbol_maxentrynum (s
))
8415 ffesymbol_signal_change (s
);
8416 ffesymbol_set_maxentrynum (s
, ffeexpr_level_
);
8417 ffesymbol_signal_unreported (s
);
8421 case FFESYMBOL_stateSEEN
: /* Seen already in this or other implied-DO.
8422 Error if at outermost level, else it can
8423 still become an iterator. */
8424 if ((ffeexpr_level_
== 1)
8425 && ffebad_start (FFEBAD_BAD_IMPDCL
))
8427 ffebad_string (ffesymbol_text (s
));
8428 ffebad_here (0, ffesymbol_where_line (s
), ffesymbol_where_column (s
));
8433 case FFESYMBOL_stateUNCERTAIN
: /* Iterator. */
8434 assert (ffeexpr_level_
<= ffesymbol_maxentrynum (s
));
8435 ffesymbol_signal_change (s
);
8436 ffesymbol_set_state (s
, FFESYMBOL_stateNONE
);
8437 ffesymbol_signal_unreported (s
);
8440 case FFESYMBOL_stateUNDERSTOOD
:
8444 assert ("Sasha Foo!!" == NULL
);
8451 /* Issue diagnostic if implied-DO variable appears in list of lhs
8452 expressions (as in "READ *, (I,I=1,10)"). */
8455 ffeexpr_check_impdo_ (ffebld list
, ffelexToken list_t
,
8456 ffebld dovar
, ffelexToken dovar_t
)
8459 ffesymbol dovar_sym
;
8462 if (ffebld_op (dovar
) != FFEBLD_opSYMTER
)
8463 return; /* Presumably opANY. */
8465 dovar_sym
= ffebld_symter (dovar
);
8467 for (itemnum
= 1; list
!= NULL
; list
= ffebld_trail (list
), ++itemnum
)
8469 if (((item
= ffebld_head (list
)) != NULL
)
8470 && (ffebld_op (item
) == FFEBLD_opSYMTER
)
8471 && (ffebld_symter (item
) == dovar_sym
))
8475 sprintf (&itemno
[0], "%d", itemnum
);
8476 if (ffebad_start (FFEBAD_DOITER_IMPDO
))
8478 ffebad_here (0, ffelex_token_where_line (list_t
),
8479 ffelex_token_where_column (list_t
));
8480 ffebad_here (1, ffelex_token_where_line (dovar_t
),
8481 ffelex_token_where_column (dovar_t
));
8482 ffebad_string (ffesymbol_text (dovar_sym
));
8483 ffebad_string (itemno
);
8490 /* Decorate any SYMTERs referencing the DO variable with the "doiter"
8494 ffeexpr_update_impdo_ (ffebld list
, ffebld dovar
)
8496 ffesymbol dovar_sym
;
8498 if (ffebld_op (dovar
) != FFEBLD_opSYMTER
)
8499 return; /* Presumably opANY. */
8501 dovar_sym
= ffebld_symter (dovar
);
8503 ffeexpr_update_impdo_sym_ (list
, dovar_sym
); /* Recurse! */
8506 /* Recursive function to update any expr so SYMTERs have "doiter" flag
8507 if they refer to the given variable. */
8510 ffeexpr_update_impdo_sym_ (ffebld expr
, ffesymbol dovar
)
8512 tail_recurse
: /* :::::::::::::::::::: */
8517 switch (ffebld_op (expr
))
8519 case FFEBLD_opSYMTER
:
8520 if (ffebld_symter (expr
) == dovar
)
8521 ffebld_symter_set_is_doiter (expr
, TRUE
);
8525 ffeexpr_update_impdo_sym_ (ffebld_head (expr
), dovar
);
8526 expr
= ffebld_trail (expr
);
8527 goto tail_recurse
; /* :::::::::::::::::::: */
8533 switch (ffebld_arity (expr
))
8536 ffeexpr_update_impdo_sym_ (ffebld_left (expr
), dovar
);
8537 expr
= ffebld_right (expr
);
8538 goto tail_recurse
; /* :::::::::::::::::::: */
8541 expr
= ffebld_left (expr
);
8542 goto tail_recurse
; /* :::::::::::::::::::: */
8551 /* ffeexpr_context_outer_ -- Determine context of stack entry, skipping PARENs
8553 if (ffeexpr_context_outer_(ffeexpr_stack_) == FFEEXPR_contextIF)
8554 // After zero or more PAREN_ contexts, an IF context exists */
8556 static ffeexprContext
8557 ffeexpr_context_outer_ (ffeexprStack_ s
)
8565 case FFEEXPR_contextPAREN_
:
8566 case FFEEXPR_contextPARENFILENUM_
:
8567 case FFEEXPR_contextPARENFILEUNIT_
:
8578 /* ffeexpr_percent_ -- Look up name in list of %FOO possibilities
8582 p = ffeexpr_percent_(t);
8584 Returns the identifier for the name, or the NONE identifier. */
8586 static ffeexprPercent_
8587 ffeexpr_percent_ (ffelexToken t
)
8591 switch (ffelex_token_length (t
))
8594 switch (*(p
= ffelex_token_text (t
)))
8596 case FFESRC_CASE_MATCH_INIT ('L', 'l', match_3l
, no_match_3
):
8597 if ((ffesrc_char_match_noninit (*++p
, 'O', 'o'))
8598 && (ffesrc_char_match_noninit (*++p
, 'C', 'c')))
8599 return FFEEXPR_percentLOC_
;
8600 return FFEEXPR_percentNONE_
;
8602 case FFESRC_CASE_MATCH_INIT ('R', 'r', match_3r
, no_match_3
):
8603 if ((ffesrc_char_match_noninit (*++p
, 'E', 'e'))
8604 && (ffesrc_char_match_noninit (*++p
, 'F', 'f')))
8605 return FFEEXPR_percentREF_
;
8606 return FFEEXPR_percentNONE_
;
8608 case FFESRC_CASE_MATCH_INIT ('V', 'v', match_3v
, no_match_3
):
8609 if ((ffesrc_char_match_noninit (*++p
, 'A', 'a'))
8610 && (ffesrc_char_match_noninit (*++p
, 'L', 'l')))
8611 return FFEEXPR_percentVAL_
;
8612 return FFEEXPR_percentNONE_
;
8615 no_match_3
: /* :::::::::::::::::::: */
8616 return FFEEXPR_percentNONE_
;
8620 if (ffesrc_strcmp_2c (ffe_case_match (), ffelex_token_text (t
), "DESCR",
8621 "descr", "Descr") == 0)
8622 return FFEEXPR_percentDESCR_
;
8623 return FFEEXPR_percentNONE_
;
8626 return FFEEXPR_percentNONE_
;
8630 /* ffeexpr_type_combine -- Binop combine types, check for mythical new COMPLEX
8634 If combining the two basictype/kindtype pairs produces a COMPLEX with an
8635 unsupported kind type, complain and use the default kind type for
8639 ffeexpr_type_combine (ffeinfoBasictype
*xnbt
, ffeinfoKindtype
*xnkt
,
8640 ffeinfoBasictype lbt
, ffeinfoKindtype lkt
,
8641 ffeinfoBasictype rbt
, ffeinfoKindtype rkt
,
8644 ffeinfoBasictype nbt
;
8645 ffeinfoKindtype nkt
;
8647 nbt
= ffeinfo_basictype_combine (lbt
, rbt
);
8648 if ((nbt
== FFEINFO_basictypeCOMPLEX
)
8649 && ((lbt
== nbt
) || (lbt
== FFEINFO_basictypeREAL
))
8650 && ((rbt
== nbt
) || (rbt
== FFEINFO_basictypeREAL
)))
8652 nkt
= ffeinfo_kindtype_max (nbt
, lkt
, rkt
);
8653 if (ffe_is_pedantic_not_90 () && (nkt
== FFEINFO_kindtypeREALDOUBLE
))
8654 nkt
= FFEINFO_kindtypeNONE
; /* Force error. */
8657 #if FFETARGET_okCOMPLEX1
8658 case FFEINFO_kindtypeREAL1
:
8660 #if FFETARGET_okCOMPLEX2
8661 case FFEINFO_kindtypeREAL2
:
8663 #if FFETARGET_okCOMPLEX3
8664 case FFEINFO_kindtypeREAL3
:
8666 #if FFETARGET_okCOMPLEX4
8667 case FFEINFO_kindtypeREAL4
:
8669 break; /* Fine and dandy. */
8674 ffebad_start ((nkt
== FFEINFO_kindtypeREALDOUBLE
)
8675 ? FFEBAD_BAD_DBLCMPLX
: FFEBAD_BAD_COMPLEX
);
8676 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
8679 nbt
= FFEINFO_basictypeNONE
;
8680 nkt
= FFEINFO_kindtypeNONE
;
8683 case FFEINFO_kindtypeANY
:
8684 nkt
= FFEINFO_kindtypeREALDEFAULT
;
8689 { /* The normal stuff. */
8693 nkt
= ffeinfo_kindtype_max (nbt
, lkt
, rkt
);
8697 else if (nbt
== rbt
)
8700 { /* Let the caller do the complaining. */
8701 nbt
= FFEINFO_basictypeNONE
;
8702 nkt
= FFEINFO_kindtypeNONE
;
8706 /* Always a good idea to avoid aliasing problems. */
8712 /* ffeexpr_token_first_lhs_ -- First state for lhs expression
8714 Return a pointer to this function to the lexer (ffelex), which will
8715 invoke it for the next token.
8717 Record line and column of first token in expression, then invoke the
8718 initial-state lhs handler. */
8720 static ffelexHandler
8721 ffeexpr_token_first_lhs_ (ffelexToken t
)
8723 ffeexpr_stack_
->first_token
= ffelex_token_use (t
);
8725 /* When changing the list of valid initial lhs tokens, check whether to
8726 update a corresponding list in ffeexpr_cb_close_paren_ambig_1_ for the
8727 READ (expr) <token> case -- it assumes it knows which tokens <token> can
8728 be to indicate an lhs (or implied DO), which right now is the set
8731 This comment also appears in ffeexpr_token_lhs_. */
8733 switch (ffelex_token_type (t
))
8735 case FFELEX_typeOPEN_PAREN
:
8736 switch (ffeexpr_stack_
->context
)
8738 case FFEEXPR_contextDATA
:
8740 ffeexpr_level_
= 1; /* Level of DATA implied-DO construct. */
8741 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
8742 return (ffelexHandler
) ffeexpr_lhs (ffeexpr_stack_
->pool
,
8743 FFEEXPR_contextDATAIMPDOITEM_
, ffeexpr_cb_comma_i_
);
8745 case FFEEXPR_contextDATAIMPDOITEM_
:
8746 ++ffeexpr_level_
; /* Level of DATA implied-DO construct. */
8747 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
8748 return (ffelexHandler
) ffeexpr_lhs (ffeexpr_stack_
->pool
,
8749 FFEEXPR_contextDATAIMPDOITEM_
, ffeexpr_cb_comma_i_
);
8751 case FFEEXPR_contextIOLIST
:
8752 case FFEEXPR_contextIMPDOITEM_
:
8753 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
8754 return (ffelexHandler
) ffeexpr_lhs (ffeexpr_stack_
->pool
,
8755 FFEEXPR_contextIMPDOITEM_
, ffeexpr_cb_comma_i_
);
8757 case FFEEXPR_contextIOLISTDF
:
8758 case FFEEXPR_contextIMPDOITEMDF_
:
8759 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
8760 return (ffelexHandler
) ffeexpr_lhs (ffeexpr_stack_
->pool
,
8761 FFEEXPR_contextIMPDOITEMDF_
, ffeexpr_cb_comma_i_
);
8763 case FFEEXPR_contextFILEEXTFUNC
:
8764 assert (ffeexpr_stack_
->exprstack
== NULL
);
8765 return (ffelexHandler
) ffeexpr_token_first_lhs_1_
;
8772 case FFELEX_typeNAME
:
8773 switch (ffeexpr_stack_
->context
)
8775 case FFEEXPR_contextFILENAMELIST
:
8776 assert (ffeexpr_stack_
->exprstack
== NULL
);
8777 return (ffelexHandler
) ffeexpr_token_namelist_
;
8779 case FFEEXPR_contextFILEEXTFUNC
:
8780 assert (ffeexpr_stack_
->exprstack
== NULL
);
8781 return (ffelexHandler
) ffeexpr_token_first_lhs_1_
;
8789 switch (ffeexpr_stack_
->context
)
8791 case FFEEXPR_contextFILEEXTFUNC
:
8792 assert (ffeexpr_stack_
->exprstack
== NULL
);
8793 return (ffelexHandler
) ffeexpr_token_first_lhs_1_
;
8801 return (ffelexHandler
) ffeexpr_token_lhs_ (t
);
8804 /* ffeexpr_token_first_lhs_1_ -- NAME
8806 return ffeexpr_token_first_lhs_1_; // to lexer
8808 Handle NAME as an external function (USEROPEN= VXT extension to OPEN
8811 static ffelexHandler
8812 ffeexpr_token_first_lhs_1_ (ffelexToken t
)
8814 ffeexprCallback callback
;
8818 ffesymbol sy
= NULL
;
8822 callback
= ffeexpr_stack_
->callback
;
8823 ft
= ffeexpr_stack_
->first_token
;
8824 s
= ffeexpr_stack_
->previous
;
8826 if ((ffelex_token_type (ft
) != FFELEX_typeNAME
)
8827 || (ffesymbol_attrs (sy
= ffeexpr_declare_unadorned_ (ft
, FALSE
))
8828 & FFESYMBOL_attrANY
))
8830 if ((ffelex_token_type (ft
) != FFELEX_typeNAME
)
8831 || !(ffesymbol_attrs (sy
) & FFESYMBOL_attrsANY
))
8833 ffebad_start (FFEBAD_EXPR_WRONG
);
8834 ffebad_here (0, ffelex_token_where_line (ft
),
8835 ffelex_token_where_column (ft
));
8838 expr
= ffebld_new_any ();
8839 ffebld_set_info (expr
, ffeinfo_new_any ());
8843 expr
= ffebld_new_symter (sy
, FFEINTRIN_genNONE
, FFEINTRIN_specNONE
,
8845 ffebld_set_info (expr
, ffesymbol_info (sy
));
8848 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
,
8849 sizeof (*ffeexpr_stack_
));
8852 next
= (ffelexHandler
) (*callback
) (ft
, expr
, t
);
8853 ffelex_token_kill (ft
);
8854 return (ffelexHandler
) next
;
8857 /* ffeexpr_token_first_rhs_ -- First state for rhs expression
8859 Record line and column of first token in expression, then invoke the
8860 initial-state rhs handler.
8863 Allow ASTERISK in PARENFILEUNIT_ case, but only on second level only
8864 (i.e. only as in READ(*), not READ((*))). */
8866 static ffelexHandler
8867 ffeexpr_token_first_rhs_ (ffelexToken t
)
8871 ffeexpr_stack_
->first_token
= ffelex_token_use (t
);
8873 switch (ffelex_token_type (t
))
8875 case FFELEX_typeASTERISK
:
8876 switch (ffeexpr_stack_
->context
)
8878 case FFEEXPR_contextFILEFORMATNML
:
8879 ffeexpr_stack_
->context
= FFEEXPR_contextFILEFORMAT
;
8881 case FFEEXPR_contextFILEUNIT
:
8882 case FFEEXPR_contextDIMLIST
:
8883 case FFEEXPR_contextFILEFORMAT
:
8884 case FFEEXPR_contextCHARACTERSIZE
:
8885 if (ffeexpr_stack_
->previous
!= NULL
)
8886 break; /* Valid only on first level. */
8887 assert (ffeexpr_stack_
->exprstack
== NULL
);
8888 return (ffelexHandler
) ffeexpr_token_first_rhs_1_
;
8890 case FFEEXPR_contextPARENFILEUNIT_
:
8891 if (ffeexpr_stack_
->previous
->previous
!= NULL
)
8892 break; /* Valid only on second level. */
8893 assert (ffeexpr_stack_
->exprstack
== NULL
);
8894 return (ffelexHandler
) ffeexpr_token_first_rhs_1_
;
8896 case FFEEXPR_contextACTUALARG_
:
8897 if (ffeexpr_stack_
->previous
->context
8898 != FFEEXPR_contextSUBROUTINEREF
)
8900 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
8903 assert (ffeexpr_stack_
->exprstack
== NULL
);
8904 return (ffelexHandler
) ffeexpr_token_first_rhs_3_
;
8906 case FFEEXPR_contextINDEXORACTUALARG_
:
8907 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
8910 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
8911 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
8914 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
8915 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
8923 case FFELEX_typeOPEN_PAREN
:
8924 switch (ffeexpr_stack_
->context
)
8926 case FFEEXPR_contextFILENUMAMBIG
:
8927 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
8928 FFEEXPR_contextPARENFILENUM_
,
8929 ffeexpr_cb_close_paren_ambig_
);
8931 case FFEEXPR_contextFILEUNITAMBIG
:
8932 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
8933 FFEEXPR_contextPARENFILEUNIT_
,
8934 ffeexpr_cb_close_paren_ambig_
);
8936 case FFEEXPR_contextIOLIST
:
8937 case FFEEXPR_contextIMPDOITEM_
:
8938 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
8939 FFEEXPR_contextIMPDOITEM_
,
8940 ffeexpr_cb_close_paren_ci_
);
8942 case FFEEXPR_contextIOLISTDF
:
8943 case FFEEXPR_contextIMPDOITEMDF_
:
8944 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
8945 FFEEXPR_contextIMPDOITEMDF_
,
8946 ffeexpr_cb_close_paren_ci_
);
8948 case FFEEXPR_contextFILEFORMATNML
:
8949 ffeexpr_stack_
->context
= FFEEXPR_contextFILEFORMAT
;
8952 case FFEEXPR_contextACTUALARG_
:
8953 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
8956 case FFEEXPR_contextINDEXORACTUALARG_
:
8957 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
8960 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
8961 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
8964 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
8965 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
8973 case FFELEX_typeNUMBER
:
8974 switch (ffeexpr_stack_
->context
)
8976 case FFEEXPR_contextFILEFORMATNML
:
8977 ffeexpr_stack_
->context
= FFEEXPR_contextFILEFORMAT
;
8979 case FFEEXPR_contextFILEFORMAT
:
8980 if (ffeexpr_stack_
->previous
!= NULL
)
8981 break; /* Valid only on first level. */
8982 assert (ffeexpr_stack_
->exprstack
== NULL
);
8983 return (ffelexHandler
) ffeexpr_token_first_rhs_2_
;
8985 case FFEEXPR_contextACTUALARG_
:
8986 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
8989 case FFEEXPR_contextINDEXORACTUALARG_
:
8990 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
8993 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
8994 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
8997 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
8998 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
9006 case FFELEX_typeNAME
:
9007 switch (ffeexpr_stack_
->context
)
9009 case FFEEXPR_contextFILEFORMATNML
:
9010 assert (ffeexpr_stack_
->exprstack
== NULL
);
9011 s
= ffesymbol_lookup_local (t
);
9012 if ((s
!= NULL
) && (ffesymbol_kind (s
) == FFEINFO_kindNAMELIST
))
9013 return (ffelexHandler
) ffeexpr_token_namelist_
;
9014 ffeexpr_stack_
->context
= FFEEXPR_contextFILEFORMAT
;
9022 case FFELEX_typePERCENT
:
9023 switch (ffeexpr_stack_
->context
)
9025 case FFEEXPR_contextACTUALARG_
:
9026 case FFEEXPR_contextINDEXORACTUALARG_
:
9027 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
9028 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
9029 return (ffelexHandler
) ffeexpr_token_first_rhs_5_
;
9031 case FFEEXPR_contextFILEFORMATNML
:
9032 ffeexpr_stack_
->context
= FFEEXPR_contextFILEFORMAT
;
9040 switch (ffeexpr_stack_
->context
)
9042 case FFEEXPR_contextACTUALARG_
:
9043 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
9046 case FFEEXPR_contextINDEXORACTUALARG_
:
9047 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
9050 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
9051 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
9054 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
9055 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
9058 case FFEEXPR_contextFILEFORMATNML
:
9059 ffeexpr_stack_
->context
= FFEEXPR_contextFILEFORMAT
;
9068 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
9071 /* ffeexpr_token_first_rhs_1_ -- ASTERISK
9073 return ffeexpr_token_first_rhs_1_; // to lexer
9075 Return STAR as expression. */
9077 static ffelexHandler
9078 ffeexpr_token_first_rhs_1_ (ffelexToken t
)
9081 ffeexprCallback callback
;
9086 expr
= ffebld_new_star ();
9088 callback
= ffeexpr_stack_
->callback
;
9089 ft
= ffeexpr_stack_
->first_token
;
9090 s
= ffeexpr_stack_
->previous
;
9091 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
, sizeof (*ffeexpr_stack_
));
9093 next
= (ffelexHandler
) (*callback
) (ft
, expr
, t
);
9094 ffelex_token_kill (ft
);
9095 return (ffelexHandler
) next
;
9098 /* ffeexpr_token_first_rhs_2_ -- NUMBER
9100 return ffeexpr_token_first_rhs_2_; // to lexer
9102 Return NULL as expression; NUMBER as first (and only) token, unless the
9103 current token is not a terminating token, in which case run normal
9104 expression handling. */
9106 static ffelexHandler
9107 ffeexpr_token_first_rhs_2_ (ffelexToken t
)
9109 ffeexprCallback callback
;
9114 switch (ffelex_token_type (t
))
9116 case FFELEX_typeCLOSE_PAREN
:
9117 case FFELEX_typeCOMMA
:
9118 case FFELEX_typeEOS
:
9119 case FFELEX_typeSEMICOLON
:
9123 next
= (ffelexHandler
) ffeexpr_token_rhs_ (ffeexpr_stack_
->first_token
);
9124 return (ffelexHandler
) (*next
) (t
);
9128 callback
= ffeexpr_stack_
->callback
;
9129 ft
= ffeexpr_stack_
->first_token
;
9130 s
= ffeexpr_stack_
->previous
;
9131 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
,
9132 sizeof (*ffeexpr_stack_
));
9134 next
= (ffelexHandler
) (*callback
) (ft
, NULL
, t
);
9135 ffelex_token_kill (ft
);
9136 return (ffelexHandler
) next
;
9139 /* ffeexpr_token_first_rhs_3_ -- ASTERISK
9141 return ffeexpr_token_first_rhs_3_; // to lexer
9143 Expect NUMBER, make LABTOK (with copy of token if not inhibited after
9144 confirming, else NULL). */
9146 static ffelexHandler
9147 ffeexpr_token_first_rhs_3_ (ffelexToken t
)
9151 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
9152 { /* An error, but let normal processing handle
9154 next
= (ffelexHandler
) ffeexpr_token_rhs_ (ffeexpr_stack_
->first_token
);
9155 return (ffelexHandler
) (*next
) (t
);
9158 /* Special case: when we see "*10" as an argument to a subroutine
9159 reference, we confirm the current statement and, if not inhibited at
9160 this point, put a copy of the token into a LABTOK node. We do this
9161 instead of just resolving the label directly via ffelab and putting it
9162 into a LABTER simply to improve error reporting and consistency in
9163 ffestc. We put NULL in the LABTOK if we're still inhibited, so ffestb
9164 doesn't have to worry about killing off any tokens when retracting. */
9167 if (ffest_is_inhibited ())
9168 ffeexpr_stack_
->expr
= ffebld_new_labtok (NULL
);
9170 ffeexpr_stack_
->expr
= ffebld_new_labtok (ffelex_token_use (t
));
9171 ffebld_set_info (ffeexpr_stack_
->expr
,
9172 ffeinfo_new (FFEINFO_basictypeNONE
,
9173 FFEINFO_kindtypeNONE
,
9177 FFETARGET_charactersizeNONE
));
9179 return (ffelexHandler
) ffeexpr_token_first_rhs_4_
;
9182 /* ffeexpr_token_first_rhs_4_ -- ASTERISK NUMBER
9184 return ffeexpr_token_first_rhs_4_; // to lexer
9186 Collect/flush appropriate stuff, send token to callback function. */
9188 static ffelexHandler
9189 ffeexpr_token_first_rhs_4_ (ffelexToken t
)
9192 ffeexprCallback callback
;
9197 expr
= ffeexpr_stack_
->expr
;
9199 callback
= ffeexpr_stack_
->callback
;
9200 ft
= ffeexpr_stack_
->first_token
;
9201 s
= ffeexpr_stack_
->previous
;
9202 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
, sizeof (*ffeexpr_stack_
));
9204 next
= (ffelexHandler
) (*callback
) (ft
, expr
, t
);
9205 ffelex_token_kill (ft
);
9206 return (ffelexHandler
) next
;
9209 /* ffeexpr_token_first_rhs_5_ -- PERCENT
9211 Should be NAME, or pass through original mechanism. If NAME is LOC,
9212 pass through original mechanism, otherwise must be VAL, REF, or DESCR,
9213 in which case handle the argument (in parentheses), etc. */
9215 static ffelexHandler
9216 ffeexpr_token_first_rhs_5_ (ffelexToken t
)
9220 if (ffelex_token_type (t
) == FFELEX_typeNAME
)
9222 ffeexprPercent_ p
= ffeexpr_percent_ (t
);
9226 case FFEEXPR_percentNONE_
:
9227 case FFEEXPR_percentLOC_
:
9228 break; /* Treat %LOC as any other expression. */
9230 case FFEEXPR_percentVAL_
:
9231 case FFEEXPR_percentREF_
:
9232 case FFEEXPR_percentDESCR_
:
9233 ffeexpr_stack_
->percent
= p
;
9234 ffeexpr_stack_
->tokens
[0] = ffelex_token_use (t
);
9235 return (ffelexHandler
) ffeexpr_token_first_rhs_6_
;
9238 assert ("bad percent?!?" == NULL
);
9243 switch (ffeexpr_stack_
->context
)
9245 case FFEEXPR_contextACTUALARG_
:
9246 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
9249 case FFEEXPR_contextINDEXORACTUALARG_
:
9250 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
9253 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
9254 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
9257 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
9258 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
9262 assert ("bad context?!?!" == NULL
);
9266 next
= (ffelexHandler
) ffeexpr_token_rhs_ (ffeexpr_stack_
->first_token
);
9267 return (ffelexHandler
) (*next
) (t
);
9270 /* ffeexpr_token_first_rhs_6_ -- PERCENT NAME(VAL,REF,DESCR)
9272 Should be OPEN_PAREN, or pass through original mechanism. */
9274 static ffelexHandler
9275 ffeexpr_token_first_rhs_6_ (ffelexToken t
)
9280 if (ffelex_token_type (t
) == FFELEX_typeOPEN_PAREN
)
9282 ffeexpr_stack_
->tokens
[1] = ffelex_token_use (t
);
9283 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
9284 ffeexpr_stack_
->context
,
9285 ffeexpr_cb_end_notloc_
);
9288 switch (ffeexpr_stack_
->context
)
9290 case FFEEXPR_contextACTUALARG_
:
9291 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
9294 case FFEEXPR_contextINDEXORACTUALARG_
:
9295 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
9298 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
9299 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
9302 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
9303 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
9307 assert ("bad context?!?!" == NULL
);
9311 ft
= ffeexpr_stack_
->tokens
[0];
9312 next
= (ffelexHandler
) ffeexpr_token_rhs_ (ffeexpr_stack_
->first_token
);
9313 next
= (ffelexHandler
) (*next
) (ft
);
9314 ffelex_token_kill (ft
);
9315 return (ffelexHandler
) (*next
) (t
);
9318 /* ffeexpr_token_namelist_ -- NAME
9320 return ffeexpr_token_namelist_; // to lexer
9322 Make sure NAME was a valid namelist object, wrap it in a SYMTER and
9325 static ffelexHandler
9326 ffeexpr_token_namelist_ (ffelexToken t
)
9328 ffeexprCallback callback
;
9336 callback
= ffeexpr_stack_
->callback
;
9337 ft
= ffeexpr_stack_
->first_token
;
9338 s
= ffeexpr_stack_
->previous
;
9339 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
, sizeof (*ffeexpr_stack_
));
9342 sy
= ffesymbol_lookup_local (ft
);
9343 if ((sy
== NULL
) || (ffesymbol_kind (sy
) != FFEINFO_kindNAMELIST
))
9345 ffebad_start (FFEBAD_EXPR_WRONG
);
9346 ffebad_here (0, ffelex_token_where_line (ft
),
9347 ffelex_token_where_column (ft
));
9349 expr
= ffebld_new_any ();
9350 ffebld_set_info (expr
, ffeinfo_new_any ());
9354 expr
= ffebld_new_symter (sy
, FFEINTRIN_genNONE
, FFEINTRIN_specNONE
,
9356 ffebld_set_info (expr
, ffesymbol_info (sy
));
9358 next
= (ffelexHandler
) (*callback
) (ft
, expr
, t
);
9359 ffelex_token_kill (ft
);
9360 return (ffelexHandler
) next
;
9363 /* ffeexpr_expr_kill_ -- Kill an existing internal expression object
9366 ffeexpr_expr_kill_(e);
9368 Kills the ffewhere info, if necessary, then kills the object. */
9371 ffeexpr_expr_kill_ (ffeexprExpr_ e
)
9373 if (e
->token
!= NULL
)
9374 ffelex_token_kill (e
->token
);
9375 malloc_kill_ks (ffe_pool_program_unit (), e
, sizeof (*e
));
9378 /* ffeexpr_expr_new_ -- Make a new internal expression object
9381 e = ffeexpr_expr_new_();
9383 Allocates and initializes a new expression object, returns it. */
9386 ffeexpr_expr_new_ ()
9390 e
= (ffeexprExpr_
) malloc_new_ks (ffe_pool_program_unit (), "FFEEXPR expr",
9393 e
->type
= FFEEXPR_exprtypeUNKNOWN_
;
9398 /* Verify that call to global is valid, and register whatever
9399 new information about a global might be discoverable by looking
9403 ffeexpr_fulfill_call_ (ffebld
*expr
, ffelexToken t
)
9410 assert ((ffebld_op (*expr
) == FFEBLD_opSUBRREF
)
9411 || (ffebld_op (*expr
) == FFEBLD_opFUNCREF
));
9413 if (ffebld_op (ffebld_left (*expr
)) != FFEBLD_opSYMTER
)
9416 if (ffesymbol_retractable ())
9419 s
= ffebld_symter (ffebld_left (*expr
));
9420 if (ffesymbol_global (s
) == NULL
)
9423 for (n_args
= 0, list
= ffebld_right (*expr
);
9425 list
= ffebld_trail (list
), ++n_args
)
9428 if (ffeglobal_proc_ref_nargs (s
, n_args
, t
))
9430 ffeglobalArgSummary as
;
9431 ffeinfoBasictype bt
;
9436 for (n_args
= 0, list
= ffebld_right (*expr
);
9438 list
= ffebld_trail (list
), ++n_args
)
9440 item
= ffebld_head (list
);
9443 bt
= ffeinfo_basictype (ffebld_info (item
));
9444 kt
= ffeinfo_kindtype (ffebld_info (item
));
9445 array
= (ffeinfo_rank (ffebld_info (item
)) > 0);
9446 switch (ffebld_op (item
))
9448 case FFEBLD_opLABTOK
:
9449 case FFEBLD_opLABTER
:
9450 as
= FFEGLOBAL_argsummaryALTRTN
;
9454 /* No, %LOC(foo) is just like any INTEGER(KIND=7)
9455 expression, so don't treat it specially. */
9456 case FFEBLD_opPERCENT_LOC
:
9457 as
= FFEGLOBAL_argsummaryPTR
;
9461 case FFEBLD_opPERCENT_VAL
:
9462 as
= FFEGLOBAL_argsummaryVAL
;
9465 case FFEBLD_opPERCENT_REF
:
9466 as
= FFEGLOBAL_argsummaryREF
;
9469 case FFEBLD_opPERCENT_DESCR
:
9470 as
= FFEGLOBAL_argsummaryDESCR
;
9473 case FFEBLD_opFUNCREF
:
9475 /* No, LOC(foo) is just like any INTEGER(KIND=7)
9476 expression, so don't treat it specially. */
9477 if ((ffebld_op (ffebld_left (item
)) == FFEBLD_opSYMTER
)
9478 && (ffesymbol_specific (ffebld_symter (ffebld_left (item
)))
9479 == FFEINTRIN_specLOC
))
9481 as
= FFEGLOBAL_argsummaryPTR
;
9487 if (ffebld_op (item
) == FFEBLD_opSYMTER
)
9489 as
= FFEGLOBAL_argsummaryNONE
;
9491 switch (ffeinfo_kind (ffebld_info (item
)))
9493 case FFEINFO_kindFUNCTION
:
9494 as
= FFEGLOBAL_argsummaryFUNC
;
9497 case FFEINFO_kindSUBROUTINE
:
9498 as
= FFEGLOBAL_argsummarySUBR
;
9501 case FFEINFO_kindNONE
:
9502 as
= FFEGLOBAL_argsummaryPROC
;
9509 if (as
!= FFEGLOBAL_argsummaryNONE
)
9513 if (bt
== FFEINFO_basictypeCHARACTER
)
9514 as
= FFEGLOBAL_argsummaryDESCR
;
9516 as
= FFEGLOBAL_argsummaryREF
;
9523 as
= FFEGLOBAL_argsummaryNONE
;
9524 bt
= FFEINFO_basictypeNONE
;
9525 kt
= FFEINFO_kindtypeNONE
;
9528 if (! ffeglobal_proc_ref_arg (s
, n_args
, as
, bt
, kt
, array
, t
))
9535 *expr
= ffebld_new_any ();
9536 ffebld_set_info (*expr
, ffeinfo_new_any ());
9539 /* Check whether rest of string is all decimal digits. */
9542 ffeexpr_isdigits_ (const char *p
)
9544 for (; *p
!= '\0'; ++p
)
9550 /* ffeexpr_exprstack_push_ -- Push an arbitrary expression object onto the stack
9553 ffeexpr_exprstack_push_(e);
9555 Pushes the expression onto the stack without any analysis of the existing
9556 contents of the stack. */
9559 ffeexpr_exprstack_push_ (ffeexprExpr_ e
)
9561 e
->previous
= ffeexpr_stack_
->exprstack
;
9562 ffeexpr_stack_
->exprstack
= e
;
9565 /* ffeexpr_exprstack_push_operand_ -- Push an operand onto the stack, reduce?
9568 ffeexpr_exprstack_push_operand_(e);
9570 Pushes the expression already containing an operand (a constant, variable,
9571 or more complicated expression that has already been fully resolved) after
9572 analyzing the stack and checking for possible reduction (which will never
9573 happen here since the highest precedence operator is ** and it has right-
9574 to-left associativity). */
9577 ffeexpr_exprstack_push_operand_ (ffeexprExpr_ e
)
9579 ffeexpr_exprstack_push_ (e
);
9580 #ifdef WEIRD_NONFORTRAN_RULES
9581 if ((ffeexpr_stack_
->exprstack
!= NULL
)
9582 && (ffeexpr_stack_
->exprstack
->expr
->type
== FFEEXPR_exprtypeBINARY_
)
9583 && (ffeexpr_stack_
->exprstack
->expr
->u
.operator.prec
9584 == FFEEXPR_operatorprecedenceHIGHEST_
)
9585 && (ffeexpr_stack_
->exprstack
->expr
->u
.operator.as
9586 == FFEEXPR_operatorassociativityL2R_
))
9591 /* ffeexpr_exprstack_push_unary_ -- Push a unary operator onto the stack
9594 ffeexpr_exprstack_push_unary_(e);
9596 Pushes the expression already containing a unary operator. Reduction can
9597 never happen since unary operators are themselves always R-L; that is, the
9598 top of the expression stack is not an operand, in that it is either empty,
9599 has a binary operator at the top, or a unary operator at the top. In any
9600 of these cases, reduction is impossible. */
9603 ffeexpr_exprstack_push_unary_ (ffeexprExpr_ e
)
9605 if ((ffe_is_pedantic ()
9606 || ffe_is_warn_surprising ())
9607 && (ffeexpr_stack_
->exprstack
!= NULL
)
9608 && (ffeexpr_stack_
->exprstack
->type
!= FFEEXPR_exprtypeOPERAND_
)
9609 && (ffeexpr_stack_
->exprstack
->u
.operator.prec
9610 <= FFEEXPR_operatorprecedenceLOWARITH_
)
9611 && (e
->u
.operator.prec
<= FFEEXPR_operatorprecedenceLOWARITH_
))
9613 /* xgettext:no-c-format */
9614 ffebad_start_msg ("Two arithmetic operators in a row at %0 and %1 -- use parentheses",
9616 ? FFEBAD_severityPEDANTIC
9617 : FFEBAD_severityWARNING
);
9619 ffelex_token_where_line (ffeexpr_stack_
->exprstack
->token
),
9620 ffelex_token_where_column (ffeexpr_stack_
->exprstack
->token
));
9622 ffelex_token_where_line (e
->token
),
9623 ffelex_token_where_column (e
->token
));
9627 ffeexpr_exprstack_push_ (e
);
9630 /* ffeexpr_exprstack_push_binary_ -- Push a binary operator onto the stack, reduce?
9633 ffeexpr_exprstack_push_binary_(e);
9635 Pushes the expression already containing a binary operator after checking
9636 whether reduction is possible. If the stack is not empty, the top of the
9637 stack must be an operand or syntactic analysis has failed somehow. If
9638 the operand is preceded by a unary operator of higher (or equal and L-R
9639 associativity) precedence than the new binary operator, then reduce that
9640 preceding operator and its operand(s) before pushing the new binary
9644 ffeexpr_exprstack_push_binary_ (ffeexprExpr_ e
)
9648 if (ffe_is_warn_surprising ()
9649 /* These next two are always true (see assertions below). */
9650 && (ffeexpr_stack_
->exprstack
!= NULL
)
9651 && (ffeexpr_stack_
->exprstack
->type
== FFEEXPR_exprtypeOPERAND_
)
9652 /* If the previous operator is a unary minus, and the binary op
9653 is of higher precedence, might not do what user expects,
9654 e.g. "-2**2" is "-(2**2)", i.e. "-4", not "(-2)**2", which would
9656 && (ffeexpr_stack_
->exprstack
->previous
!= NULL
)
9657 && (ffeexpr_stack_
->exprstack
->previous
->type
== FFEEXPR_exprtypeUNARY_
)
9658 && (ffeexpr_stack_
->exprstack
->previous
->u
.operator.op
9659 == FFEEXPR_operatorSUBTRACT_
)
9660 && (e
->u
.operator.prec
9661 < ffeexpr_stack_
->exprstack
->previous
->u
.operator.prec
))
9663 /* xgettext:no-c-format */
9664 ffebad_start_msg ("Operator at %0 has lower precedence than that at %1 -- use parentheses", FFEBAD_severityWARNING
);
9666 ffelex_token_where_line (ffeexpr_stack_
->exprstack
->previous
->token
),
9667 ffelex_token_where_column (ffeexpr_stack_
->exprstack
->previous
->token
));
9669 ffelex_token_where_line (e
->token
),
9670 ffelex_token_where_column (e
->token
));
9675 assert (ffeexpr_stack_
->exprstack
!= NULL
);
9676 assert (ffeexpr_stack_
->exprstack
->type
== FFEEXPR_exprtypeOPERAND_
);
9677 if ((ce
= ffeexpr_stack_
->exprstack
->previous
) != NULL
)
9679 assert (ce
->type
!= FFEEXPR_exprtypeOPERAND_
);
9680 if ((ce
->u
.operator.prec
< e
->u
.operator.prec
)
9681 || ((ce
->u
.operator.prec
== e
->u
.operator.prec
)
9682 && (e
->u
.operator.as
== FFEEXPR_operatorassociativityL2R_
)))
9685 goto again
; /* :::::::::::::::::::: */
9689 ffeexpr_exprstack_push_ (e
);
9692 /* ffeexpr_reduce_ -- Reduce highest operator w/operands on stack
9696 Converts operand binop operand or unop operand at top of stack to a
9697 single operand having the appropriate ffebld expression, and makes
9698 sure that the expression is proper (like not trying to add two character
9699 variables, not trying to concatenate two numbers). Also does the
9700 requisite type-assignment. */
9705 ffeexprExpr_ operand
; /* This is B in -B or A+B. */
9706 ffeexprExpr_ left_operand
; /* When operator is binary, this is A in A+B. */
9707 ffeexprExpr_
operator; /* This is + in A+B. */
9708 ffebld reduced
; /* This is +(A,B) in A+B or u-(B) in -B. */
9709 ffebldConstant constnode
; /* For checking magical numbers (where mag ==
9713 bool submag
= FALSE
;
9715 operand
= ffeexpr_stack_
->exprstack
;
9716 assert (operand
!= NULL
);
9717 assert (operand
->type
== FFEEXPR_exprtypeOPERAND_
);
9718 operator = operand
->previous
;
9719 assert (operator != NULL
);
9720 assert (operator->type
!= FFEEXPR_exprtypeOPERAND_
);
9721 if (operator->type
== FFEEXPR_exprtypeUNARY_
)
9723 expr
= operand
->u
.operand
;
9724 switch (operator->u
.operator.op
)
9726 case FFEEXPR_operatorADD_
:
9727 reduced
= ffebld_new_uplus (expr
);
9728 if (ffe_is_ugly_logint ())
9729 reduced
= ffeexpr_reduced_ugly1_ (reduced
, operator, operand
);
9730 reduced
= ffeexpr_reduced_math1_ (reduced
, operator, operand
);
9731 reduced
= ffeexpr_collapse_uplus (reduced
, operator->token
);
9734 case FFEEXPR_operatorSUBTRACT_
:
9735 submag
= TRUE
; /* Ok to negate a magic number. */
9736 reduced
= ffebld_new_uminus (expr
);
9737 if (ffe_is_ugly_logint ())
9738 reduced
= ffeexpr_reduced_ugly1_ (reduced
, operator, operand
);
9739 reduced
= ffeexpr_reduced_math1_ (reduced
, operator, operand
);
9740 reduced
= ffeexpr_collapse_uminus (reduced
, operator->token
);
9743 case FFEEXPR_operatorNOT_
:
9744 reduced
= ffebld_new_not (expr
);
9745 if (ffe_is_ugly_logint ())
9746 reduced
= ffeexpr_reduced_ugly1log_ (reduced
, operator, operand
);
9747 reduced
= ffeexpr_reduced_bool1_ (reduced
, operator, operand
);
9748 reduced
= ffeexpr_collapse_not (reduced
, operator->token
);
9752 assert ("unexpected unary op" != NULL
);
9757 && (ffebld_op (expr
) == FFEBLD_opCONTER
)
9758 && (ffebld_conter_orig (expr
) == NULL
)
9759 && ffebld_constant_is_magical (constnode
= ffebld_conter (expr
)))
9761 ffetarget_integer_bad_magical (operand
->token
);
9763 ffeexpr_stack_
->exprstack
= operator->previous
; /* Pops unary-op operand
9765 ffeexpr_expr_kill_ (operand
);
9766 operator->type
= FFEEXPR_exprtypeOPERAND_
; /* Convert operator, but
9768 operator->u
.operand
= reduced
; /* the line/column ffewhere info. */
9769 ffeexpr_exprstack_push_operand_ (operator); /* Push it back on
9774 assert (operator->type
== FFEEXPR_exprtypeBINARY_
);
9775 left_operand
= operator->previous
;
9776 assert (left_operand
!= NULL
);
9777 assert (left_operand
->type
== FFEEXPR_exprtypeOPERAND_
);
9778 expr
= operand
->u
.operand
;
9779 left_expr
= left_operand
->u
.operand
;
9780 switch (operator->u
.operator.op
)
9782 case FFEEXPR_operatorADD_
:
9783 reduced
= ffebld_new_add (left_expr
, expr
);
9784 if (ffe_is_ugly_logint ())
9785 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9787 reduced
= ffeexpr_reduced_math2_ (reduced
, left_operand
, operator,
9789 reduced
= ffeexpr_collapse_add (reduced
, operator->token
);
9792 case FFEEXPR_operatorSUBTRACT_
:
9793 submag
= TRUE
; /* Just to pick the right error if magic
9795 reduced
= ffebld_new_subtract (left_expr
, expr
);
9796 if (ffe_is_ugly_logint ())
9797 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9799 reduced
= ffeexpr_reduced_math2_ (reduced
, left_operand
, operator,
9801 reduced
= ffeexpr_collapse_subtract (reduced
, operator->token
);
9804 case FFEEXPR_operatorMULTIPLY_
:
9805 reduced
= ffebld_new_multiply (left_expr
, expr
);
9806 if (ffe_is_ugly_logint ())
9807 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9809 reduced
= ffeexpr_reduced_math2_ (reduced
, left_operand
, operator,
9811 reduced
= ffeexpr_collapse_multiply (reduced
, operator->token
);
9814 case FFEEXPR_operatorDIVIDE_
:
9815 reduced
= ffebld_new_divide (left_expr
, expr
);
9816 if (ffe_is_ugly_logint ())
9817 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9819 reduced
= ffeexpr_reduced_math2_ (reduced
, left_operand
, operator,
9821 reduced
= ffeexpr_collapse_divide (reduced
, operator->token
);
9824 case FFEEXPR_operatorPOWER_
:
9825 reduced
= ffebld_new_power (left_expr
, expr
);
9826 if (ffe_is_ugly_logint ())
9827 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9829 reduced
= ffeexpr_reduced_power_ (reduced
, left_operand
, operator,
9831 reduced
= ffeexpr_collapse_power (reduced
, operator->token
);
9834 case FFEEXPR_operatorCONCATENATE_
:
9835 reduced
= ffebld_new_concatenate (left_expr
, expr
);
9836 reduced
= ffeexpr_reduced_concatenate_ (reduced
, left_operand
, operator,
9838 reduced
= ffeexpr_collapse_concatenate (reduced
, operator->token
);
9841 case FFEEXPR_operatorLT_
:
9842 reduced
= ffebld_new_lt (left_expr
, expr
);
9843 if (ffe_is_ugly_logint ())
9844 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9846 reduced
= ffeexpr_reduced_relop2_ (reduced
, left_operand
, operator,
9848 reduced
= ffeexpr_collapse_lt (reduced
, operator->token
);
9851 case FFEEXPR_operatorLE_
:
9852 reduced
= ffebld_new_le (left_expr
, expr
);
9853 if (ffe_is_ugly_logint ())
9854 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9856 reduced
= ffeexpr_reduced_relop2_ (reduced
, left_operand
, operator,
9858 reduced
= ffeexpr_collapse_le (reduced
, operator->token
);
9861 case FFEEXPR_operatorEQ_
:
9862 reduced
= ffebld_new_eq (left_expr
, expr
);
9863 if (ffe_is_ugly_logint ())
9864 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9866 reduced
= ffeexpr_reduced_eqop2_ (reduced
, left_operand
, operator,
9868 reduced
= ffeexpr_collapse_eq (reduced
, operator->token
);
9871 case FFEEXPR_operatorNE_
:
9872 reduced
= ffebld_new_ne (left_expr
, expr
);
9873 if (ffe_is_ugly_logint ())
9874 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9876 reduced
= ffeexpr_reduced_eqop2_ (reduced
, left_operand
, operator,
9878 reduced
= ffeexpr_collapse_ne (reduced
, operator->token
);
9881 case FFEEXPR_operatorGT_
:
9882 reduced
= ffebld_new_gt (left_expr
, expr
);
9883 if (ffe_is_ugly_logint ())
9884 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9886 reduced
= ffeexpr_reduced_relop2_ (reduced
, left_operand
, operator,
9888 reduced
= ffeexpr_collapse_gt (reduced
, operator->token
);
9891 case FFEEXPR_operatorGE_
:
9892 reduced
= ffebld_new_ge (left_expr
, expr
);
9893 if (ffe_is_ugly_logint ())
9894 reduced
= ffeexpr_reduced_ugly2_ (reduced
, left_operand
, operator,
9896 reduced
= ffeexpr_reduced_relop2_ (reduced
, left_operand
, operator,
9898 reduced
= ffeexpr_collapse_ge (reduced
, operator->token
);
9901 case FFEEXPR_operatorAND_
:
9902 reduced
= ffebld_new_and (left_expr
, expr
);
9903 if (ffe_is_ugly_logint ())
9904 reduced
= ffeexpr_reduced_ugly2log_ (reduced
, left_operand
, operator,
9906 reduced
= ffeexpr_reduced_bool2_ (reduced
, left_operand
, operator,
9908 reduced
= ffeexpr_collapse_and (reduced
, operator->token
);
9911 case FFEEXPR_operatorOR_
:
9912 reduced
= ffebld_new_or (left_expr
, expr
);
9913 if (ffe_is_ugly_logint ())
9914 reduced
= ffeexpr_reduced_ugly2log_ (reduced
, left_operand
, operator,
9916 reduced
= ffeexpr_reduced_bool2_ (reduced
, left_operand
, operator,
9918 reduced
= ffeexpr_collapse_or (reduced
, operator->token
);
9921 case FFEEXPR_operatorXOR_
:
9922 reduced
= ffebld_new_xor (left_expr
, expr
);
9923 if (ffe_is_ugly_logint ())
9924 reduced
= ffeexpr_reduced_ugly2log_ (reduced
, left_operand
, operator,
9926 reduced
= ffeexpr_reduced_bool2_ (reduced
, left_operand
, operator,
9928 reduced
= ffeexpr_collapse_xor (reduced
, operator->token
);
9931 case FFEEXPR_operatorEQV_
:
9932 reduced
= ffebld_new_eqv (left_expr
, expr
);
9933 if (ffe_is_ugly_logint ())
9934 reduced
= ffeexpr_reduced_ugly2log_ (reduced
, left_operand
, operator,
9936 reduced
= ffeexpr_reduced_bool2_ (reduced
, left_operand
, operator,
9938 reduced
= ffeexpr_collapse_eqv (reduced
, operator->token
);
9941 case FFEEXPR_operatorNEQV_
:
9942 reduced
= ffebld_new_neqv (left_expr
, expr
);
9943 if (ffe_is_ugly_logint ())
9944 reduced
= ffeexpr_reduced_ugly2log_ (reduced
, left_operand
, operator,
9946 reduced
= ffeexpr_reduced_bool2_ (reduced
, left_operand
, operator,
9948 reduced
= ffeexpr_collapse_neqv (reduced
, operator->token
);
9952 assert ("bad bin op" == NULL
);
9956 if ((ffebld_op (left_expr
) == FFEBLD_opCONTER
)
9957 && (ffebld_conter_orig (expr
) == NULL
)
9958 && ffebld_constant_is_magical (constnode
= ffebld_conter (left_expr
)))
9960 if ((left_operand
->previous
!= NULL
)
9961 && (left_operand
->previous
->type
!= FFEEXPR_exprtypeOPERAND_
)
9962 && (left_operand
->previous
->u
.operator.op
9963 == FFEEXPR_operatorSUBTRACT_
))
9965 if (left_operand
->previous
->type
== FFEEXPR_exprtypeUNARY_
)
9966 ffetarget_integer_bad_magical_precedence (left_operand
->token
,
9967 left_operand
->previous
->token
,
9970 ffetarget_integer_bad_magical_precedence_binary
9971 (left_operand
->token
,
9972 left_operand
->previous
->token
,
9976 ffetarget_integer_bad_magical (left_operand
->token
);
9978 if ((ffebld_op (expr
) == FFEBLD_opCONTER
)
9979 && (ffebld_conter_orig (expr
) == NULL
)
9980 && ffebld_constant_is_magical (constnode
= ffebld_conter (expr
)))
9983 ffetarget_integer_bad_magical_binary (operand
->token
,
9986 ffetarget_integer_bad_magical (operand
->token
);
9988 ffeexpr_stack_
->exprstack
= left_operand
->previous
; /* Pops binary-op
9989 operands off stack. */
9990 ffeexpr_expr_kill_ (left_operand
);
9991 ffeexpr_expr_kill_ (operand
);
9992 operator->type
= FFEEXPR_exprtypeOPERAND_
; /* Convert operator, but
9994 operator->u
.operand
= reduced
; /* the line/column ffewhere info. */
9995 ffeexpr_exprstack_push_operand_ (operator); /* Push it back on
10000 /* ffeexpr_reduced_bool1_ -- Wrap up reduction of NOT operator
10002 reduced = ffeexpr_reduced_bool1_(reduced,op,r);
10004 Makes sure the argument for reduced has basictype of
10005 LOGICAL or (ugly) INTEGER. If
10006 argument has where of CONSTANT, assign where CONSTANT to
10007 reduced, else assign where FLEETING.
10009 If these requirements cannot be met, generate error message. */
10012 ffeexpr_reduced_bool1_ (ffebld reduced
, ffeexprExpr_ op
, ffeexprExpr_ r
)
10014 ffeinfo rinfo
, ninfo
;
10015 ffeinfoBasictype rbt
;
10016 ffeinfoKindtype rkt
;
10019 ffeinfoWhere rwh
, nwh
;
10021 rinfo
= ffebld_info (ffebld_left (reduced
));
10022 rbt
= ffeinfo_basictype (rinfo
);
10023 rkt
= ffeinfo_kindtype (rinfo
);
10024 rrk
= ffeinfo_rank (rinfo
);
10025 rkd
= ffeinfo_kind (rinfo
);
10026 rwh
= ffeinfo_where (rinfo
);
10028 if (((rbt
== FFEINFO_basictypeLOGICAL
)
10029 || (ffe_is_ugly_logint () && (rbt
== FFEINFO_basictypeINTEGER
)))
10034 case FFEINFO_whereCONSTANT
:
10035 nwh
= FFEINFO_whereCONSTANT
;
10038 case FFEINFO_whereIMMEDIATE
:
10039 nwh
= FFEINFO_whereIMMEDIATE
;
10043 nwh
= FFEINFO_whereFLEETING
;
10047 ninfo
= ffeinfo_new (rbt
, rkt
, 0, FFEINFO_kindENTITY
, nwh
,
10048 FFETARGET_charactersizeNONE
);
10049 ffebld_set_info (reduced
, ninfo
);
10053 if ((rbt
!= FFEINFO_basictypeLOGICAL
)
10054 && (!ffe_is_ugly_logint () || (rbt
!= FFEINFO_basictypeINTEGER
)))
10056 if ((rbt
!= FFEINFO_basictypeANY
)
10057 && ffebad_start (FFEBAD_NOT_ARG_TYPE
))
10059 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10060 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10066 if ((rkd
!= FFEINFO_kindANY
)
10067 && ffebad_start (FFEBAD_NOT_ARG_KIND
))
10069 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10070 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10071 ffebad_string ("an array");
10076 reduced
= ffebld_new_any ();
10077 ffebld_set_info (reduced
, ffeinfo_new_any ());
10081 /* ffeexpr_reduced_bool2_ -- Wrap up reduction of boolean operators
10083 reduced = ffeexpr_reduced_bool2_(reduced,l,op,r);
10085 Makes sure the left and right arguments for reduced have basictype of
10086 LOGICAL or (ugly) INTEGER. Determine common basictype and
10087 size for reduction (flag expression for combined hollerith/typeless
10088 situations for later determination of effective basictype). If both left
10089 and right arguments have where of CONSTANT, assign where CONSTANT to
10090 reduced, else assign where FLEETING. Create CONVERT ops for args where
10091 needed. Convert typeless
10092 constants to the desired type/size explicitly.
10094 If these requirements cannot be met, generate error message. */
10097 ffeexpr_reduced_bool2_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
10100 ffeinfo linfo
, rinfo
, ninfo
;
10101 ffeinfoBasictype lbt
, rbt
, nbt
;
10102 ffeinfoKindtype lkt
, rkt
, nkt
;
10103 ffeinfoRank lrk
, rrk
;
10104 ffeinfoKind lkd
, rkd
;
10105 ffeinfoWhere lwh
, rwh
, nwh
;
10107 linfo
= ffebld_info (ffebld_left (reduced
));
10108 lbt
= ffeinfo_basictype (linfo
);
10109 lkt
= ffeinfo_kindtype (linfo
);
10110 lrk
= ffeinfo_rank (linfo
);
10111 lkd
= ffeinfo_kind (linfo
);
10112 lwh
= ffeinfo_where (linfo
);
10114 rinfo
= ffebld_info (ffebld_right (reduced
));
10115 rbt
= ffeinfo_basictype (rinfo
);
10116 rkt
= ffeinfo_kindtype (rinfo
);
10117 rrk
= ffeinfo_rank (rinfo
);
10118 rkd
= ffeinfo_kind (rinfo
);
10119 rwh
= ffeinfo_where (rinfo
);
10121 ffeexpr_type_combine (&nbt
, &nkt
, lbt
, lkt
, rbt
, rkt
, op
->token
);
10123 if (((nbt
== FFEINFO_basictypeLOGICAL
)
10124 || (ffe_is_ugly_logint () && (nbt
== FFEINFO_basictypeINTEGER
)))
10125 && (lrk
== 0) && (rrk
== 0))
10129 case FFEINFO_whereCONSTANT
:
10132 case FFEINFO_whereCONSTANT
:
10133 nwh
= FFEINFO_whereCONSTANT
;
10136 case FFEINFO_whereIMMEDIATE
:
10137 nwh
= FFEINFO_whereIMMEDIATE
;
10141 nwh
= FFEINFO_whereFLEETING
;
10146 case FFEINFO_whereIMMEDIATE
:
10149 case FFEINFO_whereCONSTANT
:
10150 case FFEINFO_whereIMMEDIATE
:
10151 nwh
= FFEINFO_whereIMMEDIATE
;
10155 nwh
= FFEINFO_whereFLEETING
;
10161 nwh
= FFEINFO_whereFLEETING
;
10165 ninfo
= ffeinfo_new (nbt
, nkt
, 0, FFEINFO_kindENTITY
, nwh
,
10166 FFETARGET_charactersizeNONE
);
10167 ffebld_set_info (reduced
, ninfo
);
10168 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
10169 l
->token
, op
->token
, nbt
, nkt
, 0, FFETARGET_charactersizeNONE
,
10170 FFEEXPR_contextLET
));
10171 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
10172 r
->token
, op
->token
, nbt
, nkt
, 0, FFETARGET_charactersizeNONE
,
10173 FFEEXPR_contextLET
));
10177 if ((lbt
!= FFEINFO_basictypeLOGICAL
)
10178 && (!ffe_is_ugly_logint () || (lbt
!= FFEINFO_basictypeINTEGER
)))
10180 if ((rbt
!= FFEINFO_basictypeLOGICAL
)
10181 && (!ffe_is_ugly_logint () || (rbt
!= FFEINFO_basictypeINTEGER
)))
10183 if ((lbt
!= FFEINFO_basictypeANY
) && (rbt
!= FFEINFO_basictypeANY
)
10184 && ffebad_start (FFEBAD_BOOL_ARGS_TYPE
))
10186 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10187 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10188 ffebad_here (2, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10194 if ((lbt
!= FFEINFO_basictypeANY
)
10195 && ffebad_start (FFEBAD_BOOL_ARG_TYPE
))
10197 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10198 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10203 else if ((rbt
!= FFEINFO_basictypeLOGICAL
)
10204 && (!ffe_is_ugly_logint () || (rbt
!= FFEINFO_basictypeINTEGER
)))
10206 if ((rbt
!= FFEINFO_basictypeANY
)
10207 && ffebad_start (FFEBAD_BOOL_ARG_TYPE
))
10209 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10210 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10216 if ((lkd
!= FFEINFO_kindANY
)
10217 && ffebad_start (FFEBAD_BOOL_ARG_KIND
))
10219 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10220 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10221 ffebad_string ("an array");
10227 if ((rkd
!= FFEINFO_kindANY
)
10228 && ffebad_start (FFEBAD_BOOL_ARG_KIND
))
10230 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10231 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10232 ffebad_string ("an array");
10237 reduced
= ffebld_new_any ();
10238 ffebld_set_info (reduced
, ffeinfo_new_any ());
10242 /* ffeexpr_reduced_concatenate_ -- Wrap up reduction of concatenate operator
10244 reduced = ffeexpr_reduced_concatenate_(reduced,l,op,r);
10246 Makes sure the left and right arguments for reduced have basictype of
10247 CHARACTER and kind of SCALAR, FUNCTION, or STATEMENT FUNCTION. Assign
10248 basictype of CHARACTER and kind of SCALAR to reduced. Calculate effective
10249 size of concatenation and assign that size to reduced. If both left and
10250 right arguments have where of CONSTANT, assign where CONSTANT to reduced,
10251 else assign where FLEETING.
10253 If these requirements cannot be met, generate error message using the
10254 info in l, op, and r arguments and assign basictype, size, kind, and where
10258 ffeexpr_reduced_concatenate_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
10261 ffeinfo linfo
, rinfo
, ninfo
;
10262 ffeinfoBasictype lbt
, rbt
, nbt
;
10263 ffeinfoKindtype lkt
, rkt
, nkt
;
10264 ffeinfoRank lrk
, rrk
;
10265 ffeinfoKind lkd
, rkd
, nkd
;
10266 ffeinfoWhere lwh
, rwh
, nwh
;
10267 ffetargetCharacterSize lszm
, lszk
, rszm
, rszk
, nszk
;
10269 linfo
= ffebld_info (ffebld_left (reduced
));
10270 lbt
= ffeinfo_basictype (linfo
);
10271 lkt
= ffeinfo_kindtype (linfo
);
10272 lrk
= ffeinfo_rank (linfo
);
10273 lkd
= ffeinfo_kind (linfo
);
10274 lwh
= ffeinfo_where (linfo
);
10275 lszk
= ffeinfo_size (linfo
); /* Known size. */
10276 lszm
= ffebld_size_max (ffebld_left (reduced
));
10278 rinfo
= ffebld_info (ffebld_right (reduced
));
10279 rbt
= ffeinfo_basictype (rinfo
);
10280 rkt
= ffeinfo_kindtype (rinfo
);
10281 rrk
= ffeinfo_rank (rinfo
);
10282 rkd
= ffeinfo_kind (rinfo
);
10283 rwh
= ffeinfo_where (rinfo
);
10284 rszk
= ffeinfo_size (rinfo
); /* Known size. */
10285 rszm
= ffebld_size_max (ffebld_right (reduced
));
10287 if ((lbt
== FFEINFO_basictypeCHARACTER
) && (rbt
== FFEINFO_basictypeCHARACTER
)
10288 && (lkt
== rkt
) && (lrk
== 0) && (rrk
== 0)
10289 && (((lszm
!= FFETARGET_charactersizeNONE
)
10290 && (rszm
!= FFETARGET_charactersizeNONE
))
10291 || (ffeexpr_context_outer_ (ffeexpr_stack_
)
10292 == FFEEXPR_contextLET
)
10293 || (ffeexpr_context_outer_ (ffeexpr_stack_
)
10294 == FFEEXPR_contextSFUNCDEF
)))
10296 nbt
= FFEINFO_basictypeCHARACTER
;
10297 nkd
= FFEINFO_kindENTITY
;
10298 if ((lszk
== FFETARGET_charactersizeNONE
)
10299 || (rszk
== FFETARGET_charactersizeNONE
))
10300 nszk
= FFETARGET_charactersizeNONE
; /* Ok only in rhs of LET
10303 nszk
= lszk
+ rszk
;
10307 case FFEINFO_whereCONSTANT
:
10310 case FFEINFO_whereCONSTANT
:
10311 nwh
= FFEINFO_whereCONSTANT
;
10314 case FFEINFO_whereIMMEDIATE
:
10315 nwh
= FFEINFO_whereIMMEDIATE
;
10319 nwh
= FFEINFO_whereFLEETING
;
10324 case FFEINFO_whereIMMEDIATE
:
10327 case FFEINFO_whereCONSTANT
:
10328 case FFEINFO_whereIMMEDIATE
:
10329 nwh
= FFEINFO_whereIMMEDIATE
;
10333 nwh
= FFEINFO_whereFLEETING
;
10339 nwh
= FFEINFO_whereFLEETING
;
10344 ninfo
= ffeinfo_new (nbt
, nkt
, 0, nkd
, nwh
, nszk
);
10345 ffebld_set_info (reduced
, ninfo
);
10349 if ((lbt
!= FFEINFO_basictypeCHARACTER
) && (rbt
!= FFEINFO_basictypeCHARACTER
))
10351 if ((lbt
!= FFEINFO_basictypeANY
) && (rbt
!= FFEINFO_basictypeANY
)
10352 && ffebad_start (FFEBAD_CONCAT_ARGS_TYPE
))
10354 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10355 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10356 ffebad_here (2, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10360 else if (lbt
!= FFEINFO_basictypeCHARACTER
)
10362 if ((lbt
!= FFEINFO_basictypeANY
)
10363 && ffebad_start (FFEBAD_CONCAT_ARG_TYPE
))
10365 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10366 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10370 else if (rbt
!= FFEINFO_basictypeCHARACTER
)
10372 if ((rbt
!= FFEINFO_basictypeANY
)
10373 && ffebad_start (FFEBAD_CONCAT_ARG_TYPE
))
10375 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10376 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10380 else if ((lrk
!= 0) || (lszm
== FFETARGET_charactersizeNONE
))
10382 if ((lkd
!= FFEINFO_kindANY
)
10383 && ffebad_start (FFEBAD_CONCAT_ARG_KIND
))
10390 what
= "of indeterminate length";
10391 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10392 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10393 ffebad_string (what
);
10399 if (ffebad_start (FFEBAD_CONCAT_ARG_KIND
))
10406 what
= "of indeterminate length";
10407 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10408 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10409 ffebad_string (what
);
10414 reduced
= ffebld_new_any ();
10415 ffebld_set_info (reduced
, ffeinfo_new_any ());
10419 /* ffeexpr_reduced_eqop2_ -- Wrap up reduction of EQ and NE operators
10421 reduced = ffeexpr_reduced_eqop2_(reduced,l,op,r);
10423 Makes sure the left and right arguments for reduced have basictype of
10424 INTEGER, REAL, COMPLEX, or CHARACTER. Determine common basictype and
10425 size for reduction. If both left
10426 and right arguments have where of CONSTANT, assign where CONSTANT to
10427 reduced, else assign where FLEETING. Create CONVERT ops for args where
10428 needed. Convert typeless
10429 constants to the desired type/size explicitly.
10431 If these requirements cannot be met, generate error message. */
10434 ffeexpr_reduced_eqop2_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
10437 ffeinfo linfo
, rinfo
, ninfo
;
10438 ffeinfoBasictype lbt
, rbt
, nbt
;
10439 ffeinfoKindtype lkt
, rkt
, nkt
;
10440 ffeinfoRank lrk
, rrk
;
10441 ffeinfoKind lkd
, rkd
;
10442 ffeinfoWhere lwh
, rwh
, nwh
;
10443 ffetargetCharacterSize lsz
, rsz
;
10445 linfo
= ffebld_info (ffebld_left (reduced
));
10446 lbt
= ffeinfo_basictype (linfo
);
10447 lkt
= ffeinfo_kindtype (linfo
);
10448 lrk
= ffeinfo_rank (linfo
);
10449 lkd
= ffeinfo_kind (linfo
);
10450 lwh
= ffeinfo_where (linfo
);
10451 lsz
= ffebld_size_known (ffebld_left (reduced
));
10453 rinfo
= ffebld_info (ffebld_right (reduced
));
10454 rbt
= ffeinfo_basictype (rinfo
);
10455 rkt
= ffeinfo_kindtype (rinfo
);
10456 rrk
= ffeinfo_rank (rinfo
);
10457 rkd
= ffeinfo_kind (rinfo
);
10458 rwh
= ffeinfo_where (rinfo
);
10459 rsz
= ffebld_size_known (ffebld_right (reduced
));
10461 ffeexpr_type_combine (&nbt
, &nkt
, lbt
, lkt
, rbt
, rkt
, op
->token
);
10463 if (((nbt
== FFEINFO_basictypeINTEGER
) || (nbt
== FFEINFO_basictypeREAL
)
10464 || (nbt
== FFEINFO_basictypeCOMPLEX
) || (nbt
== FFEINFO_basictypeCHARACTER
))
10465 && (lrk
== 0) && (rrk
== 0))
10469 case FFEINFO_whereCONSTANT
:
10472 case FFEINFO_whereCONSTANT
:
10473 nwh
= FFEINFO_whereCONSTANT
;
10476 case FFEINFO_whereIMMEDIATE
:
10477 nwh
= FFEINFO_whereIMMEDIATE
;
10481 nwh
= FFEINFO_whereFLEETING
;
10486 case FFEINFO_whereIMMEDIATE
:
10489 case FFEINFO_whereCONSTANT
:
10490 case FFEINFO_whereIMMEDIATE
:
10491 nwh
= FFEINFO_whereIMMEDIATE
;
10495 nwh
= FFEINFO_whereFLEETING
;
10501 nwh
= FFEINFO_whereFLEETING
;
10505 if ((lsz
!= FFETARGET_charactersizeNONE
)
10506 && (rsz
!= FFETARGET_charactersizeNONE
))
10507 lsz
= rsz
= (lsz
> rsz
) ? lsz
: rsz
;
10509 ninfo
= ffeinfo_new (FFEINFO_basictypeLOGICAL
, FFEINFO_kindtypeLOGICALDEFAULT
,
10510 0, FFEINFO_kindENTITY
, nwh
, FFETARGET_charactersizeNONE
);
10511 ffebld_set_info (reduced
, ninfo
);
10512 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
10513 l
->token
, op
->token
, nbt
, nkt
, 0, lsz
,
10514 FFEEXPR_contextLET
));
10515 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
10516 r
->token
, op
->token
, nbt
, nkt
, 0, rsz
,
10517 FFEEXPR_contextLET
));
10521 if ((lbt
== FFEINFO_basictypeLOGICAL
)
10522 && (rbt
== FFEINFO_basictypeLOGICAL
))
10524 /* xgettext:no-c-format */
10525 if (ffebad_start_msg ("Use .EQV./.NEQV. instead of .EQ./.NE. at %0 for LOGICAL operands at %1 and %2",
10526 FFEBAD_severityFATAL
))
10528 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10529 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10530 ffebad_here (2, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10534 else if ((lbt
!= FFEINFO_basictypeINTEGER
) && (lbt
!= FFEINFO_basictypeREAL
)
10535 && (lbt
!= FFEINFO_basictypeCOMPLEX
) && (lbt
!= FFEINFO_basictypeCHARACTER
))
10537 if ((rbt
!= FFEINFO_basictypeINTEGER
) && (rbt
!= FFEINFO_basictypeREAL
)
10538 && (rbt
!= FFEINFO_basictypeCOMPLEX
) && (rbt
!= FFEINFO_basictypeCHARACTER
))
10540 if ((lbt
!= FFEINFO_basictypeANY
) && (rbt
!= FFEINFO_basictypeANY
)
10541 && ffebad_start (FFEBAD_EQOP_ARGS_TYPE
))
10543 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10544 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10545 ffebad_here (2, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10551 if ((lbt
!= FFEINFO_basictypeANY
)
10552 && ffebad_start (FFEBAD_EQOP_ARG_TYPE
))
10554 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10555 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10560 else if ((rbt
!= FFEINFO_basictypeINTEGER
) && (rbt
!= FFEINFO_basictypeREAL
)
10561 && (rbt
!= FFEINFO_basictypeCOMPLEX
) && (rbt
!= FFEINFO_basictypeCHARACTER
))
10563 if ((rbt
!= FFEINFO_basictypeANY
)
10564 && ffebad_start (FFEBAD_EQOP_ARG_TYPE
))
10566 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10567 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10573 if ((lkd
!= FFEINFO_kindANY
)
10574 && ffebad_start (FFEBAD_EQOP_ARG_KIND
))
10576 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10577 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10578 ffebad_string ("an array");
10584 if ((rkd
!= FFEINFO_kindANY
)
10585 && ffebad_start (FFEBAD_EQOP_ARG_KIND
))
10587 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10588 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10589 ffebad_string ("an array");
10594 reduced
= ffebld_new_any ();
10595 ffebld_set_info (reduced
, ffeinfo_new_any ());
10599 /* ffeexpr_reduced_math1_ -- Wrap up reduction of + - unary operators
10601 reduced = ffeexpr_reduced_math1_(reduced,op,r);
10603 Makes sure the argument for reduced has basictype of
10604 INTEGER, REAL, or COMPLEX. If the argument has where of CONSTANT,
10605 assign where CONSTANT to
10606 reduced, else assign where FLEETING.
10608 If these requirements cannot be met, generate error message. */
10611 ffeexpr_reduced_math1_ (ffebld reduced
, ffeexprExpr_ op
, ffeexprExpr_ r
)
10613 ffeinfo rinfo
, ninfo
;
10614 ffeinfoBasictype rbt
;
10615 ffeinfoKindtype rkt
;
10618 ffeinfoWhere rwh
, nwh
;
10620 rinfo
= ffebld_info (ffebld_left (reduced
));
10621 rbt
= ffeinfo_basictype (rinfo
);
10622 rkt
= ffeinfo_kindtype (rinfo
);
10623 rrk
= ffeinfo_rank (rinfo
);
10624 rkd
= ffeinfo_kind (rinfo
);
10625 rwh
= ffeinfo_where (rinfo
);
10627 if (((rbt
== FFEINFO_basictypeINTEGER
) || (rbt
== FFEINFO_basictypeREAL
)
10628 || (rbt
== FFEINFO_basictypeCOMPLEX
)) && (rrk
== 0))
10632 case FFEINFO_whereCONSTANT
:
10633 nwh
= FFEINFO_whereCONSTANT
;
10636 case FFEINFO_whereIMMEDIATE
:
10637 nwh
= FFEINFO_whereIMMEDIATE
;
10641 nwh
= FFEINFO_whereFLEETING
;
10645 ninfo
= ffeinfo_new (rbt
, rkt
, 0, FFEINFO_kindENTITY
, nwh
,
10646 FFETARGET_charactersizeNONE
);
10647 ffebld_set_info (reduced
, ninfo
);
10651 if ((rbt
!= FFEINFO_basictypeINTEGER
) && (rbt
!= FFEINFO_basictypeREAL
)
10652 && (rbt
!= FFEINFO_basictypeCOMPLEX
))
10654 if ((rbt
!= FFEINFO_basictypeANY
)
10655 && ffebad_start (FFEBAD_MATH_ARG_TYPE
))
10657 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10658 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10664 if ((rkd
!= FFEINFO_kindANY
)
10665 && ffebad_start (FFEBAD_MATH_ARG_KIND
))
10667 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10668 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10669 ffebad_string ("an array");
10674 reduced
= ffebld_new_any ();
10675 ffebld_set_info (reduced
, ffeinfo_new_any ());
10679 /* ffeexpr_reduced_math2_ -- Wrap up reduction of + - * / operators
10681 reduced = ffeexpr_reduced_math2_(reduced,l,op,r);
10683 Makes sure the left and right arguments for reduced have basictype of
10684 INTEGER, REAL, or COMPLEX. Determine common basictype and
10685 size for reduction (flag expression for combined hollerith/typeless
10686 situations for later determination of effective basictype). If both left
10687 and right arguments have where of CONSTANT, assign where CONSTANT to
10688 reduced, else assign where FLEETING. Create CONVERT ops for args where
10689 needed. Convert typeless
10690 constants to the desired type/size explicitly.
10692 If these requirements cannot be met, generate error message. */
10695 ffeexpr_reduced_math2_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
10698 ffeinfo linfo
, rinfo
, ninfo
;
10699 ffeinfoBasictype lbt
, rbt
, nbt
;
10700 ffeinfoKindtype lkt
, rkt
, nkt
;
10701 ffeinfoRank lrk
, rrk
;
10702 ffeinfoKind lkd
, rkd
;
10703 ffeinfoWhere lwh
, rwh
, nwh
;
10705 linfo
= ffebld_info (ffebld_left (reduced
));
10706 lbt
= ffeinfo_basictype (linfo
);
10707 lkt
= ffeinfo_kindtype (linfo
);
10708 lrk
= ffeinfo_rank (linfo
);
10709 lkd
= ffeinfo_kind (linfo
);
10710 lwh
= ffeinfo_where (linfo
);
10712 rinfo
= ffebld_info (ffebld_right (reduced
));
10713 rbt
= ffeinfo_basictype (rinfo
);
10714 rkt
= ffeinfo_kindtype (rinfo
);
10715 rrk
= ffeinfo_rank (rinfo
);
10716 rkd
= ffeinfo_kind (rinfo
);
10717 rwh
= ffeinfo_where (rinfo
);
10719 ffeexpr_type_combine (&nbt
, &nkt
, lbt
, lkt
, rbt
, rkt
, op
->token
);
10721 if (((nbt
== FFEINFO_basictypeINTEGER
) || (nbt
== FFEINFO_basictypeREAL
)
10722 || (nbt
== FFEINFO_basictypeCOMPLEX
)) && (lrk
== 0) && (rrk
== 0))
10726 case FFEINFO_whereCONSTANT
:
10729 case FFEINFO_whereCONSTANT
:
10730 nwh
= FFEINFO_whereCONSTANT
;
10733 case FFEINFO_whereIMMEDIATE
:
10734 nwh
= FFEINFO_whereIMMEDIATE
;
10738 nwh
= FFEINFO_whereFLEETING
;
10743 case FFEINFO_whereIMMEDIATE
:
10746 case FFEINFO_whereCONSTANT
:
10747 case FFEINFO_whereIMMEDIATE
:
10748 nwh
= FFEINFO_whereIMMEDIATE
;
10752 nwh
= FFEINFO_whereFLEETING
;
10758 nwh
= FFEINFO_whereFLEETING
;
10762 ninfo
= ffeinfo_new (nbt
, nkt
, 0, FFEINFO_kindENTITY
, nwh
,
10763 FFETARGET_charactersizeNONE
);
10764 ffebld_set_info (reduced
, ninfo
);
10765 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
10766 l
->token
, op
->token
, nbt
, nkt
, 0, FFETARGET_charactersizeNONE
,
10767 FFEEXPR_contextLET
));
10768 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
10769 r
->token
, op
->token
, nbt
, nkt
, 0, FFETARGET_charactersizeNONE
,
10770 FFEEXPR_contextLET
));
10774 if ((lbt
!= FFEINFO_basictypeINTEGER
) && (lbt
!= FFEINFO_basictypeREAL
)
10775 && (lbt
!= FFEINFO_basictypeCOMPLEX
))
10777 if ((rbt
!= FFEINFO_basictypeINTEGER
)
10778 && (rbt
!= FFEINFO_basictypeREAL
) && (rbt
!= FFEINFO_basictypeCOMPLEX
))
10780 if ((lbt
!= FFEINFO_basictypeANY
) && (rbt
!= FFEINFO_basictypeANY
)
10781 && ffebad_start (FFEBAD_MATH_ARGS_TYPE
))
10783 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10784 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10785 ffebad_here (2, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10791 if ((lbt
!= FFEINFO_basictypeANY
)
10792 && ffebad_start (FFEBAD_MATH_ARG_TYPE
))
10794 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10795 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10800 else if ((rbt
!= FFEINFO_basictypeINTEGER
) && (rbt
!= FFEINFO_basictypeREAL
)
10801 && (rbt
!= FFEINFO_basictypeCOMPLEX
))
10803 if ((rbt
!= FFEINFO_basictypeANY
)
10804 && ffebad_start (FFEBAD_MATH_ARG_TYPE
))
10806 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10807 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10813 if ((lkd
!= FFEINFO_kindANY
)
10814 && ffebad_start (FFEBAD_MATH_ARG_KIND
))
10816 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10817 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10818 ffebad_string ("an array");
10824 if ((rkd
!= FFEINFO_kindANY
)
10825 && ffebad_start (FFEBAD_MATH_ARG_KIND
))
10827 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10828 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10829 ffebad_string ("an array");
10834 reduced
= ffebld_new_any ();
10835 ffebld_set_info (reduced
, ffeinfo_new_any ());
10839 /* ffeexpr_reduced_power_ -- Wrap up reduction of ** operator
10841 reduced = ffeexpr_reduced_power_(reduced,l,op,r);
10843 Makes sure the left and right arguments for reduced have basictype of
10844 INTEGER, REAL, or COMPLEX. Determine common basictype and
10845 size for reduction (flag expression for combined hollerith/typeless
10846 situations for later determination of effective basictype). If both left
10847 and right arguments have where of CONSTANT, assign where CONSTANT to
10848 reduced, else assign where FLEETING. Create CONVERT ops for args where
10849 needed. Note that real**int or complex**int
10850 comes out as int = real**int etc with no conversions.
10852 If these requirements cannot be met, generate error message using the
10853 info in l, op, and r arguments and assign basictype, size, kind, and where
10857 ffeexpr_reduced_power_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
10860 ffeinfo linfo
, rinfo
, ninfo
;
10861 ffeinfoBasictype lbt
, rbt
, nbt
;
10862 ffeinfoKindtype lkt
, rkt
, nkt
;
10863 ffeinfoRank lrk
, rrk
;
10864 ffeinfoKind lkd
, rkd
;
10865 ffeinfoWhere lwh
, rwh
, nwh
;
10867 linfo
= ffebld_info (ffebld_left (reduced
));
10868 lbt
= ffeinfo_basictype (linfo
);
10869 lkt
= ffeinfo_kindtype (linfo
);
10870 lrk
= ffeinfo_rank (linfo
);
10871 lkd
= ffeinfo_kind (linfo
);
10872 lwh
= ffeinfo_where (linfo
);
10874 rinfo
= ffebld_info (ffebld_right (reduced
));
10875 rbt
= ffeinfo_basictype (rinfo
);
10876 rkt
= ffeinfo_kindtype (rinfo
);
10877 rrk
= ffeinfo_rank (rinfo
);
10878 rkd
= ffeinfo_kind (rinfo
);
10879 rwh
= ffeinfo_where (rinfo
);
10881 if ((rbt
== FFEINFO_basictypeINTEGER
)
10882 && ((lbt
== FFEINFO_basictypeREAL
)
10883 || (lbt
== FFEINFO_basictypeCOMPLEX
)))
10886 nkt
= ffeinfo_kindtype_max (nbt
, lkt
, FFEINFO_kindtypeREALDEFAULT
);
10887 if (nkt
!= FFEINFO_kindtypeREALDEFAULT
)
10889 nkt
= ffeinfo_kindtype_max (nbt
, lkt
, FFEINFO_kindtypeREALDOUBLE
);
10890 if (nkt
!= FFEINFO_kindtypeREALDOUBLE
)
10891 nkt
= FFEINFO_kindtypeREALDOUBLE
; /* Highest kt we can power! */
10893 if (rkt
== FFEINFO_kindtypeINTEGER4
)
10895 /* xgettext:no-c-format */
10896 ffebad_start_msg ("Unsupported operand for ** at %1 -- converting to default INTEGER",
10897 FFEBAD_severityWARNING
);
10898 ffebad_here (0, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
10901 if (rkt
!= FFEINFO_kindtypeINTEGERDEFAULT
)
10903 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
10904 r
->token
, op
->token
,
10905 FFEINFO_basictypeINTEGER
, FFEINFO_kindtypeINTEGERDEFAULT
, 0,
10906 FFETARGET_charactersizeNONE
,
10907 FFEEXPR_contextLET
));
10908 rkt
= FFEINFO_kindtypeINTEGERDEFAULT
;
10913 ffeexpr_type_combine (&nbt
, &nkt
, lbt
, lkt
, rbt
, rkt
, op
->token
);
10915 #if 0 /* INTEGER4**INTEGER4 works now. */
10916 if ((nbt
== FFEINFO_basictypeINTEGER
)
10917 && (nkt
!= FFEINFO_kindtypeINTEGERDEFAULT
))
10918 nkt
= FFEINFO_kindtypeINTEGERDEFAULT
; /* Highest kt we can power! */
10920 if (((nbt
== FFEINFO_basictypeREAL
)
10921 || (nbt
== FFEINFO_basictypeCOMPLEX
))
10922 && (nkt
!= FFEINFO_kindtypeREALDEFAULT
))
10924 nkt
= ffeinfo_kindtype_max (nbt
, nkt
, FFEINFO_kindtypeREALDOUBLE
);
10925 if (nkt
!= FFEINFO_kindtypeREALDOUBLE
)
10926 nkt
= FFEINFO_kindtypeREALDOUBLE
; /* Highest kt we can power! */
10928 /* else Gonna turn into an error below. */
10931 if (((nbt
== FFEINFO_basictypeINTEGER
) || (nbt
== FFEINFO_basictypeREAL
)
10932 || (nbt
== FFEINFO_basictypeCOMPLEX
)) && (lrk
== 0) && (rrk
== 0))
10936 case FFEINFO_whereCONSTANT
:
10939 case FFEINFO_whereCONSTANT
:
10940 nwh
= FFEINFO_whereCONSTANT
;
10943 case FFEINFO_whereIMMEDIATE
:
10944 nwh
= FFEINFO_whereIMMEDIATE
;
10948 nwh
= FFEINFO_whereFLEETING
;
10953 case FFEINFO_whereIMMEDIATE
:
10956 case FFEINFO_whereCONSTANT
:
10957 case FFEINFO_whereIMMEDIATE
:
10958 nwh
= FFEINFO_whereIMMEDIATE
;
10962 nwh
= FFEINFO_whereFLEETING
;
10968 nwh
= FFEINFO_whereFLEETING
;
10972 ninfo
= ffeinfo_new (nbt
, nkt
, 0, FFEINFO_kindENTITY
, nwh
,
10973 FFETARGET_charactersizeNONE
);
10974 ffebld_set_info (reduced
, ninfo
);
10975 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
10976 l
->token
, op
->token
, nbt
, nkt
, 0, FFETARGET_charactersizeNONE
,
10977 FFEEXPR_contextLET
));
10978 if (rbt
!= FFEINFO_basictypeINTEGER
)
10979 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
10980 r
->token
, op
->token
, nbt
, nkt
, 0, FFETARGET_charactersizeNONE
,
10981 FFEEXPR_contextLET
));
10985 if ((lbt
!= FFEINFO_basictypeINTEGER
) && (lbt
!= FFEINFO_basictypeREAL
)
10986 && (lbt
!= FFEINFO_basictypeCOMPLEX
))
10988 if ((rbt
!= FFEINFO_basictypeINTEGER
)
10989 && (rbt
!= FFEINFO_basictypeREAL
) && (rbt
!= FFEINFO_basictypeCOMPLEX
))
10991 if ((lbt
!= FFEINFO_basictypeANY
) && (rbt
!= FFEINFO_basictypeANY
)
10992 && ffebad_start (FFEBAD_MATH_ARGS_TYPE
))
10994 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
10995 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
10996 ffebad_here (2, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
11002 if ((lbt
!= FFEINFO_basictypeANY
)
11003 && ffebad_start (FFEBAD_MATH_ARG_TYPE
))
11005 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11006 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
11011 else if ((rbt
!= FFEINFO_basictypeINTEGER
) && (rbt
!= FFEINFO_basictypeREAL
)
11012 && (rbt
!= FFEINFO_basictypeCOMPLEX
))
11014 if ((rbt
!= FFEINFO_basictypeANY
)
11015 && ffebad_start (FFEBAD_MATH_ARG_TYPE
))
11017 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11018 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
11024 if ((lkd
!= FFEINFO_kindANY
)
11025 && ffebad_start (FFEBAD_MATH_ARG_KIND
))
11027 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11028 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
11029 ffebad_string ("an array");
11035 if ((rkd
!= FFEINFO_kindANY
)
11036 && ffebad_start (FFEBAD_MATH_ARG_KIND
))
11038 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11039 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
11040 ffebad_string ("an array");
11045 reduced
= ffebld_new_any ();
11046 ffebld_set_info (reduced
, ffeinfo_new_any ());
11050 /* ffeexpr_reduced_relop2_ -- Wrap up reduction of LT, LE, GE, and GT operators
11052 reduced = ffeexpr_reduced_relop2_(reduced,l,op,r);
11054 Makes sure the left and right arguments for reduced have basictype of
11055 INTEGER, REAL, or CHARACTER. Determine common basictype and
11056 size for reduction. If both left
11057 and right arguments have where of CONSTANT, assign where CONSTANT to
11058 reduced, else assign where FLEETING. Create CONVERT ops for args where
11059 needed. Convert typeless
11060 constants to the desired type/size explicitly.
11062 If these requirements cannot be met, generate error message. */
11065 ffeexpr_reduced_relop2_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
11068 ffeinfo linfo
, rinfo
, ninfo
;
11069 ffeinfoBasictype lbt
, rbt
, nbt
;
11070 ffeinfoKindtype lkt
, rkt
, nkt
;
11071 ffeinfoRank lrk
, rrk
;
11072 ffeinfoKind lkd
, rkd
;
11073 ffeinfoWhere lwh
, rwh
, nwh
;
11074 ffetargetCharacterSize lsz
, rsz
;
11076 linfo
= ffebld_info (ffebld_left (reduced
));
11077 lbt
= ffeinfo_basictype (linfo
);
11078 lkt
= ffeinfo_kindtype (linfo
);
11079 lrk
= ffeinfo_rank (linfo
);
11080 lkd
= ffeinfo_kind (linfo
);
11081 lwh
= ffeinfo_where (linfo
);
11082 lsz
= ffebld_size_known (ffebld_left (reduced
));
11084 rinfo
= ffebld_info (ffebld_right (reduced
));
11085 rbt
= ffeinfo_basictype (rinfo
);
11086 rkt
= ffeinfo_kindtype (rinfo
);
11087 rrk
= ffeinfo_rank (rinfo
);
11088 rkd
= ffeinfo_kind (rinfo
);
11089 rwh
= ffeinfo_where (rinfo
);
11090 rsz
= ffebld_size_known (ffebld_right (reduced
));
11092 ffeexpr_type_combine (&nbt
, &nkt
, lbt
, lkt
, rbt
, rkt
, op
->token
);
11094 if (((nbt
== FFEINFO_basictypeINTEGER
) || (nbt
== FFEINFO_basictypeREAL
)
11095 || (nbt
== FFEINFO_basictypeCHARACTER
))
11096 && (lrk
== 0) && (rrk
== 0))
11100 case FFEINFO_whereCONSTANT
:
11103 case FFEINFO_whereCONSTANT
:
11104 nwh
= FFEINFO_whereCONSTANT
;
11107 case FFEINFO_whereIMMEDIATE
:
11108 nwh
= FFEINFO_whereIMMEDIATE
;
11112 nwh
= FFEINFO_whereFLEETING
;
11117 case FFEINFO_whereIMMEDIATE
:
11120 case FFEINFO_whereCONSTANT
:
11121 case FFEINFO_whereIMMEDIATE
:
11122 nwh
= FFEINFO_whereIMMEDIATE
;
11126 nwh
= FFEINFO_whereFLEETING
;
11132 nwh
= FFEINFO_whereFLEETING
;
11136 if ((lsz
!= FFETARGET_charactersizeNONE
)
11137 && (rsz
!= FFETARGET_charactersizeNONE
))
11138 lsz
= rsz
= (lsz
> rsz
) ? lsz
: rsz
;
11140 ninfo
= ffeinfo_new (FFEINFO_basictypeLOGICAL
, FFEINFO_kindtypeLOGICALDEFAULT
,
11141 0, FFEINFO_kindENTITY
, nwh
, FFETARGET_charactersizeNONE
);
11142 ffebld_set_info (reduced
, ninfo
);
11143 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11144 l
->token
, op
->token
, nbt
, nkt
, 0, lsz
,
11145 FFEEXPR_contextLET
));
11146 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
11147 r
->token
, op
->token
, nbt
, nkt
, 0, rsz
,
11148 FFEEXPR_contextLET
));
11152 if ((lbt
!= FFEINFO_basictypeINTEGER
) && (lbt
!= FFEINFO_basictypeREAL
)
11153 && (lbt
!= FFEINFO_basictypeCHARACTER
))
11155 if ((rbt
!= FFEINFO_basictypeINTEGER
) && (rbt
!= FFEINFO_basictypeREAL
)
11156 && (rbt
!= FFEINFO_basictypeCHARACTER
))
11158 if ((lbt
!= FFEINFO_basictypeANY
) && (rbt
!= FFEINFO_basictypeANY
)
11159 && ffebad_start (FFEBAD_RELOP_ARGS_TYPE
))
11161 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11162 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
11163 ffebad_here (2, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
11169 if ((lbt
!= FFEINFO_basictypeANY
)
11170 && ffebad_start (FFEBAD_RELOP_ARG_TYPE
))
11172 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11173 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
11178 else if ((rbt
!= FFEINFO_basictypeINTEGER
) && (rbt
!= FFEINFO_basictypeREAL
)
11179 && (rbt
!= FFEINFO_basictypeCHARACTER
))
11181 if ((rbt
!= FFEINFO_basictypeANY
)
11182 && ffebad_start (FFEBAD_RELOP_ARG_TYPE
))
11184 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11185 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
11191 if ((lkd
!= FFEINFO_kindANY
)
11192 && ffebad_start (FFEBAD_RELOP_ARG_KIND
))
11194 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11195 ffebad_here (1, ffelex_token_where_line (l
->token
), ffelex_token_where_column (l
->token
));
11196 ffebad_string ("an array");
11202 if ((rkd
!= FFEINFO_kindANY
)
11203 && ffebad_start (FFEBAD_RELOP_ARG_KIND
))
11205 ffebad_here (0, ffelex_token_where_line (op
->token
), ffelex_token_where_column (op
->token
));
11206 ffebad_here (1, ffelex_token_where_line (r
->token
), ffelex_token_where_column (r
->token
));
11207 ffebad_string ("an array");
11212 reduced
= ffebld_new_any ();
11213 ffebld_set_info (reduced
, ffeinfo_new_any ());
11217 /* ffeexpr_reduced_ugly1_ -- Deal with TYPELESS, HOLLERITH, and LOGICAL
11219 reduced = ffeexpr_reduced_ugly1_(reduced,op,r);
11224 ffeexpr_reduced_ugly1_ (ffebld reduced
, ffeexprExpr_ op
, ffeexprExpr_ r
)
11227 ffeinfoBasictype rbt
;
11228 ffeinfoKindtype rkt
;
11233 rinfo
= ffebld_info (ffebld_left (reduced
));
11234 rbt
= ffeinfo_basictype (rinfo
);
11235 rkt
= ffeinfo_kindtype (rinfo
);
11236 rrk
= ffeinfo_rank (rinfo
);
11237 rkd
= ffeinfo_kind (rinfo
);
11238 rwh
= ffeinfo_where (rinfo
);
11240 if ((rbt
== FFEINFO_basictypeTYPELESS
)
11241 || (rbt
== FFEINFO_basictypeHOLLERITH
))
11243 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11244 r
->token
, op
->token
, FFEINFO_basictypeINTEGER
,
11245 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
11246 FFETARGET_charactersizeNONE
,
11247 FFEEXPR_contextLET
));
11248 rinfo
= ffebld_info (ffebld_left (reduced
));
11249 rbt
= FFEINFO_basictypeINTEGER
;
11250 rkt
= FFEINFO_kindtypeINTEGERDEFAULT
;
11252 rkd
= FFEINFO_kindENTITY
;
11253 rwh
= ffeinfo_where (rinfo
);
11256 if (rbt
== FFEINFO_basictypeLOGICAL
)
11258 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11259 r
->token
, op
->token
, FFEINFO_basictypeINTEGER
,
11260 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
11261 FFETARGET_charactersizeNONE
,
11262 FFEEXPR_contextLET
));
11268 /* ffeexpr_reduced_ugly1log_ -- Deal with TYPELESS and HOLLERITH
11270 reduced = ffeexpr_reduced_ugly1log_(reduced,op,r);
11275 ffeexpr_reduced_ugly1log_ (ffebld reduced
, ffeexprExpr_ op
, ffeexprExpr_ r
)
11278 ffeinfoBasictype rbt
;
11279 ffeinfoKindtype rkt
;
11284 rinfo
= ffebld_info (ffebld_left (reduced
));
11285 rbt
= ffeinfo_basictype (rinfo
);
11286 rkt
= ffeinfo_kindtype (rinfo
);
11287 rrk
= ffeinfo_rank (rinfo
);
11288 rkd
= ffeinfo_kind (rinfo
);
11289 rwh
= ffeinfo_where (rinfo
);
11291 if ((rbt
== FFEINFO_basictypeTYPELESS
)
11292 || (rbt
== FFEINFO_basictypeHOLLERITH
))
11294 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11295 r
->token
, op
->token
, FFEINFO_basictypeLOGICAL
, 0,
11296 FFEINFO_kindtypeLOGICALDEFAULT
,
11297 FFETARGET_charactersizeNONE
,
11298 FFEEXPR_contextLET
));
11299 rinfo
= ffebld_info (ffebld_left (reduced
));
11300 rbt
= FFEINFO_basictypeLOGICAL
;
11301 rkt
= FFEINFO_kindtypeLOGICALDEFAULT
;
11303 rkd
= FFEINFO_kindENTITY
;
11304 rwh
= ffeinfo_where (rinfo
);
11310 /* ffeexpr_reduced_ugly2_ -- Deal with TYPELESS, HOLLERITH, and LOGICAL
11312 reduced = ffeexpr_reduced_ugly2_(reduced,l,op,r);
11317 ffeexpr_reduced_ugly2_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
11320 ffeinfo linfo
, rinfo
;
11321 ffeinfoBasictype lbt
, rbt
;
11322 ffeinfoKindtype lkt
, rkt
;
11323 ffeinfoRank lrk
, rrk
;
11324 ffeinfoKind lkd
, rkd
;
11325 ffeinfoWhere lwh
, rwh
;
11327 linfo
= ffebld_info (ffebld_left (reduced
));
11328 lbt
= ffeinfo_basictype (linfo
);
11329 lkt
= ffeinfo_kindtype (linfo
);
11330 lrk
= ffeinfo_rank (linfo
);
11331 lkd
= ffeinfo_kind (linfo
);
11332 lwh
= ffeinfo_where (linfo
);
11334 rinfo
= ffebld_info (ffebld_right (reduced
));
11335 rbt
= ffeinfo_basictype (rinfo
);
11336 rkt
= ffeinfo_kindtype (rinfo
);
11337 rrk
= ffeinfo_rank (rinfo
);
11338 rkd
= ffeinfo_kind (rinfo
);
11339 rwh
= ffeinfo_where (rinfo
);
11341 if ((lbt
== FFEINFO_basictypeTYPELESS
)
11342 || (lbt
== FFEINFO_basictypeHOLLERITH
))
11344 if ((rbt
== FFEINFO_basictypeTYPELESS
)
11345 || (rbt
== FFEINFO_basictypeHOLLERITH
))
11347 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11348 l
->token
, op
->token
, FFEINFO_basictypeINTEGER
,
11349 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
11350 FFETARGET_charactersizeNONE
,
11351 FFEEXPR_contextLET
));
11352 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
11353 r
->token
, op
->token
, FFEINFO_basictypeINTEGER
, 0,
11354 FFEINFO_kindtypeINTEGERDEFAULT
,
11355 FFETARGET_charactersizeNONE
,
11356 FFEEXPR_contextLET
));
11357 linfo
= ffebld_info (ffebld_left (reduced
));
11358 rinfo
= ffebld_info (ffebld_right (reduced
));
11359 lbt
= rbt
= FFEINFO_basictypeINTEGER
;
11360 lkt
= rkt
= FFEINFO_kindtypeINTEGERDEFAULT
;
11362 lkd
= rkd
= FFEINFO_kindENTITY
;
11363 lwh
= ffeinfo_where (linfo
);
11364 rwh
= ffeinfo_where (rinfo
);
11368 ffebld_set_left (reduced
, ffeexpr_convert_expr (ffebld_left (reduced
),
11369 l
->token
, ffebld_right (reduced
), r
->token
,
11370 FFEEXPR_contextLET
));
11371 linfo
= ffebld_info (ffebld_left (reduced
));
11372 lbt
= ffeinfo_basictype (linfo
);
11373 lkt
= ffeinfo_kindtype (linfo
);
11374 lrk
= ffeinfo_rank (linfo
);
11375 lkd
= ffeinfo_kind (linfo
);
11376 lwh
= ffeinfo_where (linfo
);
11381 if ((rbt
== FFEINFO_basictypeTYPELESS
)
11382 || (rbt
== FFEINFO_basictypeHOLLERITH
))
11384 ffebld_set_right (reduced
, ffeexpr_convert_expr (ffebld_right (reduced
),
11385 r
->token
, ffebld_left (reduced
), l
->token
,
11386 FFEEXPR_contextLET
));
11387 rinfo
= ffebld_info (ffebld_right (reduced
));
11388 rbt
= ffeinfo_basictype (rinfo
);
11389 rkt
= ffeinfo_kindtype (rinfo
);
11390 rrk
= ffeinfo_rank (rinfo
);
11391 rkd
= ffeinfo_kind (rinfo
);
11392 rwh
= ffeinfo_where (rinfo
);
11394 /* else Leave it alone. */
11397 if (lbt
== FFEINFO_basictypeLOGICAL
)
11399 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11400 l
->token
, op
->token
, FFEINFO_basictypeINTEGER
,
11401 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
11402 FFETARGET_charactersizeNONE
,
11403 FFEEXPR_contextLET
));
11406 if (rbt
== FFEINFO_basictypeLOGICAL
)
11408 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
11409 r
->token
, op
->token
, FFEINFO_basictypeINTEGER
,
11410 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
11411 FFETARGET_charactersizeNONE
,
11412 FFEEXPR_contextLET
));
11418 /* ffeexpr_reduced_ugly2log_ -- Deal with TYPELESS and HOLLERITH
11420 reduced = ffeexpr_reduced_ugly2log_(reduced,l,op,r);
11425 ffeexpr_reduced_ugly2log_ (ffebld reduced
, ffeexprExpr_ l
, ffeexprExpr_ op
,
11428 ffeinfo linfo
, rinfo
;
11429 ffeinfoBasictype lbt
, rbt
;
11430 ffeinfoKindtype lkt
, rkt
;
11431 ffeinfoRank lrk
, rrk
;
11432 ffeinfoKind lkd
, rkd
;
11433 ffeinfoWhere lwh
, rwh
;
11435 linfo
= ffebld_info (ffebld_left (reduced
));
11436 lbt
= ffeinfo_basictype (linfo
);
11437 lkt
= ffeinfo_kindtype (linfo
);
11438 lrk
= ffeinfo_rank (linfo
);
11439 lkd
= ffeinfo_kind (linfo
);
11440 lwh
= ffeinfo_where (linfo
);
11442 rinfo
= ffebld_info (ffebld_right (reduced
));
11443 rbt
= ffeinfo_basictype (rinfo
);
11444 rkt
= ffeinfo_kindtype (rinfo
);
11445 rrk
= ffeinfo_rank (rinfo
);
11446 rkd
= ffeinfo_kind (rinfo
);
11447 rwh
= ffeinfo_where (rinfo
);
11449 if ((lbt
== FFEINFO_basictypeTYPELESS
)
11450 || (lbt
== FFEINFO_basictypeHOLLERITH
))
11452 if ((rbt
== FFEINFO_basictypeTYPELESS
)
11453 || (rbt
== FFEINFO_basictypeHOLLERITH
))
11455 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11456 l
->token
, op
->token
, FFEINFO_basictypeLOGICAL
,
11457 FFEINFO_kindtypeLOGICALDEFAULT
, 0,
11458 FFETARGET_charactersizeNONE
,
11459 FFEEXPR_contextLET
));
11460 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
11461 r
->token
, op
->token
, FFEINFO_basictypeLOGICAL
,
11462 FFEINFO_kindtypeLOGICALDEFAULT
, 0,
11463 FFETARGET_charactersizeNONE
,
11464 FFEEXPR_contextLET
));
11465 linfo
= ffebld_info (ffebld_left (reduced
));
11466 rinfo
= ffebld_info (ffebld_right (reduced
));
11467 lbt
= rbt
= FFEINFO_basictypeLOGICAL
;
11468 lkt
= rkt
= FFEINFO_kindtypeLOGICALDEFAULT
;
11470 lkd
= rkd
= FFEINFO_kindENTITY
;
11471 lwh
= ffeinfo_where (linfo
);
11472 rwh
= ffeinfo_where (rinfo
);
11476 ffebld_set_left (reduced
, ffeexpr_convert_expr (ffebld_left (reduced
),
11477 l
->token
, ffebld_right (reduced
), r
->token
,
11478 FFEEXPR_contextLET
));
11479 linfo
= ffebld_info (ffebld_left (reduced
));
11480 lbt
= ffeinfo_basictype (linfo
);
11481 lkt
= ffeinfo_kindtype (linfo
);
11482 lrk
= ffeinfo_rank (linfo
);
11483 lkd
= ffeinfo_kind (linfo
);
11484 lwh
= ffeinfo_where (linfo
);
11489 if ((rbt
== FFEINFO_basictypeTYPELESS
)
11490 || (rbt
== FFEINFO_basictypeHOLLERITH
))
11492 ffebld_set_right (reduced
, ffeexpr_convert_expr (ffebld_right (reduced
),
11493 r
->token
, ffebld_left (reduced
), l
->token
,
11494 FFEEXPR_contextLET
));
11495 rinfo
= ffebld_info (ffebld_right (reduced
));
11496 rbt
= ffeinfo_basictype (rinfo
);
11497 rkt
= ffeinfo_kindtype (rinfo
);
11498 rrk
= ffeinfo_rank (rinfo
);
11499 rkd
= ffeinfo_kind (rinfo
);
11500 rwh
= ffeinfo_where (rinfo
);
11502 /* else Leave it alone. */
11505 if (lbt
== FFEINFO_basictypeLOGICAL
)
11507 ffebld_set_left (reduced
, ffeexpr_convert (ffebld_left (reduced
),
11508 l
->token
, op
->token
, FFEINFO_basictypeINTEGER
,
11509 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
11510 FFETARGET_charactersizeNONE
,
11511 FFEEXPR_contextLET
));
11514 if (rbt
== FFEINFO_basictypeLOGICAL
)
11516 ffebld_set_right (reduced
, ffeexpr_convert (ffebld_right (reduced
),
11517 r
->token
, op
->token
, FFEINFO_basictypeINTEGER
,
11518 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
11519 FFETARGET_charactersizeNONE
,
11520 FFEEXPR_contextLET
));
11526 /* Fumble through tokens until a nonmatching CLOSE_PAREN, EOS, or SEMICOLON
11529 The idea is to process the tokens as they would be done by normal
11530 expression processing, with the key things being telling the lexer
11531 when hollerith/character constants are about to happen, until the
11532 true closing token is found. */
11534 static ffelexHandler
11535 ffeexpr_find_close_paren_ (ffelexToken t
,
11536 ffelexHandler after
)
11538 ffeexpr_find_
.after
= after
;
11539 ffeexpr_find_
.level
= 1;
11540 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11543 static ffelexHandler
11544 ffeexpr_nil_finished_ (ffelexToken t
)
11546 switch (ffelex_token_type (t
))
11548 case FFELEX_typeCLOSE_PAREN
:
11549 if (--ffeexpr_find_
.level
== 0)
11550 return (ffelexHandler
) ffeexpr_find_
.after
;
11551 return (ffelexHandler
) ffeexpr_nil_binary_
;
11553 case FFELEX_typeCOMMA
:
11554 case FFELEX_typeCOLON
:
11555 case FFELEX_typeEQUALS
:
11556 case FFELEX_typePOINTS
:
11557 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11560 if (--ffeexpr_find_
.level
== 0)
11561 return (ffelexHandler
) ffeexpr_find_
.after (t
);
11562 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11566 static ffelexHandler
11567 ffeexpr_nil_rhs_ (ffelexToken t
)
11569 switch (ffelex_token_type (t
))
11571 case FFELEX_typeQUOTE
:
11573 return (ffelexHandler
) ffeexpr_nil_quote_
;
11574 ffelex_set_expecting_hollerith (-1, '\"',
11575 ffelex_token_where_line (t
),
11576 ffelex_token_where_column (t
));
11577 return (ffelexHandler
) ffeexpr_nil_apostrophe_
;
11579 case FFELEX_typeAPOSTROPHE
:
11580 ffelex_set_expecting_hollerith (-1, '\'',
11581 ffelex_token_where_line (t
),
11582 ffelex_token_where_column (t
));
11583 return (ffelexHandler
) ffeexpr_nil_apostrophe_
;
11585 case FFELEX_typePERCENT
:
11586 return (ffelexHandler
) ffeexpr_nil_percent_
;
11588 case FFELEX_typeOPEN_PAREN
:
11589 ++ffeexpr_find_
.level
;
11590 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11592 case FFELEX_typePLUS
:
11593 case FFELEX_typeMINUS
:
11594 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11596 case FFELEX_typePERIOD
:
11597 return (ffelexHandler
) ffeexpr_nil_period_
;
11599 case FFELEX_typeNUMBER
:
11600 ffeexpr_hollerith_count_
= atol (ffelex_token_text (t
));
11601 if (ffeexpr_hollerith_count_
> 0)
11602 ffelex_set_expecting_hollerith (ffeexpr_hollerith_count_
,
11604 ffelex_token_where_line (t
),
11605 ffelex_token_where_column (t
));
11606 return (ffelexHandler
) ffeexpr_nil_number_
;
11608 case FFELEX_typeNAME
:
11609 case FFELEX_typeNAMES
:
11610 return (ffelexHandler
) ffeexpr_nil_name_rhs_
;
11612 case FFELEX_typeASTERISK
:
11613 case FFELEX_typeSLASH
:
11614 case FFELEX_typePOWER
:
11615 case FFELEX_typeCONCAT
:
11616 case FFELEX_typeREL_EQ
:
11617 case FFELEX_typeREL_NE
:
11618 case FFELEX_typeREL_LE
:
11619 case FFELEX_typeREL_GE
:
11620 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11623 return (ffelexHandler
) ffeexpr_nil_finished_ (t
);
11627 static ffelexHandler
11628 ffeexpr_nil_period_ (ffelexToken t
)
11630 switch (ffelex_token_type (t
))
11632 case FFELEX_typeNAME
:
11633 case FFELEX_typeNAMES
:
11634 ffeexpr_current_dotdot_
= ffestr_other (t
);
11635 switch (ffeexpr_current_dotdot_
)
11637 case FFESTR_otherNone
:
11638 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11640 case FFESTR_otherTRUE
:
11641 case FFESTR_otherFALSE
:
11642 case FFESTR_otherNOT
:
11643 return (ffelexHandler
) ffeexpr_nil_end_period_
;
11646 return (ffelexHandler
) ffeexpr_nil_swallow_period_
;
11648 break; /* Nothing really reaches here. */
11650 case FFELEX_typeNUMBER
:
11651 return (ffelexHandler
) ffeexpr_nil_real_
;
11654 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11658 static ffelexHandler
11659 ffeexpr_nil_end_period_ (ffelexToken t
)
11661 switch (ffeexpr_current_dotdot_
)
11663 case FFESTR_otherNOT
:
11664 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
11665 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11666 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11668 case FFESTR_otherTRUE
:
11669 case FFESTR_otherFALSE
:
11670 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
11671 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11672 return (ffelexHandler
) ffeexpr_nil_binary_
;
11675 assert ("Bad [nil] unary dotdot in ffeexpr_current_dotdot_" == NULL
);
11681 static ffelexHandler
11682 ffeexpr_nil_swallow_period_ (ffelexToken t
)
11684 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
11685 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11686 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11689 static ffelexHandler
11690 ffeexpr_nil_real_ (ffelexToken t
)
11695 if (((ffelex_token_type (t
) != FFELEX_typeNAME
)
11696 && (ffelex_token_type (t
) != FFELEX_typeNAMES
))
11697 || !(((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
11699 || ffesrc_char_match_init (d
, 'E', 'e')
11700 || ffesrc_char_match_init (d
, 'Q', 'q')))
11701 && ffeexpr_isdigits_ (++p
)))
11702 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11705 return (ffelexHandler
) ffeexpr_nil_real_exponent_
;
11706 return (ffelexHandler
) ffeexpr_nil_binary_
;
11709 static ffelexHandler
11710 ffeexpr_nil_real_exponent_ (ffelexToken t
)
11712 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
11713 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
11714 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11716 return (ffelexHandler
) ffeexpr_nil_real_exp_sign_
;
11719 static ffelexHandler
11720 ffeexpr_nil_real_exp_sign_ (ffelexToken t
)
11722 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
11723 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11724 return (ffelexHandler
) ffeexpr_nil_binary_
;
11727 static ffelexHandler
11728 ffeexpr_nil_number_ (ffelexToken t
)
11733 if (ffeexpr_hollerith_count_
> 0)
11734 ffelex_set_expecting_hollerith (0, '\0',
11735 ffewhere_line_unknown (),
11736 ffewhere_column_unknown ());
11738 switch (ffelex_token_type (t
))
11740 case FFELEX_typeNAME
:
11741 case FFELEX_typeNAMES
:
11742 if ((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
11744 || ffesrc_char_match_init (d
, 'E', 'e')
11745 || ffesrc_char_match_init (d
, 'Q', 'q'))
11746 && ffeexpr_isdigits_ (++p
))
11750 ffeexpr_find_
.t
= ffelex_token_use (t
);
11751 return (ffelexHandler
) ffeexpr_nil_number_exponent_
;
11753 return (ffelexHandler
) ffeexpr_nil_binary_
;
11757 case FFELEX_typePERIOD
:
11758 ffeexpr_find_
.t
= ffelex_token_use (t
);
11759 return (ffelexHandler
) ffeexpr_nil_number_period_
;
11761 case FFELEX_typeHOLLERITH
:
11762 return (ffelexHandler
) ffeexpr_nil_binary_
;
11767 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11770 /* Expects ffeexpr_find_.t. */
11772 static ffelexHandler
11773 ffeexpr_nil_number_exponent_ (ffelexToken t
)
11775 ffelexHandler nexthandler
;
11777 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
11778 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
11781 = (ffelexHandler
) ffeexpr_nil_binary_ (ffeexpr_find_
.t
);
11782 ffelex_token_kill (ffeexpr_find_
.t
);
11783 return (ffelexHandler
) (*nexthandler
) (t
);
11786 ffelex_token_kill (ffeexpr_find_
.t
);
11787 return (ffelexHandler
) ffeexpr_nil_number_exp_sign_
;
11790 static ffelexHandler
11791 ffeexpr_nil_number_exp_sign_ (ffelexToken t
)
11793 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
11794 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11796 return (ffelexHandler
) ffeexpr_nil_binary_
;
11799 /* Expects ffeexpr_find_.t. */
11801 static ffelexHandler
11802 ffeexpr_nil_number_period_ (ffelexToken t
)
11804 ffelexHandler nexthandler
;
11808 switch (ffelex_token_type (t
))
11810 case FFELEX_typeNAME
:
11811 case FFELEX_typeNAMES
:
11812 if ((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
11814 || ffesrc_char_match_init (d
, 'E', 'e')
11815 || ffesrc_char_match_init (d
, 'Q', 'q'))
11816 && ffeexpr_isdigits_ (++p
))
11819 return (ffelexHandler
) ffeexpr_nil_number_per_exp_
;
11820 ffelex_token_kill (ffeexpr_find_
.t
);
11821 return (ffelexHandler
) ffeexpr_nil_binary_
;
11824 = (ffelexHandler
) ffeexpr_nil_binary_ (ffeexpr_find_
.t
);
11825 ffelex_token_kill (ffeexpr_find_
.t
);
11826 return (ffelexHandler
) (*nexthandler
) (t
);
11828 case FFELEX_typeNUMBER
:
11829 ffelex_token_kill (ffeexpr_find_
.t
);
11830 return (ffelexHandler
) ffeexpr_nil_number_real_
;
11835 ffelex_token_kill (ffeexpr_find_
.t
);
11836 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11839 /* Expects ffeexpr_find_.t. */
11841 static ffelexHandler
11842 ffeexpr_nil_number_per_exp_ (ffelexToken t
)
11844 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
11845 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
11847 ffelexHandler nexthandler
;
11850 = (ffelexHandler
) ffeexpr_nil_binary_ (ffeexpr_find_
.t
);
11851 ffelex_token_kill (ffeexpr_find_
.t
);
11852 return (ffelexHandler
) (*nexthandler
) (t
);
11855 ffelex_token_kill (ffeexpr_find_
.t
);
11856 return (ffelexHandler
) ffeexpr_nil_num_per_exp_sign_
;
11859 static ffelexHandler
11860 ffeexpr_nil_number_real_ (ffelexToken t
)
11865 if (((ffelex_token_type (t
) != FFELEX_typeNAME
)
11866 && (ffelex_token_type (t
) != FFELEX_typeNAMES
))
11867 || !(((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
11869 || ffesrc_char_match_init (d
, 'E', 'e')
11870 || ffesrc_char_match_init (d
, 'Q', 'q')))
11871 && ffeexpr_isdigits_ (++p
)))
11872 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11875 return (ffelexHandler
) ffeexpr_nil_number_real_exp_
;
11877 return (ffelexHandler
) ffeexpr_nil_binary_
;
11880 static ffelexHandler
11881 ffeexpr_nil_num_per_exp_sign_ (ffelexToken t
)
11883 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
11884 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11885 return (ffelexHandler
) ffeexpr_nil_binary_
;
11888 static ffelexHandler
11889 ffeexpr_nil_number_real_exp_ (ffelexToken t
)
11891 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
11892 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
11893 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11894 return (ffelexHandler
) ffeexpr_nil_num_real_exp_sn_
;
11897 static ffelexHandler
11898 ffeexpr_nil_num_real_exp_sn_ (ffelexToken t
)
11900 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
11901 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11902 return (ffelexHandler
) ffeexpr_nil_binary_
;
11905 static ffelexHandler
11906 ffeexpr_nil_binary_ (ffelexToken t
)
11908 switch (ffelex_token_type (t
))
11910 case FFELEX_typePLUS
:
11911 case FFELEX_typeMINUS
:
11912 case FFELEX_typeASTERISK
:
11913 case FFELEX_typeSLASH
:
11914 case FFELEX_typePOWER
:
11915 case FFELEX_typeCONCAT
:
11916 case FFELEX_typeOPEN_ANGLE
:
11917 case FFELEX_typeCLOSE_ANGLE
:
11918 case FFELEX_typeREL_EQ
:
11919 case FFELEX_typeREL_NE
:
11920 case FFELEX_typeREL_GE
:
11921 case FFELEX_typeREL_LE
:
11922 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11924 case FFELEX_typePERIOD
:
11925 return (ffelexHandler
) ffeexpr_nil_binary_period_
;
11928 return (ffelexHandler
) ffeexpr_nil_finished_ (t
);
11932 static ffelexHandler
11933 ffeexpr_nil_binary_period_ (ffelexToken t
)
11935 switch (ffelex_token_type (t
))
11937 case FFELEX_typeNAME
:
11938 case FFELEX_typeNAMES
:
11939 ffeexpr_current_dotdot_
= ffestr_other (t
);
11940 switch (ffeexpr_current_dotdot_
)
11942 case FFESTR_otherTRUE
:
11943 case FFESTR_otherFALSE
:
11944 case FFESTR_otherNOT
:
11945 return (ffelexHandler
) ffeexpr_nil_binary_sw_per_
;
11948 return (ffelexHandler
) ffeexpr_nil_binary_end_per_
;
11950 break; /* Nothing really reaches here. */
11953 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11957 static ffelexHandler
11958 ffeexpr_nil_binary_end_per_ (ffelexToken t
)
11960 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
11961 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11962 return (ffelexHandler
) ffeexpr_nil_rhs_
;
11965 static ffelexHandler
11966 ffeexpr_nil_binary_sw_per_ (ffelexToken t
)
11968 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
11969 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
11970 return (ffelexHandler
) ffeexpr_nil_binary_
;
11973 static ffelexHandler
11974 ffeexpr_nil_quote_ (ffelexToken t
)
11976 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
11977 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
11978 return (ffelexHandler
) ffeexpr_nil_binary_
;
11981 static ffelexHandler
11982 ffeexpr_nil_apostrophe_ (ffelexToken t
)
11984 assert (ffelex_token_type (t
) == FFELEX_typeCHARACTER
);
11985 return (ffelexHandler
) ffeexpr_nil_apos_char_
;
11988 static ffelexHandler
11989 ffeexpr_nil_apos_char_ (ffelexToken t
)
11993 if ((ffelex_token_type (t
) == FFELEX_typeNAME
)
11994 || (ffelex_token_type (t
) == FFELEX_typeNAMES
))
11996 if ((ffelex_token_length (t
) == 1)
11997 && (ffesrc_char_match_init ((c
= ffelex_token_text (t
)[0]),
11999 || ffesrc_char_match_init (c
, 'O', 'o')
12000 || ffesrc_char_match_init (c
, 'X', 'x')
12001 || ffesrc_char_match_init (c
, 'Z', 'z')))
12002 return (ffelexHandler
) ffeexpr_nil_binary_
;
12004 if ((ffelex_token_type (t
) == FFELEX_typeNAME
)
12005 || (ffelex_token_type (t
) == FFELEX_typeNAMES
))
12006 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
12007 return (ffelexHandler
) ffeexpr_nil_substrp_ (t
);
12010 static ffelexHandler
12011 ffeexpr_nil_name_rhs_ (ffelexToken t
)
12013 switch (ffelex_token_type (t
))
12015 case FFELEX_typeQUOTE
:
12016 case FFELEX_typeAPOSTROPHE
:
12017 ffelex_set_hexnum (TRUE
);
12018 return (ffelexHandler
) ffeexpr_nil_name_apos_
;
12020 case FFELEX_typeOPEN_PAREN
:
12021 ++ffeexpr_find_
.level
;
12022 return (ffelexHandler
) ffeexpr_nil_rhs_
;
12025 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
12029 static ffelexHandler
12030 ffeexpr_nil_name_apos_ (ffelexToken t
)
12032 if (ffelex_token_type (t
) == FFELEX_typeNAME
)
12033 return (ffelexHandler
) ffeexpr_nil_name_apos_name_
;
12034 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
12037 static ffelexHandler
12038 ffeexpr_nil_name_apos_name_ (ffelexToken t
)
12040 switch (ffelex_token_type (t
))
12042 case FFELEX_typeAPOSTROPHE
:
12043 case FFELEX_typeQUOTE
:
12044 return (ffelexHandler
) ffeexpr_nil_finished_
;
12047 return (ffelexHandler
) ffeexpr_nil_finished_ (t
);
12051 static ffelexHandler
12052 ffeexpr_nil_percent_ (ffelexToken t
)
12054 switch (ffelex_token_type (t
))
12056 case FFELEX_typeNAME
:
12057 case FFELEX_typeNAMES
:
12058 ffeexpr_stack_
->percent
= ffeexpr_percent_ (t
);
12059 ffeexpr_find_
.t
= ffelex_token_use (t
);
12060 return (ffelexHandler
) ffeexpr_nil_percent_name_
;
12063 return (ffelexHandler
) ffeexpr_nil_rhs_ (t
);
12067 /* Expects ffeexpr_find_.t. */
12069 static ffelexHandler
12070 ffeexpr_nil_percent_name_ (ffelexToken t
)
12072 ffelexHandler nexthandler
;
12074 if (ffelex_token_type (t
) != FFELEX_typeOPEN_PAREN
)
12077 = (ffelexHandler
) ffeexpr_nil_rhs_ (ffeexpr_find_
.t
);
12078 ffelex_token_kill (ffeexpr_find_
.t
);
12079 return (ffelexHandler
) (*nexthandler
) (t
);
12082 ffelex_token_kill (ffeexpr_find_
.t
);
12083 ++ffeexpr_find_
.level
;
12084 return (ffelexHandler
) ffeexpr_nil_rhs_
;
12087 static ffelexHandler
12088 ffeexpr_nil_substrp_ (ffelexToken t
)
12090 if (ffelex_token_type (t
) != FFELEX_typeOPEN_PAREN
)
12091 return (ffelexHandler
) ffeexpr_nil_binary_ (t
);
12093 ++ffeexpr_find_
.level
;
12094 return (ffelexHandler
) ffeexpr_nil_rhs_
;
12097 /* ffeexpr_finished_ -- Reduce expression stack to one expr, finish
12100 return ffeexpr_finished_(t);
12102 Reduces expression stack to one (or zero) elements by repeatedly reducing
12103 the top operator on the stack (or, if the top element on the stack is
12104 itself an operator, issuing an error message and discarding it). Calls
12105 finishing routine with the expression, returning the ffelexHandler it
12106 returns to the caller. */
12108 static ffelexHandler
12109 ffeexpr_finished_ (ffelexToken t
)
12111 ffeexprExpr_ operand
; /* This is B in -B or A+B. */
12113 ffeexprCallback callback
;
12115 ffebldConstant constnode
; /* For detecting magical number. */
12116 ffelexToken ft
; /* Temporary copy of first token in
12118 ffelexHandler next
;
12120 bool error
= FALSE
;
12122 while (((operand
= ffeexpr_stack_
->exprstack
) != NULL
)
12123 && ((operand
->previous
!= NULL
) || (operand
->type
!= FFEEXPR_exprtypeOPERAND_
)))
12125 if (operand
->type
== FFEEXPR_exprtypeOPERAND_
)
12126 ffeexpr_reduce_ ();
12129 if (ffest_ffebad_start (FFEBAD_MISSING_OPERAND_FOR_OPERATOR
))
12131 ffebad_here (0, ffelex_token_where_line (t
),
12132 ffelex_token_where_column (t
));
12133 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->exprstack
->token
),
12134 ffelex_token_where_column (ffeexpr_stack_
->exprstack
->token
));
12137 ffeexpr_stack_
->exprstack
= operand
->previous
; /* Pop the useless
12139 ffeexpr_expr_kill_ (operand
);
12143 assert ((operand
== NULL
) || (operand
->previous
== NULL
));
12145 ffebld_pool_pop ();
12146 if (operand
== NULL
)
12150 expr
= operand
->u
.operand
;
12151 info
= ffebld_info (expr
);
12152 if ((ffebld_op (expr
) == FFEBLD_opCONTER
)
12153 && (ffebld_conter_orig (expr
) == NULL
)
12154 && ffebld_constant_is_magical (constnode
= ffebld_conter (expr
)))
12156 ffetarget_integer_bad_magical (operand
->token
);
12158 ffeexpr_expr_kill_ (operand
);
12159 ffeexpr_stack_
->exprstack
= NULL
;
12162 ft
= ffeexpr_stack_
->first_token
;
12164 again
: /* :::::::::::::::::::: */
12165 switch (ffeexpr_stack_
->context
)
12167 case FFEEXPR_contextLET
:
12168 case FFEEXPR_contextSFUNCDEF
:
12169 error
= (expr
== NULL
)
12170 || (ffeinfo_rank (info
) != 0);
12173 case FFEEXPR_contextPAREN_
:
12174 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12176 switch (ffeinfo_basictype (info
))
12178 case FFEINFO_basictypeHOLLERITH
:
12179 case FFEINFO_basictypeTYPELESS
:
12180 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12181 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12182 FFEEXPR_contextLET
);
12190 case FFEEXPR_contextPARENFILENUM_
:
12191 if (ffelex_token_type (t
) != FFELEX_typeCOMMA
)
12192 ffeexpr_stack_
->context
= FFEEXPR_contextPAREN_
;
12194 ffeexpr_stack_
->context
= FFEEXPR_contextFILENUM
;
12195 goto again
; /* :::::::::::::::::::: */
12197 case FFEEXPR_contextPARENFILEUNIT_
:
12198 if (ffelex_token_type (t
) != FFELEX_typeCOMMA
)
12199 ffeexpr_stack_
->context
= FFEEXPR_contextPAREN_
;
12201 ffeexpr_stack_
->context
= FFEEXPR_contextFILEUNIT
;
12202 goto again
; /* :::::::::::::::::::: */
12204 case FFEEXPR_contextACTUALARGEXPR_
:
12205 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
12206 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12207 : ffeinfo_basictype (info
))
12209 case FFEINFO_basictypeHOLLERITH
:
12210 case FFEINFO_basictypeTYPELESS
:
12211 if (!ffe_is_ugly_args ()
12212 && ffebad_start (FFEBAD_ACTUALARG
))
12214 ffebad_here (0, ffelex_token_where_line (ft
),
12215 ffelex_token_where_column (ft
));
12223 error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0);
12226 case FFEEXPR_contextACTUALARG_
:
12227 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
12228 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12229 : ffeinfo_basictype (info
))
12231 case FFEINFO_basictypeHOLLERITH
:
12232 case FFEINFO_basictypeTYPELESS
:
12233 #if 0 /* Should never get here. */
12234 expr
= ffeexpr_convert (expr
, ft
, ft
,
12235 FFEINFO_basictypeINTEGER
,
12236 FFEINFO_kindtypeINTEGERDEFAULT
,
12238 FFETARGET_charactersizeNONE
,
12239 FFEEXPR_contextLET
);
12241 assert ("why hollerith/typeless in actualarg_?" == NULL
);
12248 switch ((expr
== NULL
) ? FFEBLD_opANY
: ffebld_op (expr
))
12250 case FFEBLD_opSYMTER
:
12251 case FFEBLD_opPERCENT_LOC
:
12252 case FFEBLD_opPERCENT_VAL
:
12253 case FFEBLD_opPERCENT_REF
:
12254 case FFEBLD_opPERCENT_DESCR
:
12259 error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0);
12264 ffeinfoWhere where
;
12269 && (ffebld_op (expr
) == FFEBLD_opSYMTER
)
12270 && ((s
= ffebld_symter (expr
)), (where
= ffesymbol_where (s
)),
12271 (where
== FFEINFO_whereINTRINSIC
)
12272 || (where
== FFEINFO_whereGLOBAL
)
12273 || ((where
== FFEINFO_whereDUMMY
)
12274 && ((kind
= ffesymbol_kind (s
)),
12275 (kind
== FFEINFO_kindFUNCTION
)
12276 || (kind
== FFEINFO_kindSUBROUTINE
))))
12277 && !ffesymbol_explicitwhere (s
))
12279 ffebad_start (where
== FFEINFO_whereINTRINSIC
12280 ? FFEBAD_NEED_INTRINSIC
: FFEBAD_NEED_EXTERNAL
);
12281 ffebad_here (0, ffelex_token_where_line (ft
),
12282 ffelex_token_where_column (ft
));
12283 ffebad_string (ffesymbol_text (s
));
12285 ffesymbol_signal_change (s
);
12286 ffesymbol_set_explicitwhere (s
, TRUE
);
12287 ffesymbol_signal_unreported (s
);
12292 case FFEEXPR_contextINDEX_
:
12293 case FFEEXPR_contextSFUNCDEFINDEX_
:
12294 if ((error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0)))
12296 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12297 : ffeinfo_basictype (info
))
12299 case FFEINFO_basictypeNONE
:
12303 case FFEINFO_basictypeLOGICAL
:
12304 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12305 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12306 FFEEXPR_contextLET
);
12307 /* Fall through. */
12308 case FFEINFO_basictypeREAL
:
12309 case FFEINFO_basictypeCOMPLEX
:
12310 if (ffe_is_pedantic ())
12315 /* Fall through. */
12316 case FFEINFO_basictypeHOLLERITH
:
12317 case FFEINFO_basictypeTYPELESS
:
12319 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12320 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12321 FFEEXPR_contextLET
);
12324 case FFEINFO_basictypeINTEGER
:
12325 /* Specifically, allow INTEGER(KIND=2), aka INTEGER*8, through
12326 unmolested. Leave it to downstream to handle kinds. */
12333 break; /* expr==NULL ok for substring; element case
12334 caught by callback. */
12336 case FFEEXPR_contextRETURN
:
12337 if ((error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0)))
12339 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12340 : ffeinfo_basictype (info
))
12342 case FFEINFO_basictypeNONE
:
12346 case FFEINFO_basictypeLOGICAL
:
12347 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12348 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12349 FFEEXPR_contextLET
);
12350 /* Fall through. */
12351 case FFEINFO_basictypeREAL
:
12352 case FFEINFO_basictypeCOMPLEX
:
12353 if (ffe_is_pedantic ())
12358 /* Fall through. */
12359 case FFEINFO_basictypeINTEGER
:
12360 case FFEINFO_basictypeHOLLERITH
:
12361 case FFEINFO_basictypeTYPELESS
:
12363 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12364 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12365 FFEEXPR_contextLET
);
12374 case FFEEXPR_contextDO
:
12375 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12377 switch (ffeinfo_basictype (info
))
12379 case FFEINFO_basictypeLOGICAL
:
12380 error
= !ffe_is_ugly_logint ();
12381 if (!ffeexpr_stack_
->is_rhs
)
12382 break; /* Don't convert lhs variable. */
12383 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12384 ffeinfo_kindtype (ffebld_info (expr
)), 0,
12385 FFETARGET_charactersizeNONE
,
12386 FFEEXPR_contextLET
);
12389 case FFEINFO_basictypeHOLLERITH
:
12390 case FFEINFO_basictypeTYPELESS
:
12391 if (!ffeexpr_stack_
->is_rhs
)
12394 break; /* Don't convert lhs variable. */
12398 case FFEINFO_basictypeINTEGER
:
12399 case FFEINFO_basictypeREAL
:
12406 if (!ffeexpr_stack_
->is_rhs
12407 && (ffebld_op (expr
) != FFEBLD_opSYMTER
))
12411 case FFEEXPR_contextDOWHILE
:
12412 case FFEEXPR_contextIF
:
12413 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12415 switch (ffeinfo_basictype (info
))
12417 case FFEINFO_basictypeINTEGER
:
12419 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12420 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12421 FFEEXPR_contextLET
);
12422 /* Fall through. */
12423 case FFEINFO_basictypeLOGICAL
:
12424 case FFEINFO_basictypeHOLLERITH
:
12425 case FFEINFO_basictypeTYPELESS
:
12427 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12428 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12429 FFEEXPR_contextLET
);
12438 case FFEEXPR_contextASSIGN
:
12439 case FFEEXPR_contextAGOTO
:
12440 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12441 : ffeinfo_basictype (info
))
12443 case FFEINFO_basictypeINTEGER
:
12444 error
= (ffeinfo_kindtype (info
) != ffecom_label_kind ());
12447 case FFEINFO_basictypeLOGICAL
:
12448 error
= !ffe_is_ugly_logint ()
12449 || (ffeinfo_kindtype (info
) != ffecom_label_kind ());
12456 if ((expr
== NULL
) || (ffeinfo_rank (info
) != 0)
12457 || (ffebld_op (expr
) != FFEBLD_opSYMTER
))
12461 case FFEEXPR_contextCGOTO
:
12462 case FFEEXPR_contextFORMAT
:
12463 case FFEEXPR_contextDIMLIST
:
12464 case FFEEXPR_contextFILENUM
: /* See equiv code in _ambig_. */
12465 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12467 switch (ffeinfo_basictype (info
))
12469 case FFEINFO_basictypeLOGICAL
:
12470 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12471 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12472 FFEEXPR_contextLET
);
12473 /* Fall through. */
12474 case FFEINFO_basictypeREAL
:
12475 case FFEINFO_basictypeCOMPLEX
:
12476 if (ffe_is_pedantic ())
12481 /* Fall through. */
12482 case FFEINFO_basictypeINTEGER
:
12483 case FFEINFO_basictypeHOLLERITH
:
12484 case FFEINFO_basictypeTYPELESS
:
12486 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12487 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12488 FFEEXPR_contextLET
);
12497 case FFEEXPR_contextARITHIF
:
12498 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12500 switch (ffeinfo_basictype (info
))
12502 case FFEINFO_basictypeLOGICAL
:
12503 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12504 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12505 FFEEXPR_contextLET
);
12506 if (ffe_is_pedantic ())
12511 /* Fall through. */
12512 case FFEINFO_basictypeHOLLERITH
:
12513 case FFEINFO_basictypeTYPELESS
:
12514 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12515 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12516 FFEEXPR_contextLET
);
12517 /* Fall through. */
12518 case FFEINFO_basictypeINTEGER
:
12519 case FFEINFO_basictypeREAL
:
12529 case FFEEXPR_contextSTOP
:
12530 if ((error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0)))
12532 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12533 : ffeinfo_basictype (info
))
12535 case FFEINFO_basictypeINTEGER
:
12536 error
= (ffeinfo_kindtype (info
) != FFEINFO_kindtypeINTEGERDEFAULT
);
12539 case FFEINFO_basictypeCHARACTER
:
12540 error
= (ffeinfo_kindtype (info
) != FFEINFO_kindtypeCHARACTERDEFAULT
);
12543 case FFEINFO_basictypeHOLLERITH
:
12544 case FFEINFO_basictypeTYPELESS
:
12546 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12547 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12548 FFEEXPR_contextLET
);
12551 case FFEINFO_basictypeNONE
:
12559 if ((expr
!= NULL
) && ((ffebld_op (expr
) != FFEBLD_opCONTER
)
12560 || (ffebld_conter_orig (expr
) != NULL
)))
12564 case FFEEXPR_contextINCLUDE
:
12565 error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)
12566 || (ffeinfo_basictype (info
) != FFEINFO_basictypeCHARACTER
)
12567 || (ffebld_op (expr
) != FFEBLD_opCONTER
)
12568 || (ffebld_conter_orig (expr
) != NULL
);
12571 case FFEEXPR_contextSELECTCASE
:
12572 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12574 switch (ffeinfo_basictype (info
))
12576 case FFEINFO_basictypeINTEGER
:
12577 case FFEINFO_basictypeCHARACTER
:
12578 case FFEINFO_basictypeLOGICAL
:
12582 case FFEINFO_basictypeHOLLERITH
:
12583 case FFEINFO_basictypeTYPELESS
:
12585 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12586 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12587 FFEEXPR_contextLET
);
12596 case FFEEXPR_contextCASE
:
12597 if ((error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0)))
12599 switch ((expr
== NULL
) ? FFEINFO_basictypeINTEGER
12600 : ffeinfo_basictype (info
))
12602 case FFEINFO_basictypeINTEGER
:
12603 case FFEINFO_basictypeCHARACTER
:
12604 case FFEINFO_basictypeLOGICAL
:
12608 case FFEINFO_basictypeHOLLERITH
:
12609 case FFEINFO_basictypeTYPELESS
:
12611 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12612 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12613 FFEEXPR_contextLET
);
12620 if ((expr
!= NULL
) && (ffebld_op (expr
) != FFEBLD_opCONTER
))
12624 case FFEEXPR_contextCHARACTERSIZE
:
12625 case FFEEXPR_contextKINDTYPE
:
12626 case FFEEXPR_contextDIMLISTCOMMON
:
12627 if ((error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0)))
12629 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12630 : ffeinfo_basictype (info
))
12632 case FFEINFO_basictypeLOGICAL
:
12633 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12634 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12635 FFEEXPR_contextLET
);
12636 /* Fall through. */
12637 case FFEINFO_basictypeREAL
:
12638 case FFEINFO_basictypeCOMPLEX
:
12639 if (ffe_is_pedantic ())
12644 /* Fall through. */
12645 case FFEINFO_basictypeINTEGER
:
12646 case FFEINFO_basictypeHOLLERITH
:
12647 case FFEINFO_basictypeTYPELESS
:
12649 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12650 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12651 FFEEXPR_contextLET
);
12658 if ((expr
!= NULL
) && (ffebld_op (expr
) != FFEBLD_opCONTER
))
12662 case FFEEXPR_contextEQVINDEX_
:
12663 if ((error
= (expr
!= NULL
) && (ffeinfo_rank (info
) != 0)))
12665 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12666 : ffeinfo_basictype (info
))
12668 case FFEINFO_basictypeNONE
:
12672 case FFEINFO_basictypeLOGICAL
:
12673 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12674 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12675 FFEEXPR_contextLET
);
12676 /* Fall through. */
12677 case FFEINFO_basictypeREAL
:
12678 case FFEINFO_basictypeCOMPLEX
:
12679 if (ffe_is_pedantic ())
12684 /* Fall through. */
12685 case FFEINFO_basictypeINTEGER
:
12686 case FFEINFO_basictypeHOLLERITH
:
12687 case FFEINFO_basictypeTYPELESS
:
12689 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12690 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12691 FFEEXPR_contextLET
);
12698 if ((expr
!= NULL
) && (ffebld_op (expr
) != FFEBLD_opCONTER
))
12702 case FFEEXPR_contextPARAMETER
:
12703 if (ffeexpr_stack_
->is_rhs
)
12704 error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)
12705 || (ffebld_op (expr
) != FFEBLD_opCONTER
);
12707 error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)
12708 || (ffebld_op (expr
) != FFEBLD_opSYMTER
);
12711 case FFEEXPR_contextINDEXORACTUALARG_
:
12712 if (ffelex_token_type (t
) == FFELEX_typeCOLON
)
12713 ffeexpr_stack_
->context
= FFEEXPR_contextINDEX_
;
12715 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARG_
;
12716 goto again
; /* :::::::::::::::::::: */
12718 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
12719 if (ffelex_token_type (t
) == FFELEX_typeCOLON
)
12720 ffeexpr_stack_
->context
= FFEEXPR_contextINDEX_
;
12722 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
12723 goto again
; /* :::::::::::::::::::: */
12725 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
12726 if (ffelex_token_type (t
) == FFELEX_typeCOLON
)
12727 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEX_
;
12729 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARG_
;
12730 goto again
; /* :::::::::::::::::::: */
12732 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
12733 if (ffelex_token_type (t
) == FFELEX_typeCOLON
)
12734 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFINDEX_
;
12736 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
12737 goto again
; /* :::::::::::::::::::: */
12739 case FFEEXPR_contextIMPDOCTRL_
:
12740 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12742 if (!ffeexpr_stack_
->is_rhs
12743 && (ffebld_op (expr
) != FFEBLD_opSYMTER
))
12745 switch (ffeinfo_basictype (info
))
12747 case FFEINFO_basictypeLOGICAL
:
12748 if (! ffe_is_ugly_logint ())
12750 if (! ffeexpr_stack_
->is_rhs
)
12752 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12753 ffeinfo_kindtype (info
), 0,
12754 FFETARGET_charactersizeNONE
,
12755 FFEEXPR_contextLET
);
12758 case FFEINFO_basictypeINTEGER
:
12759 case FFEINFO_basictypeHOLLERITH
:
12760 case FFEINFO_basictypeTYPELESS
:
12763 case FFEINFO_basictypeREAL
:
12764 if (!ffeexpr_stack_
->is_rhs
12765 && ffe_is_warn_surprising ()
12768 ffebad_start (FFEBAD_DO_REAL
); /* See error message!!! */
12769 ffebad_here (0, ffelex_token_where_line (ft
),
12770 ffelex_token_where_column (ft
));
12771 ffebad_string (ffelex_token_text (ft
));
12782 case FFEEXPR_contextDATAIMPDOCTRL_
:
12783 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12785 if (ffeexpr_stack_
->is_rhs
)
12787 if ((ffebld_op (expr
) != FFEBLD_opCONTER
)
12788 && (ffeinfo_where (info
) != FFEINFO_whereIMMEDIATE
))
12791 else if ((ffebld_op (expr
) != FFEBLD_opSYMTER
)
12792 || (ffeinfo_where (info
) != FFEINFO_whereIMMEDIATE
))
12794 switch (ffeinfo_basictype (info
))
12796 case FFEINFO_basictypeLOGICAL
:
12797 if (! ffeexpr_stack_
->is_rhs
)
12799 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12800 ffeinfo_kindtype (info
), 0,
12801 FFETARGET_charactersizeNONE
,
12802 FFEEXPR_contextLET
);
12803 /* Fall through. */
12804 case FFEINFO_basictypeINTEGER
:
12805 if (ffeexpr_stack_
->is_rhs
12806 && (ffeinfo_kindtype (ffebld_info (expr
))
12807 != FFEINFO_kindtypeINTEGERDEFAULT
))
12808 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12809 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
12810 FFETARGET_charactersizeNONE
,
12811 FFEEXPR_contextLET
);
12814 case FFEINFO_basictypeHOLLERITH
:
12815 case FFEINFO_basictypeTYPELESS
:
12816 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12817 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12818 FFEEXPR_contextLET
);
12821 case FFEINFO_basictypeREAL
:
12822 if (!ffeexpr_stack_
->is_rhs
12823 && ffe_is_warn_surprising ()
12826 ffebad_start (FFEBAD_DO_REAL
); /* See error message!!! */
12827 ffebad_here (0, ffelex_token_where_line (ft
),
12828 ffelex_token_where_column (ft
));
12829 ffebad_string (ffelex_token_text (ft
));
12840 case FFEEXPR_contextIMPDOITEM_
:
12841 if (ffelex_token_type (t
) == FFELEX_typeEQUALS
)
12843 ffeexpr_stack_
->is_rhs
= FALSE
;
12844 ffeexpr_stack_
->context
= FFEEXPR_contextIMPDOCTRL_
;
12845 goto again
; /* :::::::::::::::::::: */
12847 /* Fall through. */
12848 case FFEEXPR_contextIOLIST
:
12849 case FFEEXPR_contextFILEVXTCODE
:
12850 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12851 : ffeinfo_basictype (info
))
12853 case FFEINFO_basictypeHOLLERITH
:
12854 case FFEINFO_basictypeTYPELESS
:
12855 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12856 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12857 FFEEXPR_contextLET
);
12863 error
= (expr
== NULL
)
12864 || ((ffeinfo_rank (info
) != 0)
12865 && ((ffebld_op (expr
) != FFEBLD_opSYMTER
)
12866 || (ffesymbol_arraysize (ffebld_symter (expr
)) == NULL
)
12867 || (ffebld_op (ffesymbol_arraysize (ffebld_symter (expr
)))
12868 == FFEBLD_opSTAR
))); /* Bad if null expr, or if
12869 array that is not a SYMTER
12870 (can't happen yet, I
12871 think) or has a NULL or
12872 STAR (assumed) array
12876 case FFEEXPR_contextIMPDOITEMDF_
:
12877 if (ffelex_token_type (t
) == FFELEX_typeEQUALS
)
12879 ffeexpr_stack_
->is_rhs
= FALSE
;
12880 ffeexpr_stack_
->context
= FFEEXPR_contextIMPDOCTRL_
;
12881 goto again
; /* :::::::::::::::::::: */
12883 /* Fall through. */
12884 case FFEEXPR_contextIOLISTDF
:
12885 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12886 : ffeinfo_basictype (info
))
12888 case FFEINFO_basictypeHOLLERITH
:
12889 case FFEINFO_basictypeTYPELESS
:
12890 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12891 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12892 FFEEXPR_contextLET
);
12900 || ((ffeinfo_basictype (info
) == FFEINFO_basictypeCHARACTER
)
12901 && (ffeinfo_kindtype (info
) != FFEINFO_kindtypeCHARACTERDEFAULT
))
12902 || ((ffeinfo_rank (info
) != 0)
12903 && ((ffebld_op (expr
) != FFEBLD_opSYMTER
)
12904 || (ffesymbol_arraysize (ffebld_symter (expr
)) == NULL
)
12905 || (ffebld_op (ffesymbol_arraysize (ffebld_symter (expr
)))
12906 == FFEBLD_opSTAR
))); /* Bad if null expr,
12907 non-default-kindtype
12908 character expr, or if
12909 array that is not a SYMTER
12910 (can't happen yet, I
12911 think) or has a NULL or
12912 STAR (assumed) array
12916 case FFEEXPR_contextDATAIMPDOITEM_
:
12917 error
= (expr
== NULL
)
12918 || (ffebld_op (expr
) != FFEBLD_opARRAYREF
)
12919 || ((ffeinfo_where (info
) != FFEINFO_whereFLEETING_CADDR
)
12920 && (ffeinfo_where (info
) != FFEINFO_whereFLEETING_IADDR
));
12923 case FFEEXPR_contextDATAIMPDOINDEX_
:
12924 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
12926 switch (ffeinfo_basictype (info
))
12928 case FFEINFO_basictypeLOGICAL
:
12929 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
12930 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12931 FFEEXPR_contextLET
);
12932 /* Fall through. */
12933 case FFEINFO_basictypeREAL
:
12934 case FFEINFO_basictypeCOMPLEX
:
12935 if (ffe_is_pedantic ())
12940 /* Fall through. */
12941 case FFEINFO_basictypeINTEGER
:
12942 case FFEINFO_basictypeHOLLERITH
:
12943 case FFEINFO_basictypeTYPELESS
:
12945 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
12946 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
12947 FFEEXPR_contextLET
);
12954 if ((ffeinfo_where (info
) != FFEINFO_whereCONSTANT
)
12955 && (ffeinfo_where (info
) != FFEINFO_whereIMMEDIATE
))
12959 case FFEEXPR_contextDATA
:
12962 else if (ffeexpr_stack_
->is_rhs
)
12963 error
= (ffebld_op (expr
) != FFEBLD_opCONTER
);
12964 else if (ffebld_op (expr
) == FFEBLD_opSYMTER
)
12967 error
= (ffeinfo_where (info
) != FFEINFO_whereFLEETING_CADDR
);
12970 case FFEEXPR_contextINITVAL
:
12971 error
= (expr
== NULL
) || (ffebld_op (expr
) != FFEBLD_opCONTER
);
12974 case FFEEXPR_contextEQUIVALENCE
:
12977 else if (ffebld_op (expr
) == FFEBLD_opSYMTER
)
12980 error
= (ffeinfo_where (info
) != FFEINFO_whereFLEETING_CADDR
);
12983 case FFEEXPR_contextFILEASSOC
:
12984 case FFEEXPR_contextFILEINT
:
12985 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
12986 : ffeinfo_basictype (info
))
12988 case FFEINFO_basictypeINTEGER
:
12989 /* Maybe this should be supported someday, but, right now,
12990 g77 can't generate a call to libf2c to write to an
12991 integer other than the default size. */
12992 error
= ((! ffeexpr_stack_
->is_rhs
)
12993 && ffeinfo_kindtype (info
) != FFEINFO_kindtypeINTEGERDEFAULT
);
13000 if ((expr
== NULL
) || (ffeinfo_rank (info
) != 0))
13004 case FFEEXPR_contextFILEDFINT
:
13005 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
13006 : ffeinfo_basictype (info
))
13008 case FFEINFO_basictypeINTEGER
:
13009 error
= (ffeinfo_kindtype (info
) != FFEINFO_kindtypeINTEGERDEFAULT
);
13016 if ((expr
== NULL
) || (ffeinfo_rank (info
) != 0))
13020 case FFEEXPR_contextFILELOG
:
13021 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
13022 : ffeinfo_basictype (info
))
13024 case FFEINFO_basictypeLOGICAL
:
13032 if ((expr
== NULL
) || (ffeinfo_rank (info
) != 0))
13036 case FFEEXPR_contextFILECHAR
:
13037 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
13038 : ffeinfo_basictype (info
))
13040 case FFEINFO_basictypeCHARACTER
:
13048 if ((expr
== NULL
) || (ffeinfo_rank (info
) != 0))
13052 case FFEEXPR_contextFILENUMCHAR
:
13053 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
13055 switch (ffeinfo_basictype (info
))
13057 case FFEINFO_basictypeLOGICAL
:
13058 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
13059 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13060 FFEEXPR_contextLET
);
13061 /* Fall through. */
13062 case FFEINFO_basictypeREAL
:
13063 case FFEINFO_basictypeCOMPLEX
:
13064 if (ffe_is_pedantic ())
13069 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
13070 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13071 FFEEXPR_contextLET
);
13074 case FFEINFO_basictypeINTEGER
:
13075 case FFEINFO_basictypeCHARACTER
:
13085 case FFEEXPR_contextFILEDFCHAR
:
13086 if ((error
= (expr
== NULL
) || (ffeinfo_rank (info
) != 0)))
13088 switch (ffeinfo_basictype (info
))
13090 case FFEINFO_basictypeCHARACTER
:
13092 = (ffeinfo_kindtype (info
)
13093 != FFEINFO_kindtypeCHARACTERDEFAULT
);
13100 if (!ffeexpr_stack_
->is_rhs
13101 && (ffebld_op (expr
) == FFEBLD_opSUBSTR
))
13105 case FFEEXPR_contextFILEUNIT
: /* See equiv code in _ambig_. */
13106 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
13107 : ffeinfo_basictype (info
))
13109 case FFEINFO_basictypeLOGICAL
:
13110 if ((error
= (ffeinfo_rank (info
) != 0)))
13112 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
13113 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13114 FFEEXPR_contextLET
);
13115 /* Fall through. */
13116 case FFEINFO_basictypeREAL
:
13117 case FFEINFO_basictypeCOMPLEX
:
13118 if ((error
= (ffeinfo_rank (info
) != 0)))
13120 if (ffe_is_pedantic ())
13125 /* Fall through. */
13126 case FFEINFO_basictypeINTEGER
:
13127 case FFEINFO_basictypeHOLLERITH
:
13128 case FFEINFO_basictypeTYPELESS
:
13129 if ((error
= (ffeinfo_rank (info
) != 0)))
13131 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
13132 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13133 FFEEXPR_contextLET
);
13136 case FFEINFO_basictypeCHARACTER
:
13137 switch (ffebld_op (expr
))
13138 { /* As if _lhs had been called instead of
13140 case FFEBLD_opSYMTER
:
13142 = (ffeinfo_where (ffebld_info (expr
)) == FFEINFO_whereCONSTANT
);
13145 case FFEBLD_opSUBSTR
:
13146 error
= (ffeinfo_where (ffebld_info (expr
))
13147 == FFEINFO_whereCONSTANT_SUBOBJECT
);
13150 case FFEBLD_opARRAYREF
:
13159 && ((ffeinfo_kindtype (info
) != FFEINFO_kindtypeCHARACTERDEFAULT
)
13160 || ((ffeinfo_rank (info
) != 0)
13161 && ((ffebld_op (expr
) != FFEBLD_opSYMTER
)
13162 || (ffesymbol_arraysize (ffebld_symter (expr
)) == NULL
)
13163 || (ffebld_op (ffesymbol_arraysize (ffebld_symter (expr
)))
13164 == FFEBLD_opSTAR
))))) /* Bad if
13165 non-default-kindtype
13166 character expr, or if
13167 array that is not a SYMTER
13168 (can't happen yet, I
13169 think), or has a NULL or
13170 STAR (assumed) array
13181 case FFEEXPR_contextFILEFORMAT
:
13182 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
13183 : ffeinfo_basictype (info
))
13185 case FFEINFO_basictypeINTEGER
:
13186 error
= (expr
== NULL
)
13187 || ((ffeinfo_rank (info
) != 0) ?
13188 ffe_is_pedantic () /* F77 C5. */
13189 : (bool) (ffeinfo_kindtype (info
) != ffecom_label_kind ()))
13190 || (ffebld_op (expr
) != FFEBLD_opSYMTER
);
13193 case FFEINFO_basictypeLOGICAL
:
13194 case FFEINFO_basictypeREAL
:
13195 case FFEINFO_basictypeCOMPLEX
:
13196 /* F77 C5 -- must be an array of hollerith. */
13198 = ffe_is_pedantic ()
13199 || (ffeinfo_rank (info
) == 0);
13202 case FFEINFO_basictypeCHARACTER
:
13203 if ((ffeinfo_kindtype (info
) != FFEINFO_kindtypeCHARACTERDEFAULT
)
13204 || ((ffeinfo_rank (info
) != 0)
13205 && ((ffebld_op (expr
) != FFEBLD_opSYMTER
)
13206 || (ffesymbol_arraysize (ffebld_symter (expr
)) == NULL
)
13207 || (ffebld_op (ffesymbol_arraysize (ffebld_symter (expr
)))
13208 == FFEBLD_opSTAR
)))) /* Bad if
13209 non-default-kindtype
13210 character expr, or if
13211 array that is not a SYMTER
13212 (can't happen yet, I
13213 think), or has a NULL or
13214 STAR (assumed) array
13227 case FFEEXPR_contextLOC_
:
13228 /* See also ffeintrin_check_loc_. */
13230 || (ffeinfo_kind (info
) != FFEINFO_kindENTITY
)
13231 || ((ffebld_op (expr
) != FFEBLD_opSYMTER
)
13232 && (ffebld_op (expr
) != FFEBLD_opSUBSTR
)
13233 && (ffebld_op (expr
) != FFEBLD_opARRAYREF
)))
13242 if (error
&& ((expr
== NULL
) || (ffebld_op (expr
) != FFEBLD_opANY
)))
13244 ffebad_start (FFEBAD_EXPR_WRONG
);
13245 ffebad_here (0, ffelex_token_where_line (ft
),
13246 ffelex_token_where_column (ft
));
13248 expr
= ffebld_new_any ();
13249 ffebld_set_info (expr
, ffeinfo_new_any ());
13252 callback
= ffeexpr_stack_
->callback
;
13253 s
= ffeexpr_stack_
->previous
;
13254 malloc_kill_ks (ffe_pool_program_unit (), ffeexpr_stack_
,
13255 sizeof (*ffeexpr_stack_
));
13256 ffeexpr_stack_
= s
;
13257 next
= (ffelexHandler
) (*callback
) (ft
, expr
, t
);
13258 ffelex_token_kill (ft
);
13259 return (ffelexHandler
) next
;
13262 /* ffeexpr_finished_ambig_ -- Check validity of ambiguous unit/form spec
13265 expr = ffeexpr_finished_ambig_(expr);
13267 Replicates a bit of ffeexpr_finished_'s task when in a context
13268 of UNIT or FORMAT. */
13271 ffeexpr_finished_ambig_ (ffelexToken ft
, ffebld expr
)
13273 ffeinfo info
= ffebld_info (expr
);
13276 switch (ffeexpr_stack_
->context
)
13278 case FFEEXPR_contextFILENUMAMBIG
: /* Same as FILENUM in _finished_. */
13279 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
13280 : ffeinfo_basictype (info
))
13282 case FFEINFO_basictypeLOGICAL
:
13283 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
13284 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13285 FFEEXPR_contextLET
);
13286 /* Fall through. */
13287 case FFEINFO_basictypeREAL
:
13288 case FFEINFO_basictypeCOMPLEX
:
13289 if (ffe_is_pedantic ())
13294 /* Fall through. */
13295 case FFEINFO_basictypeINTEGER
:
13296 case FFEINFO_basictypeHOLLERITH
:
13297 case FFEINFO_basictypeTYPELESS
:
13299 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
13300 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13301 FFEEXPR_contextLET
);
13308 if ((expr
== NULL
) || (ffeinfo_rank (info
) != 0))
13312 case FFEEXPR_contextFILEUNITAMBIG
: /* Same as FILEUNIT in _finished_. */
13313 if ((expr
!= NULL
) && (ffebld_op (expr
) == FFEBLD_opSTAR
))
13318 switch ((expr
== NULL
) ? FFEINFO_basictypeNONE
13319 : ffeinfo_basictype (info
))
13321 case FFEINFO_basictypeLOGICAL
:
13322 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeLOGICAL
,
13323 FFEINFO_kindtypeLOGICALDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13324 FFEEXPR_contextLET
);
13325 /* Fall through. */
13326 case FFEINFO_basictypeREAL
:
13327 case FFEINFO_basictypeCOMPLEX
:
13328 if (ffe_is_pedantic ())
13333 /* Fall through. */
13334 case FFEINFO_basictypeINTEGER
:
13335 case FFEINFO_basictypeHOLLERITH
:
13336 case FFEINFO_basictypeTYPELESS
:
13337 error
= (ffeinfo_rank (info
) != 0);
13338 expr
= ffeexpr_convert (expr
, ft
, ft
, FFEINFO_basictypeINTEGER
,
13339 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFETARGET_charactersizeNONE
,
13340 FFEEXPR_contextLET
);
13343 case FFEINFO_basictypeCHARACTER
:
13344 switch (ffebld_op (expr
))
13345 { /* As if _lhs had been called instead of
13347 case FFEBLD_opSYMTER
:
13349 = (ffeinfo_where (ffebld_info (expr
)) == FFEINFO_whereCONSTANT
);
13352 case FFEBLD_opSUBSTR
:
13353 error
= (ffeinfo_where (ffebld_info (expr
))
13354 == FFEINFO_whereCONSTANT_SUBOBJECT
);
13357 case FFEBLD_opARRAYREF
:
13374 assert ("bad context" == NULL
);
13379 if (error
&& ((expr
== NULL
) || (ffebld_op (expr
) != FFEBLD_opANY
)))
13381 ffebad_start (FFEBAD_EXPR_WRONG
);
13382 ffebad_here (0, ffelex_token_where_line (ft
),
13383 ffelex_token_where_column (ft
));
13385 expr
= ffebld_new_any ();
13386 ffebld_set_info (expr
, ffeinfo_new_any ());
13392 /* ffeexpr_token_lhs_ -- Initial state for lhs expression
13394 Return a pointer to this function to the lexer (ffelex), which will
13395 invoke it for the next token.
13397 Basically a smaller version of _rhs_; keep them both in sync, of course. */
13399 static ffelexHandler
13400 ffeexpr_token_lhs_ (ffelexToken t
)
13403 /* When changing the list of valid initial lhs tokens, check whether to
13404 update a corresponding list in ffeexpr_cb_close_paren_ambig_1_ for the
13405 READ (expr) <token> case -- it assumes it knows which tokens <token> can
13406 be to indicate an lhs (or implied DO), which right now is the set
13409 This comment also appears in ffeexpr_token_first_lhs_. */
13411 switch (ffelex_token_type (t
))
13413 case FFELEX_typeNAME
:
13414 case FFELEX_typeNAMES
:
13415 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13416 return (ffelexHandler
) ffeexpr_token_name_lhs_
;
13419 return (ffelexHandler
) ffeexpr_finished_ (t
);
13423 /* ffeexpr_token_rhs_ -- Initial state for rhs expression
13425 Return a pointer to this function to the lexer (ffelex), which will
13426 invoke it for the next token.
13428 The initial state and the post-binary-operator state are the same and
13429 both handled here, with the expression stack used to distinguish
13430 between them. Binary operators are invalid here; unary operators,
13431 constants, subexpressions, and name references are valid. */
13433 static ffelexHandler
13434 ffeexpr_token_rhs_ (ffelexToken t
)
13438 switch (ffelex_token_type (t
))
13440 case FFELEX_typeQUOTE
:
13443 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13444 return (ffelexHandler
) ffeexpr_token_quote_
;
13446 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13447 ffelex_set_expecting_hollerith (-1, '\"',
13448 ffelex_token_where_line (t
),
13449 ffelex_token_where_column (t
));
13450 /* Don't have to unset this one. */
13451 return (ffelexHandler
) ffeexpr_token_apostrophe_
;
13453 case FFELEX_typeAPOSTROPHE
:
13454 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13455 ffelex_set_expecting_hollerith (-1, '\'',
13456 ffelex_token_where_line (t
),
13457 ffelex_token_where_column (t
));
13458 /* Don't have to unset this one. */
13459 return (ffelexHandler
) ffeexpr_token_apostrophe_
;
13461 case FFELEX_typePERCENT
:
13462 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13463 return (ffelexHandler
) ffeexpr_token_percent_
;
13465 case FFELEX_typeOPEN_PAREN
:
13466 ffeexpr_stack_
->tokens
[0] = ffelex_token_use (t
);
13467 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
13468 FFEEXPR_contextPAREN_
,
13469 ffeexpr_cb_close_paren_c_
);
13471 case FFELEX_typePLUS
:
13472 e
= ffeexpr_expr_new_ ();
13473 e
->type
= FFEEXPR_exprtypeUNARY_
;
13474 e
->token
= ffelex_token_use (t
);
13475 e
->u
.operator.op
= FFEEXPR_operatorADD_
;
13476 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceADD_
;
13477 e
->u
.operator.as
= FFEEXPR_operatorassociativityADD_
;
13478 ffeexpr_exprstack_push_unary_ (e
);
13479 return (ffelexHandler
) ffeexpr_token_rhs_
;
13481 case FFELEX_typeMINUS
:
13482 e
= ffeexpr_expr_new_ ();
13483 e
->type
= FFEEXPR_exprtypeUNARY_
;
13484 e
->token
= ffelex_token_use (t
);
13485 e
->u
.operator.op
= FFEEXPR_operatorSUBTRACT_
;
13486 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceSUBTRACT_
;
13487 e
->u
.operator.as
= FFEEXPR_operatorassociativitySUBTRACT_
;
13488 ffeexpr_exprstack_push_unary_ (e
);
13489 return (ffelexHandler
) ffeexpr_token_rhs_
;
13491 case FFELEX_typePERIOD
:
13492 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13493 return (ffelexHandler
) ffeexpr_token_period_
;
13495 case FFELEX_typeNUMBER
:
13496 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13497 ffeexpr_hollerith_count_
= atol (ffelex_token_text (t
));
13498 if (ffeexpr_hollerith_count_
> 0)
13499 ffelex_set_expecting_hollerith (ffeexpr_hollerith_count_
,
13501 ffelex_token_where_line (t
),
13502 ffelex_token_where_column (t
));
13503 return (ffelexHandler
) ffeexpr_token_number_
;
13505 case FFELEX_typeNAME
:
13506 case FFELEX_typeNAMES
:
13507 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
13508 switch (ffeexpr_stack_
->context
)
13510 case FFEEXPR_contextACTUALARG_
:
13511 case FFEEXPR_contextINDEXORACTUALARG_
:
13512 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
13513 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
13514 return (ffelexHandler
) ffeexpr_token_name_arg_
;
13517 return (ffelexHandler
) ffeexpr_token_name_rhs_
;
13520 case FFELEX_typeASTERISK
:
13521 case FFELEX_typeSLASH
:
13522 case FFELEX_typePOWER
:
13523 case FFELEX_typeCONCAT
:
13524 case FFELEX_typeREL_EQ
:
13525 case FFELEX_typeREL_NE
:
13526 case FFELEX_typeREL_LE
:
13527 case FFELEX_typeREL_GE
:
13528 if (ffest_ffebad_start (FFEBAD_MISSING_FIRST_BINARY_OPERAND
))
13530 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
13533 return (ffelexHandler
) ffeexpr_token_rhs_
;
13536 case FFELEX_typeEQUALS
:
13537 case FFELEX_typePOINTS
:
13538 case FFELEX_typeCLOSE_ANGLE
:
13539 case FFELEX_typeCLOSE_PAREN
:
13540 case FFELEX_typeCOMMA
:
13541 case FFELEX_typeCOLON
:
13542 case FFELEX_typeEOS
:
13543 case FFELEX_typeSEMICOLON
:
13546 return (ffelexHandler
) ffeexpr_finished_ (t
);
13550 /* ffeexpr_token_period_ -- Rhs PERIOD
13552 Return a pointer to this function to the lexer (ffelex), which will
13553 invoke it for the next token.
13555 Handle a period detected at rhs (expecting unary op or operand) state.
13556 Must begin a floating-point value (as in .12) or a dot-dot name, of
13557 which only .NOT., .TRUE., and .FALSE. are truly valid. Other sort-of-
13558 valid names represent binary operators, which are invalid here because
13559 there isn't an operand at the top of the stack. */
13561 static ffelexHandler
13562 ffeexpr_token_period_ (ffelexToken t
)
13564 switch (ffelex_token_type (t
))
13566 case FFELEX_typeNAME
:
13567 case FFELEX_typeNAMES
:
13568 ffeexpr_current_dotdot_
= ffestr_other (t
);
13569 switch (ffeexpr_current_dotdot_
)
13571 case FFESTR_otherNone
:
13572 if (ffest_ffebad_start (FFEBAD_IGNORING_PERIOD
))
13574 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
13575 ffelex_token_where_column (ffeexpr_tokens_
[0]));
13578 ffelex_token_kill (ffeexpr_tokens_
[0]);
13579 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
13581 case FFESTR_otherTRUE
:
13582 case FFESTR_otherFALSE
:
13583 case FFESTR_otherNOT
:
13584 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
13585 return (ffelexHandler
) ffeexpr_token_end_period_
;
13588 if (ffest_ffebad_start (FFEBAD_MISSING_FIRST_BINARY_OPERAND
))
13590 ffebad_here (0, ffelex_token_where_line (t
),
13591 ffelex_token_where_column (t
));
13594 ffelex_token_kill (ffeexpr_tokens_
[0]);
13595 return (ffelexHandler
) ffeexpr_token_swallow_period_
;
13597 break; /* Nothing really reaches here. */
13599 case FFELEX_typeNUMBER
:
13600 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
13601 return (ffelexHandler
) ffeexpr_token_real_
;
13604 if (ffest_ffebad_start (FFEBAD_IGNORING_PERIOD
))
13606 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
13607 ffelex_token_where_column (ffeexpr_tokens_
[0]));
13610 ffelex_token_kill (ffeexpr_tokens_
[0]);
13611 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
13615 /* ffeexpr_token_end_period_ -- Rhs PERIOD NAME(NOT, TRUE, or FALSE)
13617 Return a pointer to this function to the lexer (ffelex), which will
13618 invoke it for the next token.
13620 Expecting a period to close a .NOT, .TRUE, or .FALSE at rhs (unary op
13621 or operator) state. If period isn't found, issue a diagnostic but
13622 pretend we saw one. ffeexpr_current_dotdot_ must already contained the
13623 dotdot representation of the name in between the two PERIOD tokens. */
13625 static ffelexHandler
13626 ffeexpr_token_end_period_ (ffelexToken t
)
13630 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
13632 if (ffest_ffebad_start (FFEBAD_INSERTING_PERIOD
))
13634 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
13635 ffelex_token_where_column (ffeexpr_tokens_
[0]));
13636 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
13637 ffebad_string (ffelex_token_text (ffeexpr_tokens_
[1]));
13642 ffelex_token_kill (ffeexpr_tokens_
[1]); /* Kill "NOT"/"TRUE"/"FALSE"
13645 e
= ffeexpr_expr_new_ ();
13646 e
->token
= ffeexpr_tokens_
[0];
13648 switch (ffeexpr_current_dotdot_
)
13650 case FFESTR_otherNOT
:
13651 e
->type
= FFEEXPR_exprtypeUNARY_
;
13652 e
->u
.operator.op
= FFEEXPR_operatorNOT_
;
13653 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceNOT_
;
13654 e
->u
.operator.as
= FFEEXPR_operatorassociativityNOT_
;
13655 ffeexpr_exprstack_push_unary_ (e
);
13656 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
13657 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
13658 return (ffelexHandler
) ffeexpr_token_rhs_
;
13660 case FFESTR_otherTRUE
:
13661 e
->type
= FFEEXPR_exprtypeOPERAND_
;
13663 = ffebld_new_conter (ffebld_constant_new_logicaldefault (TRUE
));
13664 ffebld_set_info (e
->u
.operand
,
13665 ffeinfo_new (FFEINFO_basictypeLOGICAL
, FFEINFO_kindtypeLOGICALDEFAULT
,
13666 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
, FFETARGET_charactersizeNONE
));
13667 ffeexpr_exprstack_push_operand_ (e
);
13668 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
13669 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
13670 return (ffelexHandler
) ffeexpr_token_binary_
;
13672 case FFESTR_otherFALSE
:
13673 e
->type
= FFEEXPR_exprtypeOPERAND_
;
13675 = ffebld_new_conter (ffebld_constant_new_logicaldefault (FALSE
));
13676 ffebld_set_info (e
->u
.operand
,
13677 ffeinfo_new (FFEINFO_basictypeLOGICAL
, FFEINFO_kindtypeLOGICALDEFAULT
,
13678 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
, FFETARGET_charactersizeNONE
));
13679 ffeexpr_exprstack_push_operand_ (e
);
13680 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
13681 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
13682 return (ffelexHandler
) ffeexpr_token_binary_
;
13685 assert ("Bad unary dotdot in ffeexpr_current_dotdot_" == NULL
);
13691 /* ffeexpr_token_swallow_period_ -- Rhs PERIOD NAME(not NOT, TRUE, or FALSE)
13693 Return a pointer to this function to the lexer (ffelex), which will
13694 invoke it for the next token.
13696 A diagnostic has already been issued; just swallow a period if there is
13697 one, then continue with ffeexpr_token_rhs_. */
13699 static ffelexHandler
13700 ffeexpr_token_swallow_period_ (ffelexToken t
)
13702 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
13703 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
13705 return (ffelexHandler
) ffeexpr_token_rhs_
;
13708 /* ffeexpr_token_real_ -- Rhs PERIOD NUMBER
13710 Return a pointer to this function to the lexer (ffelex), which will
13711 invoke it for the next token.
13713 After a period and a string of digits, check next token for possible
13714 exponent designation (D, E, or Q as first/only character) and continue
13715 real-number handling accordingly. Else form basic real constant, push
13716 onto expression stack, and enter binary state using current token (which,
13717 if it is a name not beginning with D, E, or Q, will certainly result
13718 in an error, but that's not for this routine to deal with). */
13720 static ffelexHandler
13721 ffeexpr_token_real_ (ffelexToken t
)
13726 if (((ffelex_token_type (t
) != FFELEX_typeNAME
)
13727 && (ffelex_token_type (t
) != FFELEX_typeNAMES
))
13728 || !(((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
13730 || ffesrc_char_match_init (d
, 'E', 'e')
13731 || ffesrc_char_match_init (d
, 'Q', 'q')))
13732 && ffeexpr_isdigits_ (++p
)))
13735 /* This code has been removed because it seems inconsistent to
13736 produce a diagnostic in this case, but not all of the other
13737 ones that look for an exponent and cannot recognize one. */
13738 if (((ffelex_token_type (t
) == FFELEX_typeNAME
)
13739 || (ffelex_token_type (t
) == FFELEX_typeNAMES
))
13740 && ffest_ffebad_start (FFEBAD_INVALID_EXPONENT
))
13744 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
13745 ffebad_here (1, ffelex_token_where_line (ffeexpr_tokens_
[0]),
13746 ffelex_token_where_column (ffeexpr_tokens_
[0]));
13749 ffebad_string (bad
);
13753 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'), NULL
,
13754 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
13757 ffelex_token_kill (ffeexpr_tokens_
[0]);
13758 ffelex_token_kill (ffeexpr_tokens_
[1]);
13759 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
13762 /* Just exponent character by itself? In which case, PLUS or MINUS must
13763 surely be next, followed by a NUMBER token. */
13767 ffeexpr_tokens_
[2] = ffelex_token_use (t
);
13768 return (ffelexHandler
) ffeexpr_token_real_exponent_
;
13771 ffeexpr_make_float_const_ (d
, NULL
, ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
13774 ffelex_token_kill (ffeexpr_tokens_
[0]);
13775 ffelex_token_kill (ffeexpr_tokens_
[1]);
13776 return (ffelexHandler
) ffeexpr_token_binary_
;
13779 /* ffeexpr_token_real_exponent_ -- Rhs PERIOD NUMBER NAME(D, E, or Q)
13781 Return a pointer to this function to the lexer (ffelex), which will
13782 invoke it for the next token.
13784 Ensures this token is PLUS or MINUS, preserves it, goes to final state
13785 for real number (exponent digits). Else issues diagnostic, assumes a
13786 zero exponent field for number, passes token on to binary state as if
13787 previous token had been "E0" instead of "E", for example. */
13789 static ffelexHandler
13790 ffeexpr_token_real_exponent_ (ffelexToken t
)
13792 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
13793 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
13795 if (ffest_ffebad_start (FFEBAD_MISSING_EXPONENT_VALUE
))
13797 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[2]),
13798 ffelex_token_where_column (ffeexpr_tokens_
[2]));
13799 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
13803 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'), NULL
,
13804 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
13807 ffelex_token_kill (ffeexpr_tokens_
[0]);
13808 ffelex_token_kill (ffeexpr_tokens_
[1]);
13809 ffelex_token_kill (ffeexpr_tokens_
[2]);
13810 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
13813 ffeexpr_tokens_
[3] = ffelex_token_use (t
);
13814 return (ffelexHandler
) ffeexpr_token_real_exp_sign_
;
13817 /* ffeexpr_token_real_exp_sign_ -- Rhs PERIOD NUMBER NAME(D,E,Q) PLUS/MINUS
13819 Return a pointer to this function to the lexer (ffelex), which will
13820 invoke it for the next token.
13822 Make sure token is a NUMBER, make a real constant out of all we have and
13823 push it onto the expression stack. Else issue diagnostic and pretend
13824 exponent field was a zero. */
13826 static ffelexHandler
13827 ffeexpr_token_real_exp_sign_ (ffelexToken t
)
13829 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
13831 if (ffest_ffebad_start (FFEBAD_MISSING_EXPONENT_VALUE
))
13833 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[2]),
13834 ffelex_token_where_column (ffeexpr_tokens_
[2]));
13835 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
13839 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'), NULL
,
13840 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
13843 ffelex_token_kill (ffeexpr_tokens_
[0]);
13844 ffelex_token_kill (ffeexpr_tokens_
[1]);
13845 ffelex_token_kill (ffeexpr_tokens_
[2]);
13846 ffelex_token_kill (ffeexpr_tokens_
[3]);
13847 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
13850 ffeexpr_make_float_const_ (ffelex_token_text (ffeexpr_tokens_
[2])[0], NULL
,
13851 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1], ffeexpr_tokens_
[2],
13852 ffeexpr_tokens_
[3], t
);
13854 ffelex_token_kill (ffeexpr_tokens_
[0]);
13855 ffelex_token_kill (ffeexpr_tokens_
[1]);
13856 ffelex_token_kill (ffeexpr_tokens_
[2]);
13857 ffelex_token_kill (ffeexpr_tokens_
[3]);
13858 return (ffelexHandler
) ffeexpr_token_binary_
;
13861 /* ffeexpr_token_number_ -- Rhs NUMBER
13863 Return a pointer to this function to the lexer (ffelex), which will
13864 invoke it for the next token.
13866 If the token is a period, we may have a floating-point number, or an
13867 integer followed by a dotdot binary operator. If the token is a name
13868 beginning with D, E, or Q, we definitely have a floating-point number.
13869 If the token is a hollerith constant, that's what we've got, so push
13870 it onto the expression stack and continue with the binary state.
13872 Otherwise, we have an integer followed by something the binary state
13873 should be able to swallow. */
13875 static ffelexHandler
13876 ffeexpr_token_number_ (ffelexToken t
)
13883 if (ffeexpr_hollerith_count_
> 0)
13884 ffelex_set_expecting_hollerith (0, '\0',
13885 ffewhere_line_unknown (),
13886 ffewhere_column_unknown ());
13888 /* See if we've got a floating-point number here. */
13890 switch (ffelex_token_type (t
))
13892 case FFELEX_typeNAME
:
13893 case FFELEX_typeNAMES
:
13894 if ((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
13896 || ffesrc_char_match_init (d
, 'E', 'e')
13897 || ffesrc_char_match_init (d
, 'Q', 'q'))
13898 && ffeexpr_isdigits_ (++p
))
13901 /* Just exponent character by itself? In which case, PLUS or MINUS
13902 must surely be next, followed by a NUMBER token. */
13906 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
13907 return (ffelexHandler
) ffeexpr_token_number_exponent_
;
13909 ffeexpr_make_float_const_ (d
, ffeexpr_tokens_
[0], NULL
, NULL
, t
,
13912 ffelex_token_kill (ffeexpr_tokens_
[0]);
13913 return (ffelexHandler
) ffeexpr_token_binary_
;
13917 case FFELEX_typePERIOD
:
13918 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
13919 return (ffelexHandler
) ffeexpr_token_number_period_
;
13921 case FFELEX_typeHOLLERITH
:
13922 e
= ffeexpr_expr_new_ ();
13923 e
->type
= FFEEXPR_exprtypeOPERAND_
;
13924 e
->token
= ffeexpr_tokens_
[0];
13925 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_hollerith (t
));
13926 ni
= ffeinfo_new (FFEINFO_basictypeHOLLERITH
, FFEINFO_kindtypeNONE
,
13927 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
13928 ffelex_token_length (t
));
13929 ffebld_set_info (e
->u
.operand
, ni
);
13930 ffeexpr_exprstack_push_operand_ (e
);
13931 return (ffelexHandler
) ffeexpr_token_binary_
;
13937 /* Nothing specific we were looking for, so make an integer and pass the
13938 current token to the binary state. */
13940 ffeexpr_make_float_const_ ('I', ffeexpr_tokens_
[0], NULL
, NULL
,
13942 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
13945 /* ffeexpr_token_number_exponent_ -- Rhs NUMBER NAME(D, E, or Q)
13947 Return a pointer to this function to the lexer (ffelex), which will
13948 invoke it for the next token.
13950 Ensures this token is PLUS or MINUS, preserves it, goes to final state
13951 for real number (exponent digits). Else treats number as integer, passes
13952 name to binary, passes current token to subsequent handler. */
13954 static ffelexHandler
13955 ffeexpr_token_number_exponent_ (ffelexToken t
)
13957 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
13958 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
13961 ffelexHandler nexthandler
;
13963 e
= ffeexpr_expr_new_ ();
13964 e
->type
= FFEEXPR_exprtypeOPERAND_
;
13965 e
->token
= ffeexpr_tokens_
[0];
13966 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_integerdefault
13967 (ffeexpr_tokens_
[0]));
13968 ffebld_set_info (e
->u
.operand
,
13969 ffeinfo_new (FFEINFO_basictypeINTEGER
, FFEINFO_kindtypeINTEGERDEFAULT
,
13970 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
, FFETARGET_charactersizeNONE
));
13971 ffeexpr_exprstack_push_operand_ (e
);
13972 nexthandler
= (ffelexHandler
) ffeexpr_token_binary_ (ffeexpr_tokens_
[1]);
13973 ffelex_token_kill (ffeexpr_tokens_
[1]);
13974 return (ffelexHandler
) (*nexthandler
) (t
);
13977 ffeexpr_tokens_
[2] = ffelex_token_use (t
);
13978 return (ffelexHandler
) ffeexpr_token_number_exp_sign_
;
13981 /* ffeexpr_token_number_exp_sign_ -- Rhs NUMBER NAME(D,E,Q) PLUS/MINUS
13983 Return a pointer to this function to the lexer (ffelex), which will
13984 invoke it for the next token.
13986 Make sure token is a NUMBER, make a real constant out of all we have and
13987 push it onto the expression stack. Else issue diagnostic and pretend
13988 exponent field was a zero. */
13990 static ffelexHandler
13991 ffeexpr_token_number_exp_sign_ (ffelexToken t
)
13993 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
13995 if (ffest_ffebad_start (FFEBAD_MISSING_EXPONENT_VALUE
))
13997 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[1]),
13998 ffelex_token_where_column (ffeexpr_tokens_
[1]));
13999 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14003 ffeexpr_make_float_const_ (ffelex_token_text (ffeexpr_tokens_
[1])[0],
14004 ffeexpr_tokens_
[0], NULL
, NULL
,
14005 ffeexpr_tokens_
[1], ffeexpr_tokens_
[2],
14008 ffelex_token_kill (ffeexpr_tokens_
[0]);
14009 ffelex_token_kill (ffeexpr_tokens_
[1]);
14010 ffelex_token_kill (ffeexpr_tokens_
[2]);
14011 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14014 ffeexpr_make_float_const_ (ffelex_token_text (ffeexpr_tokens_
[1])[0],
14015 ffeexpr_tokens_
[0], NULL
, NULL
,
14016 ffeexpr_tokens_
[1], ffeexpr_tokens_
[2], t
);
14018 ffelex_token_kill (ffeexpr_tokens_
[0]);
14019 ffelex_token_kill (ffeexpr_tokens_
[1]);
14020 ffelex_token_kill (ffeexpr_tokens_
[2]);
14021 return (ffelexHandler
) ffeexpr_token_binary_
;
14024 /* ffeexpr_token_number_period_ -- Rhs NUMBER PERIOD
14026 Return a pointer to this function to the lexer (ffelex), which will
14027 invoke it for the next token.
14029 Handle a period detected following a number at rhs state. Must begin a
14030 floating-point value (as in 1., 1.2, 1.E3, or 1.E+3) or a dot-dot name. */
14032 static ffelexHandler
14033 ffeexpr_token_number_period_ (ffelexToken t
)
14036 ffelexHandler nexthandler
;
14040 switch (ffelex_token_type (t
))
14042 case FFELEX_typeNAME
:
14043 case FFELEX_typeNAMES
:
14044 if ((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
14046 || ffesrc_char_match_init (d
, 'E', 'e')
14047 || ffesrc_char_match_init (d
, 'Q', 'q'))
14048 && ffeexpr_isdigits_ (++p
))
14051 /* Just exponent character by itself? In which case, PLUS or MINUS
14052 must surely be next, followed by a NUMBER token. */
14056 ffeexpr_tokens_
[2] = ffelex_token_use (t
);
14057 return (ffelexHandler
) ffeexpr_token_number_per_exp_
;
14059 ffeexpr_make_float_const_ (d
, ffeexpr_tokens_
[0],
14060 ffeexpr_tokens_
[1], NULL
, t
, NULL
,
14063 ffelex_token_kill (ffeexpr_tokens_
[0]);
14064 ffelex_token_kill (ffeexpr_tokens_
[1]);
14065 return (ffelexHandler
) ffeexpr_token_binary_
;
14067 /* A name not representing an exponent, so assume it will be something
14068 like EQ, make an integer from the number, pass the period to binary
14069 state and the current token to the resulting state. */
14071 e
= ffeexpr_expr_new_ ();
14072 e
->type
= FFEEXPR_exprtypeOPERAND_
;
14073 e
->token
= ffeexpr_tokens_
[0];
14074 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_integerdefault
14075 (ffeexpr_tokens_
[0]));
14076 ffebld_set_info (e
->u
.operand
,
14077 ffeinfo_new (FFEINFO_basictypeINTEGER
,
14078 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
14079 FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
14080 FFETARGET_charactersizeNONE
));
14081 ffeexpr_exprstack_push_operand_ (e
);
14082 nexthandler
= (ffelexHandler
) ffeexpr_token_binary_
14083 (ffeexpr_tokens_
[1]);
14084 ffelex_token_kill (ffeexpr_tokens_
[1]);
14085 return (ffelexHandler
) (*nexthandler
) (t
);
14087 case FFELEX_typeNUMBER
:
14088 ffeexpr_tokens_
[2] = ffelex_token_use (t
);
14089 return (ffelexHandler
) ffeexpr_token_number_real_
;
14095 /* Nothing specific we were looking for, so make a real number and pass the
14096 period and then the current token to the binary state. */
14098 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'),
14099 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14100 NULL
, NULL
, NULL
, NULL
);
14102 ffelex_token_kill (ffeexpr_tokens_
[0]);
14103 ffelex_token_kill (ffeexpr_tokens_
[1]);
14104 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14107 /* ffeexpr_token_number_per_exp_ -- Rhs NUMBER PERIOD NAME(D, E, or Q)
14109 Return a pointer to this function to the lexer (ffelex), which will
14110 invoke it for the next token.
14112 Ensures this token is PLUS or MINUS, preserves it, goes to final state
14113 for real number (exponent digits). Else treats number as real, passes
14114 name to binary, passes current token to subsequent handler. */
14116 static ffelexHandler
14117 ffeexpr_token_number_per_exp_ (ffelexToken t
)
14119 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
14120 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
14122 ffelexHandler nexthandler
;
14124 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'),
14125 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14126 NULL
, NULL
, NULL
, NULL
);
14128 ffelex_token_kill (ffeexpr_tokens_
[0]);
14129 ffelex_token_kill (ffeexpr_tokens_
[1]);
14130 nexthandler
= (ffelexHandler
) ffeexpr_token_binary_ (ffeexpr_tokens_
[2]);
14131 ffelex_token_kill (ffeexpr_tokens_
[2]);
14132 return (ffelexHandler
) (*nexthandler
) (t
);
14135 ffeexpr_tokens_
[3] = ffelex_token_use (t
);
14136 return (ffelexHandler
) ffeexpr_token_num_per_exp_sign_
;
14139 /* ffeexpr_token_number_real_ -- Rhs NUMBER PERIOD NUMBER
14141 Return a pointer to this function to the lexer (ffelex), which will
14142 invoke it for the next token.
14144 After a number, period, and number, check next token for possible
14145 exponent designation (D, E, or Q as first/only character) and continue
14146 real-number handling accordingly. Else form basic real constant, push
14147 onto expression stack, and enter binary state using current token (which,
14148 if it is a name not beginning with D, E, or Q, will certainly result
14149 in an error, but that's not for this routine to deal with). */
14151 static ffelexHandler
14152 ffeexpr_token_number_real_ (ffelexToken t
)
14157 if (((ffelex_token_type (t
) != FFELEX_typeNAME
)
14158 && (ffelex_token_type (t
) != FFELEX_typeNAMES
))
14159 || !(((ffesrc_char_match_init ((d
= *(p
= ffelex_token_text (t
))),
14161 || ffesrc_char_match_init (d
, 'E', 'e')
14162 || ffesrc_char_match_init (d
, 'Q', 'q')))
14163 && ffeexpr_isdigits_ (++p
)))
14166 /* This code has been removed because it seems inconsistent to
14167 produce a diagnostic in this case, but not all of the other
14168 ones that look for an exponent and cannot recognize one. */
14169 if (((ffelex_token_type (t
) == FFELEX_typeNAME
)
14170 || (ffelex_token_type (t
) == FFELEX_typeNAMES
))
14171 && ffest_ffebad_start (FFEBAD_INVALID_EXPONENT
))
14175 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14176 ffebad_here (1, ffelex_token_where_line (ffeexpr_tokens_
[0]),
14177 ffelex_token_where_column (ffeexpr_tokens_
[0]));
14180 ffebad_string (bad
);
14184 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'),
14185 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14186 ffeexpr_tokens_
[2], NULL
, NULL
, NULL
);
14188 ffelex_token_kill (ffeexpr_tokens_
[0]);
14189 ffelex_token_kill (ffeexpr_tokens_
[1]);
14190 ffelex_token_kill (ffeexpr_tokens_
[2]);
14191 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14194 /* Just exponent character by itself? In which case, PLUS or MINUS must
14195 surely be next, followed by a NUMBER token. */
14199 ffeexpr_tokens_
[3] = ffelex_token_use (t
);
14200 return (ffelexHandler
) ffeexpr_token_number_real_exp_
;
14203 ffeexpr_make_float_const_ (d
, ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14204 ffeexpr_tokens_
[2], t
, NULL
, NULL
);
14206 ffelex_token_kill (ffeexpr_tokens_
[0]);
14207 ffelex_token_kill (ffeexpr_tokens_
[1]);
14208 ffelex_token_kill (ffeexpr_tokens_
[2]);
14209 return (ffelexHandler
) ffeexpr_token_binary_
;
14212 /* ffeexpr_token_num_per_exp_sign_ -- Rhs NUMBER PERIOD NAME(D,E,Q) PLUS/MINUS
14214 Return a pointer to this function to the lexer (ffelex), which will
14215 invoke it for the next token.
14217 Make sure token is a NUMBER, make a real constant out of all we have and
14218 push it onto the expression stack. Else issue diagnostic and pretend
14219 exponent field was a zero. */
14221 static ffelexHandler
14222 ffeexpr_token_num_per_exp_sign_ (ffelexToken t
)
14224 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
14226 if (ffest_ffebad_start (FFEBAD_MISSING_EXPONENT_VALUE
))
14228 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[2]),
14229 ffelex_token_where_column (ffeexpr_tokens_
[2]));
14230 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14234 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'),
14235 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14236 NULL
, NULL
, NULL
, NULL
);
14238 ffelex_token_kill (ffeexpr_tokens_
[0]);
14239 ffelex_token_kill (ffeexpr_tokens_
[1]);
14240 ffelex_token_kill (ffeexpr_tokens_
[2]);
14241 ffelex_token_kill (ffeexpr_tokens_
[3]);
14242 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14245 ffeexpr_make_float_const_ (ffelex_token_text (ffeexpr_tokens_
[2])[0],
14246 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1], NULL
,
14247 ffeexpr_tokens_
[2], ffeexpr_tokens_
[3], t
);
14249 ffelex_token_kill (ffeexpr_tokens_
[0]);
14250 ffelex_token_kill (ffeexpr_tokens_
[1]);
14251 ffelex_token_kill (ffeexpr_tokens_
[2]);
14252 ffelex_token_kill (ffeexpr_tokens_
[3]);
14253 return (ffelexHandler
) ffeexpr_token_binary_
;
14256 /* ffeexpr_token_number_real_exp_ -- Rhs NUMBER PERIOD NUMBER NAME(D, E, or Q)
14258 Return a pointer to this function to the lexer (ffelex), which will
14259 invoke it for the next token.
14261 Ensures this token is PLUS or MINUS, preserves it, goes to final state
14262 for real number (exponent digits). Else issues diagnostic, assumes a
14263 zero exponent field for number, passes token on to binary state as if
14264 previous token had been "E0" instead of "E", for example. */
14266 static ffelexHandler
14267 ffeexpr_token_number_real_exp_ (ffelexToken t
)
14269 if ((ffelex_token_type (t
) != FFELEX_typePLUS
)
14270 && (ffelex_token_type (t
) != FFELEX_typeMINUS
))
14272 if (ffest_ffebad_start (FFEBAD_MISSING_EXPONENT_VALUE
))
14274 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[3]),
14275 ffelex_token_where_column (ffeexpr_tokens_
[3]));
14276 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14280 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'),
14281 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14282 ffeexpr_tokens_
[2], NULL
, NULL
, NULL
);
14284 ffelex_token_kill (ffeexpr_tokens_
[0]);
14285 ffelex_token_kill (ffeexpr_tokens_
[1]);
14286 ffelex_token_kill (ffeexpr_tokens_
[2]);
14287 ffelex_token_kill (ffeexpr_tokens_
[3]);
14288 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14291 ffeexpr_tokens_
[4] = ffelex_token_use (t
);
14292 return (ffelexHandler
) ffeexpr_token_num_real_exp_sn_
;
14295 /* ffeexpr_token_num_real_exp_sn_ -- Rhs NUMBER PERIOD NUMBER NAME(D,E,Q)
14298 Return a pointer to this function to the lexer (ffelex), which will
14299 invoke it for the next token.
14301 Make sure token is a NUMBER, make a real constant out of all we have and
14302 push it onto the expression stack. Else issue diagnostic and pretend
14303 exponent field was a zero. */
14305 static ffelexHandler
14306 ffeexpr_token_num_real_exp_sn_ (ffelexToken t
)
14308 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
14310 if (ffest_ffebad_start (FFEBAD_MISSING_EXPONENT_VALUE
))
14312 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[3]),
14313 ffelex_token_where_column (ffeexpr_tokens_
[3]));
14314 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14318 ffeexpr_make_float_const_ (ffesrc_char_internal_init ('E', 'e'),
14319 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14320 ffeexpr_tokens_
[2], NULL
, NULL
, NULL
);
14322 ffelex_token_kill (ffeexpr_tokens_
[0]);
14323 ffelex_token_kill (ffeexpr_tokens_
[1]);
14324 ffelex_token_kill (ffeexpr_tokens_
[2]);
14325 ffelex_token_kill (ffeexpr_tokens_
[3]);
14326 ffelex_token_kill (ffeexpr_tokens_
[4]);
14327 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14330 ffeexpr_make_float_const_ (ffelex_token_text (ffeexpr_tokens_
[3])[0],
14331 ffeexpr_tokens_
[0], ffeexpr_tokens_
[1],
14332 ffeexpr_tokens_
[2], ffeexpr_tokens_
[3],
14333 ffeexpr_tokens_
[4], t
);
14335 ffelex_token_kill (ffeexpr_tokens_
[0]);
14336 ffelex_token_kill (ffeexpr_tokens_
[1]);
14337 ffelex_token_kill (ffeexpr_tokens_
[2]);
14338 ffelex_token_kill (ffeexpr_tokens_
[3]);
14339 ffelex_token_kill (ffeexpr_tokens_
[4]);
14340 return (ffelexHandler
) ffeexpr_token_binary_
;
14343 /* ffeexpr_token_binary_ -- Handle binary operator possibility
14345 Return a pointer to this function to the lexer (ffelex), which will
14346 invoke it for the next token.
14348 The possibility of a binary operator is handled here, meaning the previous
14349 token was an operand. */
14351 static ffelexHandler
14352 ffeexpr_token_binary_ (ffelexToken t
)
14356 if (!ffeexpr_stack_
->is_rhs
)
14357 return (ffelexHandler
) ffeexpr_finished_ (t
); /* For now. */
14359 switch (ffelex_token_type (t
))
14361 case FFELEX_typePLUS
:
14362 e
= ffeexpr_expr_new_ ();
14363 e
->type
= FFEEXPR_exprtypeBINARY_
;
14364 e
->token
= ffelex_token_use (t
);
14365 e
->u
.operator.op
= FFEEXPR_operatorADD_
;
14366 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceADD_
;
14367 e
->u
.operator.as
= FFEEXPR_operatorassociativityADD_
;
14368 ffeexpr_exprstack_push_binary_ (e
);
14369 return (ffelexHandler
) ffeexpr_token_rhs_
;
14371 case FFELEX_typeMINUS
:
14372 e
= ffeexpr_expr_new_ ();
14373 e
->type
= FFEEXPR_exprtypeBINARY_
;
14374 e
->token
= ffelex_token_use (t
);
14375 e
->u
.operator.op
= FFEEXPR_operatorSUBTRACT_
;
14376 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceSUBTRACT_
;
14377 e
->u
.operator.as
= FFEEXPR_operatorassociativitySUBTRACT_
;
14378 ffeexpr_exprstack_push_binary_ (e
);
14379 return (ffelexHandler
) ffeexpr_token_rhs_
;
14381 case FFELEX_typeASTERISK
:
14382 switch (ffeexpr_stack_
->context
)
14384 case FFEEXPR_contextDATA
:
14385 return (ffelexHandler
) ffeexpr_finished_ (t
);
14390 e
= ffeexpr_expr_new_ ();
14391 e
->type
= FFEEXPR_exprtypeBINARY_
;
14392 e
->token
= ffelex_token_use (t
);
14393 e
->u
.operator.op
= FFEEXPR_operatorMULTIPLY_
;
14394 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceMULTIPLY_
;
14395 e
->u
.operator.as
= FFEEXPR_operatorassociativityMULTIPLY_
;
14396 ffeexpr_exprstack_push_binary_ (e
);
14397 return (ffelexHandler
) ffeexpr_token_rhs_
;
14399 case FFELEX_typeSLASH
:
14400 switch (ffeexpr_stack_
->context
)
14402 case FFEEXPR_contextDATA
:
14403 return (ffelexHandler
) ffeexpr_finished_ (t
);
14408 e
= ffeexpr_expr_new_ ();
14409 e
->type
= FFEEXPR_exprtypeBINARY_
;
14410 e
->token
= ffelex_token_use (t
);
14411 e
->u
.operator.op
= FFEEXPR_operatorDIVIDE_
;
14412 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceDIVIDE_
;
14413 e
->u
.operator.as
= FFEEXPR_operatorassociativityDIVIDE_
;
14414 ffeexpr_exprstack_push_binary_ (e
);
14415 return (ffelexHandler
) ffeexpr_token_rhs_
;
14417 case FFELEX_typePOWER
:
14418 e
= ffeexpr_expr_new_ ();
14419 e
->type
= FFEEXPR_exprtypeBINARY_
;
14420 e
->token
= ffelex_token_use (t
);
14421 e
->u
.operator.op
= FFEEXPR_operatorPOWER_
;
14422 e
->u
.operator.prec
= FFEEXPR_operatorprecedencePOWER_
;
14423 e
->u
.operator.as
= FFEEXPR_operatorassociativityPOWER_
;
14424 ffeexpr_exprstack_push_binary_ (e
);
14425 return (ffelexHandler
) ffeexpr_token_rhs_
;
14427 case FFELEX_typeCONCAT
:
14428 e
= ffeexpr_expr_new_ ();
14429 e
->type
= FFEEXPR_exprtypeBINARY_
;
14430 e
->token
= ffelex_token_use (t
);
14431 e
->u
.operator.op
= FFEEXPR_operatorCONCATENATE_
;
14432 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceCONCATENATE_
;
14433 e
->u
.operator.as
= FFEEXPR_operatorassociativityCONCATENATE_
;
14434 ffeexpr_exprstack_push_binary_ (e
);
14435 return (ffelexHandler
) ffeexpr_token_rhs_
;
14437 case FFELEX_typeOPEN_ANGLE
:
14438 switch (ffeexpr_stack_
->context
)
14440 case FFEEXPR_contextFORMAT
:
14441 ffebad_start (FFEBAD_FORMAT_EXPR_TOKEN
);
14442 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14449 e
= ffeexpr_expr_new_ ();
14450 e
->type
= FFEEXPR_exprtypeBINARY_
;
14451 e
->token
= ffelex_token_use (t
);
14452 e
->u
.operator.op
= FFEEXPR_operatorLT_
;
14453 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceLT_
;
14454 e
->u
.operator.as
= FFEEXPR_operatorassociativityLT_
;
14455 ffeexpr_exprstack_push_binary_ (e
);
14456 return (ffelexHandler
) ffeexpr_token_rhs_
;
14458 case FFELEX_typeCLOSE_ANGLE
:
14459 switch (ffeexpr_stack_
->context
)
14461 case FFEEXPR_contextFORMAT
:
14462 return ffeexpr_finished_ (t
);
14467 e
= ffeexpr_expr_new_ ();
14468 e
->type
= FFEEXPR_exprtypeBINARY_
;
14469 e
->token
= ffelex_token_use (t
);
14470 e
->u
.operator.op
= FFEEXPR_operatorGT_
;
14471 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceGT_
;
14472 e
->u
.operator.as
= FFEEXPR_operatorassociativityGT_
;
14473 ffeexpr_exprstack_push_binary_ (e
);
14474 return (ffelexHandler
) ffeexpr_token_rhs_
;
14476 case FFELEX_typeREL_EQ
:
14477 switch (ffeexpr_stack_
->context
)
14479 case FFEEXPR_contextFORMAT
:
14480 ffebad_start (FFEBAD_FORMAT_EXPR_TOKEN
);
14481 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14488 e
= ffeexpr_expr_new_ ();
14489 e
->type
= FFEEXPR_exprtypeBINARY_
;
14490 e
->token
= ffelex_token_use (t
);
14491 e
->u
.operator.op
= FFEEXPR_operatorEQ_
;
14492 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceEQ_
;
14493 e
->u
.operator.as
= FFEEXPR_operatorassociativityEQ_
;
14494 ffeexpr_exprstack_push_binary_ (e
);
14495 return (ffelexHandler
) ffeexpr_token_rhs_
;
14497 case FFELEX_typeREL_NE
:
14498 switch (ffeexpr_stack_
->context
)
14500 case FFEEXPR_contextFORMAT
:
14501 ffebad_start (FFEBAD_FORMAT_EXPR_TOKEN
);
14502 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14509 e
= ffeexpr_expr_new_ ();
14510 e
->type
= FFEEXPR_exprtypeBINARY_
;
14511 e
->token
= ffelex_token_use (t
);
14512 e
->u
.operator.op
= FFEEXPR_operatorNE_
;
14513 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceNE_
;
14514 e
->u
.operator.as
= FFEEXPR_operatorassociativityNE_
;
14515 ffeexpr_exprstack_push_binary_ (e
);
14516 return (ffelexHandler
) ffeexpr_token_rhs_
;
14518 case FFELEX_typeREL_LE
:
14519 switch (ffeexpr_stack_
->context
)
14521 case FFEEXPR_contextFORMAT
:
14522 ffebad_start (FFEBAD_FORMAT_EXPR_TOKEN
);
14523 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14530 e
= ffeexpr_expr_new_ ();
14531 e
->type
= FFEEXPR_exprtypeBINARY_
;
14532 e
->token
= ffelex_token_use (t
);
14533 e
->u
.operator.op
= FFEEXPR_operatorLE_
;
14534 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceLE_
;
14535 e
->u
.operator.as
= FFEEXPR_operatorassociativityLE_
;
14536 ffeexpr_exprstack_push_binary_ (e
);
14537 return (ffelexHandler
) ffeexpr_token_rhs_
;
14539 case FFELEX_typeREL_GE
:
14540 switch (ffeexpr_stack_
->context
)
14542 case FFEEXPR_contextFORMAT
:
14543 ffebad_start (FFEBAD_FORMAT_EXPR_TOKEN
);
14544 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14551 e
= ffeexpr_expr_new_ ();
14552 e
->type
= FFEEXPR_exprtypeBINARY_
;
14553 e
->token
= ffelex_token_use (t
);
14554 e
->u
.operator.op
= FFEEXPR_operatorGE_
;
14555 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceGE_
;
14556 e
->u
.operator.as
= FFEEXPR_operatorassociativityGE_
;
14557 ffeexpr_exprstack_push_binary_ (e
);
14558 return (ffelexHandler
) ffeexpr_token_rhs_
;
14560 case FFELEX_typePERIOD
:
14561 ffeexpr_tokens_
[0] = ffelex_token_use (t
);
14562 return (ffelexHandler
) ffeexpr_token_binary_period_
;
14565 case FFELEX_typeOPEN_PAREN
:
14566 case FFELEX_typeCLOSE_PAREN
:
14567 case FFELEX_typeEQUALS
:
14568 case FFELEX_typePOINTS
:
14569 case FFELEX_typeCOMMA
:
14570 case FFELEX_typeCOLON
:
14571 case FFELEX_typeEOS
:
14572 case FFELEX_typeSEMICOLON
:
14573 case FFELEX_typeNAME
:
14574 case FFELEX_typeNAMES
:
14577 return (ffelexHandler
) ffeexpr_finished_ (t
);
14581 /* ffeexpr_token_binary_period_ -- Binary PERIOD
14583 Return a pointer to this function to the lexer (ffelex), which will
14584 invoke it for the next token.
14586 Handle a period detected at binary (expecting binary op or end) state.
14587 Must begin a dot-dot name, of which .NOT., .TRUE., and .FALSE. are not
14590 static ffelexHandler
14591 ffeexpr_token_binary_period_ (ffelexToken t
)
14593 ffeexprExpr_ operand
;
14595 switch (ffelex_token_type (t
))
14597 case FFELEX_typeNAME
:
14598 case FFELEX_typeNAMES
:
14599 ffeexpr_current_dotdot_
= ffestr_other (t
);
14600 switch (ffeexpr_current_dotdot_
)
14602 case FFESTR_otherTRUE
:
14603 case FFESTR_otherFALSE
:
14604 case FFESTR_otherNOT
:
14605 if (ffest_ffebad_start (FFEBAD_MISSING_BINARY_OPERATOR
))
14607 operand
= ffeexpr_stack_
->exprstack
;
14608 assert (operand
!= NULL
);
14609 assert (operand
->type
== FFEEXPR_exprtypeOPERAND_
);
14610 ffebad_here (0, ffelex_token_where_line (operand
->token
), ffelex_token_where_column (operand
->token
));
14611 ffebad_here (1, ffelex_token_where_line (t
),
14612 ffelex_token_where_column (t
));
14615 ffelex_token_kill (ffeexpr_tokens_
[0]);
14616 return (ffelexHandler
) ffeexpr_token_binary_sw_per_
;
14619 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
14620 return (ffelexHandler
) ffeexpr_token_binary_end_per_
;
14622 break; /* Nothing really reaches here. */
14625 if (ffest_ffebad_start (FFEBAD_IGNORING_PERIOD
))
14627 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
14628 ffelex_token_where_column (ffeexpr_tokens_
[0]));
14631 ffelex_token_kill (ffeexpr_tokens_
[0]);
14632 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14636 /* ffeexpr_token_binary_end_per_ -- Binary PERIOD NAME(not NOT, TRUE, or FALSE)
14638 Return a pointer to this function to the lexer (ffelex), which will
14639 invoke it for the next token.
14641 Expecting a period to close a dot-dot at binary (binary op
14642 or operator) state. If period isn't found, issue a diagnostic but
14643 pretend we saw one. ffeexpr_current_dotdot_ must already contained the
14644 dotdot representation of the name in between the two PERIOD tokens. */
14646 static ffelexHandler
14647 ffeexpr_token_binary_end_per_ (ffelexToken t
)
14651 e
= ffeexpr_expr_new_ ();
14652 e
->type
= FFEEXPR_exprtypeBINARY_
;
14653 e
->token
= ffeexpr_tokens_
[0];
14655 switch (ffeexpr_current_dotdot_
)
14657 case FFESTR_otherAND
:
14658 e
->u
.operator.op
= FFEEXPR_operatorAND_
;
14659 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceAND_
;
14660 e
->u
.operator.as
= FFEEXPR_operatorassociativityAND_
;
14663 case FFESTR_otherOR
:
14664 e
->u
.operator.op
= FFEEXPR_operatorOR_
;
14665 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceOR_
;
14666 e
->u
.operator.as
= FFEEXPR_operatorassociativityOR_
;
14669 case FFESTR_otherXOR
:
14670 e
->u
.operator.op
= FFEEXPR_operatorXOR_
;
14671 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceXOR_
;
14672 e
->u
.operator.as
= FFEEXPR_operatorassociativityXOR_
;
14675 case FFESTR_otherEQV
:
14676 e
->u
.operator.op
= FFEEXPR_operatorEQV_
;
14677 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceEQV_
;
14678 e
->u
.operator.as
= FFEEXPR_operatorassociativityEQV_
;
14681 case FFESTR_otherNEQV
:
14682 e
->u
.operator.op
= FFEEXPR_operatorNEQV_
;
14683 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceNEQV_
;
14684 e
->u
.operator.as
= FFEEXPR_operatorassociativityNEQV_
;
14687 case FFESTR_otherLT
:
14688 e
->u
.operator.op
= FFEEXPR_operatorLT_
;
14689 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceLT_
;
14690 e
->u
.operator.as
= FFEEXPR_operatorassociativityLT_
;
14693 case FFESTR_otherLE
:
14694 e
->u
.operator.op
= FFEEXPR_operatorLE_
;
14695 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceLE_
;
14696 e
->u
.operator.as
= FFEEXPR_operatorassociativityLE_
;
14699 case FFESTR_otherEQ
:
14700 e
->u
.operator.op
= FFEEXPR_operatorEQ_
;
14701 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceEQ_
;
14702 e
->u
.operator.as
= FFEEXPR_operatorassociativityEQ_
;
14705 case FFESTR_otherNE
:
14706 e
->u
.operator.op
= FFEEXPR_operatorNE_
;
14707 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceNE_
;
14708 e
->u
.operator.as
= FFEEXPR_operatorassociativityNE_
;
14711 case FFESTR_otherGT
:
14712 e
->u
.operator.op
= FFEEXPR_operatorGT_
;
14713 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceGT_
;
14714 e
->u
.operator.as
= FFEEXPR_operatorassociativityGT_
;
14717 case FFESTR_otherGE
:
14718 e
->u
.operator.op
= FFEEXPR_operatorGE_
;
14719 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceGE_
;
14720 e
->u
.operator.as
= FFEEXPR_operatorassociativityGE_
;
14724 if (ffest_ffebad_start (FFEBAD_INVALID_DOTDOT
))
14726 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
14727 ffelex_token_where_column (ffeexpr_tokens_
[0]));
14728 ffebad_string (ffelex_token_text (ffeexpr_tokens_
[1]));
14731 e
->u
.operator.op
= FFEEXPR_operatorEQ_
;
14732 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceEQ_
;
14733 e
->u
.operator.as
= FFEEXPR_operatorassociativityEQ_
;
14737 ffeexpr_exprstack_push_binary_ (e
);
14739 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
14741 if (ffest_ffebad_start (FFEBAD_INSERTING_PERIOD
))
14743 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
14744 ffelex_token_where_column (ffeexpr_tokens_
[0]));
14745 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14746 ffebad_string (ffelex_token_text (ffeexpr_tokens_
[1]));
14749 ffelex_token_kill (ffeexpr_tokens_
[1]); /* Kill dot-dot token. */
14750 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
14753 ffelex_token_kill (ffeexpr_tokens_
[1]); /* Kill dot-dot token. */
14754 return (ffelexHandler
) ffeexpr_token_rhs_
;
14757 /* ffeexpr_token_binary_sw_per_ -- Rhs PERIOD NAME(NOT, TRUE, or FALSE)
14759 Return a pointer to this function to the lexer (ffelex), which will
14760 invoke it for the next token.
14762 A diagnostic has already been issued; just swallow a period if there is
14763 one, then continue with ffeexpr_token_binary_. */
14765 static ffelexHandler
14766 ffeexpr_token_binary_sw_per_ (ffelexToken t
)
14768 if (ffelex_token_type (t
) != FFELEX_typePERIOD
)
14769 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
14771 return (ffelexHandler
) ffeexpr_token_binary_
;
14774 /* ffeexpr_token_quote_ -- Rhs QUOTE
14776 Return a pointer to this function to the lexer (ffelex), which will
14777 invoke it for the next token.
14779 Expecting a NUMBER that we'll treat as an octal integer. */
14781 static ffelexHandler
14782 ffeexpr_token_quote_ (ffelexToken t
)
14787 if (ffelex_token_type (t
) != FFELEX_typeNUMBER
)
14789 if (ffest_ffebad_start (FFEBAD_QUOTE_MISSES_DIGITS
))
14791 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
14792 ffelex_token_where_column (ffeexpr_tokens_
[0]));
14793 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14796 ffelex_token_kill (ffeexpr_tokens_
[0]);
14797 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
14800 /* This is kind of a kludge to prevent any whining about magical numbers
14801 that start out as these octal integers, so "20000000000 (on a 32-bit
14802 2's-complement machine) by itself won't produce an error. */
14804 anyexpr
= ffebld_new_any ();
14805 ffebld_set_info (anyexpr
, ffeinfo_new_any ());
14807 e
= ffeexpr_expr_new_ ();
14808 e
->type
= FFEEXPR_exprtypeOPERAND_
;
14809 e
->token
= ffeexpr_tokens_
[0];
14810 e
->u
.operand
= ffebld_new_conter_with_orig
14811 (ffebld_constant_new_integeroctal (t
), anyexpr
);
14812 ffebld_set_info (e
->u
.operand
, ffeinfo_new (FFEINFO_basictypeINTEGER
,
14813 FFEINFO_kindtypeINTEGERDEFAULT
, 0, FFEINFO_kindENTITY
,
14814 FFEINFO_whereCONSTANT
, FFETARGET_charactersizeNONE
));
14815 ffeexpr_exprstack_push_operand_ (e
);
14816 return (ffelexHandler
) ffeexpr_token_binary_
;
14819 /* ffeexpr_token_apostrophe_ -- Rhs APOSTROPHE
14821 Return a pointer to this function to the lexer (ffelex), which will
14822 invoke it for the next token.
14824 Handle an open-apostrophe, which begins either a character ('char-const'),
14825 typeless octal ('octal-const'O), or typeless hexadecimal ('hex-const'Z or
14826 'hex-const'X) constant. */
14828 static ffelexHandler
14829 ffeexpr_token_apostrophe_ (ffelexToken t
)
14831 assert (ffelex_token_type (t
) == FFELEX_typeCHARACTER
);
14832 if (ffe_is_pedantic_not_90 () && (ffelex_token_length (t
) == 0))
14834 ffebad_start (FFEBAD_NULL_CHAR_CONST
);
14835 ffebad_here (0, ffelex_token_where_line (t
),
14836 ffelex_token_where_column (t
));
14839 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
14840 return (ffelexHandler
) ffeexpr_token_apos_char_
;
14843 /* ffeexpr_token_apos_char_ -- Rhs APOSTROPHE CHARACTER
14845 Return a pointer to this function to the lexer (ffelex), which will
14846 invoke it for the next token.
14848 Close-apostrophe is implicit; if this token is NAME, it is a possible
14849 typeless-constant radix specifier. */
14851 static ffelexHandler
14852 ffeexpr_token_apos_char_ (ffelexToken t
)
14857 ffetargetCharacterSize size
;
14859 if ((ffelex_token_type (t
) == FFELEX_typeNAME
)
14860 || (ffelex_token_type (t
) == FFELEX_typeNAMES
))
14862 if ((ffelex_token_length (t
) == 1)
14863 && (ffesrc_char_match_init ((c
= ffelex_token_text (t
)[0]), 'B',
14865 || ffesrc_char_match_init (c
, 'O', 'o')
14866 || ffesrc_char_match_init (c
, 'X', 'x')
14867 || ffesrc_char_match_init (c
, 'Z', 'z')))
14869 e
= ffeexpr_expr_new_ ();
14870 e
->type
= FFEEXPR_exprtypeOPERAND_
;
14871 e
->token
= ffeexpr_tokens_
[0];
14874 case FFESRC_CASE_MATCH_INIT ('B', 'b', match_b
, no_match
):
14875 e
->u
.operand
= ffebld_new_conter
14876 (ffebld_constant_new_typeless_bv (ffeexpr_tokens_
[1]));
14877 size
= ffetarget_size_typeless_binary (ffeexpr_tokens_
[1]);
14880 case FFESRC_CASE_MATCH_INIT ('O', 'o', match_o
, no_match
):
14881 e
->u
.operand
= ffebld_new_conter
14882 (ffebld_constant_new_typeless_ov (ffeexpr_tokens_
[1]));
14883 size
= ffetarget_size_typeless_octal (ffeexpr_tokens_
[1]);
14886 case FFESRC_CASE_MATCH_INIT ('X', 'x', match_x
, no_match
):
14887 e
->u
.operand
= ffebld_new_conter
14888 (ffebld_constant_new_typeless_hxv (ffeexpr_tokens_
[1]));
14889 size
= ffetarget_size_typeless_hex (ffeexpr_tokens_
[1]);
14892 case FFESRC_CASE_MATCH_INIT ('Z', 'z', match_z
, no_match
):
14893 e
->u
.operand
= ffebld_new_conter
14894 (ffebld_constant_new_typeless_hzv (ffeexpr_tokens_
[1]));
14895 size
= ffetarget_size_typeless_hex (ffeexpr_tokens_
[1]);
14899 no_match
: /* :::::::::::::::::::: */
14900 assert ("not BOXZ!" == NULL
);
14904 ffebld_set_info (e
->u
.operand
,
14905 ffeinfo_new (FFEINFO_basictypeTYPELESS
, FFEINFO_kindtypeNONE
,
14906 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
, size
));
14907 ffeexpr_exprstack_push_operand_ (e
);
14908 ffelex_token_kill (ffeexpr_tokens_
[1]);
14909 return (ffelexHandler
) ffeexpr_token_binary_
;
14912 e
= ffeexpr_expr_new_ ();
14913 e
->type
= FFEEXPR_exprtypeOPERAND_
;
14914 e
->token
= ffeexpr_tokens_
[0];
14915 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_characterdefault
14916 (ffeexpr_tokens_
[1]));
14917 ni
= ffeinfo_new (FFEINFO_basictypeCHARACTER
, FFEINFO_kindtypeCHARACTERDEFAULT
,
14918 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
14919 ffelex_token_length (ffeexpr_tokens_
[1]));
14920 ffebld_set_info (e
->u
.operand
, ni
);
14921 ffelex_token_kill (ffeexpr_tokens_
[1]);
14922 ffeexpr_exprstack_push_operand_ (e
);
14923 if ((ffelex_token_type (t
) == FFELEX_typeNAME
)
14924 || (ffelex_token_type (t
) == FFELEX_typeNAMES
))
14926 if (ffest_ffebad_start (FFEBAD_INVALID_RADIX_SPECIFIER
))
14928 ffebad_string (ffelex_token_text (t
));
14929 ffebad_here (0, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
14930 ffebad_here (1, ffelex_token_where_line (ffeexpr_tokens_
[0]),
14931 ffelex_token_where_column (ffeexpr_tokens_
[0]));
14934 e
= ffeexpr_expr_new_ ();
14935 e
->type
= FFEEXPR_exprtypeBINARY_
;
14936 e
->token
= ffelex_token_use (t
);
14937 e
->u
.operator.op
= FFEEXPR_operatorCONCATENATE_
;
14938 e
->u
.operator.prec
= FFEEXPR_operatorprecedenceCONCATENATE_
;
14939 e
->u
.operator.as
= FFEEXPR_operatorassociativityCONCATENATE_
;
14940 ffeexpr_exprstack_push_binary_ (e
);
14941 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
14943 ffeexpr_is_substr_ok_
= !ffe_is_pedantic_not_90 (); /* Allow "'hello'(3:5)". */
14944 return (ffelexHandler
) ffeexpr_token_substrp_ (t
);
14947 /* ffeexpr_token_name_lhs_ -- Lhs NAME
14949 Return a pointer to this function to the lexer (ffelex), which will
14950 invoke it for the next token.
14952 Handle a name followed by open-paren, period (RECORD.MEMBER), percent
14953 (RECORD%MEMBER), or nothing at all. */
14955 static ffelexHandler
14956 ffeexpr_token_name_lhs_ (ffelexToken t
)
14959 ffeexprParenType_ paren_type
;
14964 switch (ffelex_token_type (t
))
14966 case FFELEX_typeOPEN_PAREN
:
14967 switch (ffeexpr_stack_
->context
)
14969 case FFEEXPR_contextASSIGN
:
14970 case FFEEXPR_contextAGOTO
:
14971 case FFEEXPR_contextFILEUNIT_DF
:
14972 goto just_name
; /* :::::::::::::::::::: */
14977 e
= ffeexpr_expr_new_ ();
14978 e
->type
= FFEEXPR_exprtypeOPERAND_
;
14979 e
->token
= ffelex_token_use (ffeexpr_tokens_
[0]);
14980 s
= ffeexpr_declare_parenthesized_ (ffeexpr_tokens_
[0], FALSE
,
14983 switch (ffesymbol_where (s
))
14985 case FFEINFO_whereLOCAL
:
14986 if (ffeexpr_stack_
->context
== FFEEXPR_contextSUBROUTINEREF
)
14987 ffesymbol_error (s
, ffeexpr_tokens_
[0]); /* Recursion. */
14990 case FFEINFO_whereINTRINSIC
:
14991 case FFEINFO_whereGLOBAL
:
14992 if (ffeexpr_stack_
->context
!= FFEEXPR_contextSUBROUTINEREF
)
14993 ffesymbol_error (s
, ffeexpr_tokens_
[0]); /* Can call intrin. */
14996 case FFEINFO_whereCOMMON
:
14997 case FFEINFO_whereDUMMY
:
14998 case FFEINFO_whereRESULT
:
15001 case FFEINFO_whereNONE
:
15002 case FFEINFO_whereANY
:
15006 ffesymbol_error (s
, ffeexpr_tokens_
[0]);
15010 if (ffesymbol_attrs (s
) & FFESYMBOL_attrsANY
)
15012 e
->u
.operand
= ffebld_new_any ();
15013 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
15017 e
->u
.operand
= ffebld_new_symter (s
,
15018 ffesymbol_generic (s
),
15019 ffesymbol_specific (s
),
15020 ffesymbol_implementation (s
));
15021 ffebld_set_info (e
->u
.operand
, ffesymbol_info (s
));
15023 ffeexpr_exprstack_push_ (e
); /* Not a complete operand yet. */
15024 ffeexpr_stack_
->tokens
[0] = ffeexpr_tokens_
[0];
15025 switch (paren_type
)
15027 case FFEEXPR_parentypeSUBROUTINE_
:
15028 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
15031 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15032 FFEEXPR_contextACTUALARG_
,
15033 ffeexpr_token_arguments_
);
15035 case FFEEXPR_parentypeARRAY_
:
15036 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
15037 ffeexpr_stack_
->bound_list
= ffesymbol_dims (s
);
15038 ffeexpr_stack_
->rank
= 0;
15039 ffeexpr_stack_
->constant
= TRUE
;
15040 ffeexpr_stack_
->immediate
= TRUE
;
15041 switch (ffeexpr_stack_
->context
)
15043 case FFEEXPR_contextDATAIMPDOITEM_
:
15046 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15047 FFEEXPR_contextDATAIMPDOINDEX_
,
15048 ffeexpr_token_elements_
);
15050 case FFEEXPR_contextEQUIVALENCE
:
15053 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15054 FFEEXPR_contextEQVINDEX_
,
15055 ffeexpr_token_elements_
);
15060 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15061 FFEEXPR_contextINDEX_
,
15062 ffeexpr_token_elements_
);
15065 case FFEEXPR_parentypeSUBSTRING_
:
15066 e
->u
.operand
= ffeexpr_collapse_symter (e
->u
.operand
,
15067 ffeexpr_tokens_
[0]);
15070 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15071 FFEEXPR_contextINDEX_
,
15072 ffeexpr_token_substring_
);
15074 case FFEEXPR_parentypeEQUIVALENCE_
:
15075 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
15076 ffeexpr_stack_
->bound_list
= ffesymbol_dims (s
);
15077 ffeexpr_stack_
->rank
= 0;
15078 ffeexpr_stack_
->constant
= TRUE
;
15079 ffeexpr_stack_
->immediate
= TRUE
;
15082 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15083 FFEEXPR_contextEQVINDEX_
,
15084 ffeexpr_token_equivalence_
);
15086 case FFEEXPR_parentypeFUNCTION_
: /* Invalid case. */
15087 case FFEEXPR_parentypeFUNSUBSTR_
: /* Invalid case. */
15088 ffesymbol_error (s
, ffeexpr_tokens_
[0]);
15089 /* Fall through. */
15090 case FFEEXPR_parentypeANY_
:
15091 e
->u
.operand
= ffebld_new_any ();
15092 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
15095 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15096 FFEEXPR_contextACTUALARG_
,
15097 ffeexpr_token_anything_
);
15100 assert ("bad paren type" == NULL
);
15104 case FFELEX_typeEQUALS
: /* As in "VAR=". */
15105 switch (ffeexpr_stack_
->context
)
15107 case FFEEXPR_contextIMPDOITEM_
: /* within
15108 "(,VAR=start,end[,incr])". */
15109 case FFEEXPR_contextIMPDOITEMDF_
:
15110 ffeexpr_stack_
->context
= FFEEXPR_contextIMPDOCTRL_
;
15113 case FFEEXPR_contextDATAIMPDOITEM_
:
15114 ffeexpr_stack_
->context
= FFEEXPR_contextDATAIMPDOCTRL_
;
15123 case FFELEX_typePERIOD
:
15124 case FFELEX_typePERCENT
:
15125 assert ("FOO%, FOO. not yet supported!~~" == NULL
);
15133 just_name
: /* :::::::::::::::::::: */
15134 e
= ffeexpr_expr_new_ ();
15135 e
->type
= FFEEXPR_exprtypeOPERAND_
;
15136 e
->token
= ffeexpr_tokens_
[0];
15137 s
= ffeexpr_declare_unadorned_ (ffeexpr_tokens_
[0],
15138 (ffeexpr_stack_
->context
15139 == FFEEXPR_contextSUBROUTINEREF
));
15141 switch (ffesymbol_where (s
))
15143 case FFEINFO_whereCONSTANT
:
15144 if ((ffeexpr_stack_
->context
!= FFEEXPR_contextPARAMETER
)
15145 || (ffesymbol_kind (s
) != FFEINFO_kindENTITY
))
15146 ffesymbol_error (s
, ffeexpr_tokens_
[0]);
15149 case FFEINFO_whereIMMEDIATE
:
15150 if ((ffeexpr_stack_
->context
!= FFEEXPR_contextDATAIMPDOCTRL_
)
15151 && (ffeexpr_stack_
->context
!= FFEEXPR_contextDATAIMPDOINDEX_
))
15152 ffesymbol_error (s
, ffeexpr_tokens_
[0]);
15155 case FFEINFO_whereLOCAL
:
15156 if (ffeexpr_stack_
->context
== FFEEXPR_contextSUBROUTINEREF
)
15157 ffesymbol_error (s
, ffeexpr_tokens_
[0]); /* Recurse!. */
15160 case FFEINFO_whereINTRINSIC
:
15161 if (ffeexpr_stack_
->context
!= FFEEXPR_contextSUBROUTINEREF
)
15162 ffesymbol_error (s
, ffeexpr_tokens_
[0]); /* Can call intrin. */
15169 if (ffesymbol_attrs (s
) & FFESYMBOL_attrsANY
)
15171 expr
= ffebld_new_any ();
15172 info
= ffeinfo_new_any ();
15173 ffebld_set_info (expr
, info
);
15177 expr
= ffebld_new_symter (s
,
15178 ffesymbol_generic (s
),
15179 ffesymbol_specific (s
),
15180 ffesymbol_implementation (s
));
15181 info
= ffesymbol_info (s
);
15182 ffebld_set_info (expr
, info
);
15183 if (ffesymbol_is_doiter (s
))
15185 ffebad_start (FFEBAD_DOITER
);
15186 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
15187 ffelex_token_where_column (ffeexpr_tokens_
[0]));
15188 ffest_ffebad_here_doiter (1, s
);
15189 ffebad_string (ffesymbol_text (s
));
15192 expr
= ffeexpr_collapse_symter (expr
, ffeexpr_tokens_
[0]);
15195 if (ffeexpr_stack_
->context
== FFEEXPR_contextSUBROUTINEREF
)
15197 if (ffebld_op (expr
) == FFEBLD_opANY
)
15199 expr
= ffebld_new_any ();
15200 ffebld_set_info (expr
, ffeinfo_new_any ());
15204 expr
= ffebld_new_subrref (expr
, NULL
); /* No argument list. */
15205 if (ffesymbol_generic (s
) != FFEINTRIN_genNONE
)
15206 ffeintrin_fulfill_generic (&expr
, &info
, e
->token
);
15207 else if (ffesymbol_specific (s
) != FFEINTRIN_specNONE
)
15208 ffeintrin_fulfill_specific (&expr
, &info
, NULL
, e
->token
);
15210 ffeexpr_fulfill_call_ (&expr
, e
->token
);
15212 if (ffebld_op (expr
) != FFEBLD_opANY
)
15213 ffebld_set_info (expr
,
15214 ffeinfo_new (ffeinfo_basictype (info
),
15215 ffeinfo_kindtype (info
),
15217 FFEINFO_kindENTITY
,
15218 FFEINFO_whereFLEETING
,
15219 ffeinfo_size (info
)));
15221 ffebld_set_info (expr
, ffeinfo_new_any ());
15225 e
->u
.operand
= expr
;
15226 ffeexpr_exprstack_push_operand_ (e
);
15227 return (ffelexHandler
) ffeexpr_finished_ (t
);
15230 /* ffeexpr_token_name_arg_ -- Rhs NAME
15232 Return a pointer to this function to the lexer (ffelex), which will
15233 invoke it for the next token.
15235 Handle first token in an actual-arg (or possible actual-arg) context
15236 being a NAME, and use second token to refine the context. */
15238 static ffelexHandler
15239 ffeexpr_token_name_arg_ (ffelexToken t
)
15241 switch (ffelex_token_type (t
))
15243 case FFELEX_typeCLOSE_PAREN
:
15244 case FFELEX_typeCOMMA
:
15245 switch (ffeexpr_stack_
->context
)
15247 case FFEEXPR_contextINDEXORACTUALARG_
:
15248 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARG_
;
15251 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
15252 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARG_
;
15261 switch (ffeexpr_stack_
->context
)
15263 case FFEEXPR_contextACTUALARG_
:
15264 ffeexpr_stack_
->context
= FFEEXPR_contextACTUALARGEXPR_
;
15267 case FFEEXPR_contextINDEXORACTUALARG_
:
15268 ffeexpr_stack_
->context
= FFEEXPR_contextINDEXORACTUALARGEXPR_
;
15271 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
15272 ffeexpr_stack_
->context
= FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
;
15275 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
15276 ffeexpr_stack_
->context
15277 = FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
;
15281 assert ("bad context in _name_arg_" == NULL
);
15287 return (ffelexHandler
) ffeexpr_token_name_rhs_ (t
);
15290 /* ffeexpr_token_name_rhs_ -- Rhs NAME
15292 Return a pointer to this function to the lexer (ffelex), which will
15293 invoke it for the next token.
15295 Handle a name followed by open-paren, apostrophe (O'octal-const',
15296 Z'hex-const', or X'hex-const'), period (RECORD.MEMBER).
15299 When followed by apostrophe or quote, set lex hexnum flag on so
15300 [0-9] as first char of next token seen as starting a potentially
15303 In case of intrinsic, decorate its SYMTER with the type info for
15304 the specific intrinsic. */
15306 static ffelexHandler
15307 ffeexpr_token_name_rhs_ (ffelexToken t
)
15310 ffeexprParenType_ paren_type
;
15314 switch (ffelex_token_type (t
))
15316 case FFELEX_typeQUOTE
:
15317 case FFELEX_typeAPOSTROPHE
:
15318 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
15319 ffelex_set_hexnum (TRUE
);
15320 return (ffelexHandler
) ffeexpr_token_name_apos_
;
15322 case FFELEX_typeOPEN_PAREN
:
15323 e
= ffeexpr_expr_new_ ();
15324 e
->type
= FFEEXPR_exprtypeOPERAND_
;
15325 e
->token
= ffelex_token_use (ffeexpr_tokens_
[0]);
15326 s
= ffeexpr_declare_parenthesized_ (ffeexpr_tokens_
[0], TRUE
,
15328 if (ffesymbol_attrs (s
) & FFESYMBOL_attrsANY
)
15329 e
->u
.operand
= ffebld_new_any ();
15331 e
->u
.operand
= ffebld_new_symter (s
, ffesymbol_generic (s
),
15332 ffesymbol_specific (s
),
15333 ffesymbol_implementation (s
));
15334 ffeexpr_exprstack_push_ (e
); /* Not a complete operand yet. */
15335 ffeexpr_stack_
->tokens
[0] = ffeexpr_tokens_
[0];
15336 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
15338 case FFEEXPR_contextSFUNCDEF
:
15339 case FFEEXPR_contextSFUNCDEFINDEX_
:
15340 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
15341 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
15345 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
15346 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
15347 assert ("weird context!" == NULL
);
15355 switch (paren_type
)
15357 case FFEEXPR_parentypeFUNCTION_
:
15358 ffebld_set_info (e
->u
.operand
, ffesymbol_info (s
));
15359 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
15360 if (ffesymbol_where (s
) == FFEINFO_whereCONSTANT
)
15361 { /* A statement function. */
15362 ffeexpr_stack_
->num_args
15363 = ffebld_list_length
15364 (ffeexpr_stack_
->next_dummy
15365 = ffesymbol_dummyargs (s
));
15366 ffeexpr_stack_
->tokens
[1] = NULL
; /* !=NULL when > num_args. */
15368 else if ((ffesymbol_where (s
) == FFEINFO_whereINTRINSIC
)
15369 && !ffe_is_pedantic_not_90 ()
15370 && ((ffesymbol_implementation (s
)
15371 == FFEINTRIN_impICHAR
)
15372 || (ffesymbol_implementation (s
)
15373 == FFEINTRIN_impIACHAR
)
15374 || (ffesymbol_implementation (s
)
15375 == FFEINTRIN_impLEN
)))
15376 { /* Allow arbitrary concatenations. */
15379 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15381 ? FFEEXPR_contextSFUNCDEF
15382 : FFEEXPR_contextLET
,
15383 ffeexpr_token_arguments_
);
15387 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15389 ? FFEEXPR_contextSFUNCDEFACTUALARG_
15390 : FFEEXPR_contextACTUALARG_
,
15391 ffeexpr_token_arguments_
);
15393 case FFEEXPR_parentypeARRAY_
:
15394 ffebld_set_info (e
->u
.operand
,
15395 ffesymbol_info (ffebld_symter (e
->u
.operand
)));
15396 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
15397 ffeexpr_stack_
->bound_list
= ffesymbol_dims (s
);
15398 ffeexpr_stack_
->rank
= 0;
15399 ffeexpr_stack_
->constant
= TRUE
;
15400 ffeexpr_stack_
->immediate
= TRUE
;
15401 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
15403 ? FFEEXPR_contextSFUNCDEFINDEX_
15404 : FFEEXPR_contextINDEX_
,
15405 ffeexpr_token_elements_
);
15407 case FFEEXPR_parentypeSUBSTRING_
:
15408 ffebld_set_info (e
->u
.operand
,
15409 ffesymbol_info (ffebld_symter (e
->u
.operand
)));
15410 e
->u
.operand
= ffeexpr_collapse_symter (e
->u
.operand
,
15411 ffeexpr_tokens_
[0]);
15414 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15416 ? FFEEXPR_contextSFUNCDEFINDEX_
15417 : FFEEXPR_contextINDEX_
,
15418 ffeexpr_token_substring_
);
15420 case FFEEXPR_parentypeFUNSUBSTR_
:
15423 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15425 ? FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
15426 : FFEEXPR_contextINDEXORACTUALARG_
,
15427 ffeexpr_token_funsubstr_
);
15429 case FFEEXPR_parentypeANY_
:
15430 ffebld_set_info (e
->u
.operand
, ffesymbol_info (s
));
15433 ffeexpr_rhs (ffeexpr_stack_
->pool
,
15435 ? FFEEXPR_contextSFUNCDEFACTUALARG_
15436 : FFEEXPR_contextACTUALARG_
,
15437 ffeexpr_token_anything_
);
15440 assert ("bad paren type" == NULL
);
15444 case FFELEX_typeEQUALS
: /* As in "VAR=". */
15445 switch (ffeexpr_stack_
->context
)
15447 case FFEEXPR_contextIMPDOITEM_
: /* "(,VAR=start,end[,incr])". */
15448 case FFEEXPR_contextIMPDOITEMDF_
:
15449 ffeexpr_stack_
->is_rhs
= FALSE
; /* Really an lhs construct. */
15450 ffeexpr_stack_
->context
= FFEEXPR_contextIMPDOCTRL_
;
15459 case FFELEX_typePERIOD
:
15460 case FFELEX_typePERCENT
:
15461 ~~Support these two someday
, though
not required
15462 assert ("FOO%, FOO. not yet supported!~~" == NULL
);
15470 switch (ffeexpr_stack_
->context
)
15472 case FFEEXPR_contextINDEXORACTUALARG_
:
15473 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
15474 assert ("strange context" == NULL
);
15481 e
= ffeexpr_expr_new_ ();
15482 e
->type
= FFEEXPR_exprtypeOPERAND_
;
15483 e
->token
= ffeexpr_tokens_
[0];
15484 s
= ffeexpr_declare_unadorned_ (ffeexpr_tokens_
[0], FALSE
);
15485 if (ffesymbol_attrs (s
) & FFESYMBOL_attrsANY
)
15487 e
->u
.operand
= ffebld_new_any ();
15488 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
15492 e
->u
.operand
= ffebld_new_symter (s
, FFEINTRIN_genNONE
,
15493 ffesymbol_specific (s
),
15494 ffesymbol_implementation (s
));
15495 if (ffesymbol_specific (s
) == FFEINTRIN_specNONE
)
15496 ffebld_set_info (e
->u
.operand
, ffeinfo_use (ffesymbol_info (s
)));
15498 { /* Decorate the SYMTER with the actual type
15499 of the intrinsic. */
15500 ffebld_set_info (e
->u
.operand
, ffeinfo_new
15501 (ffeintrin_basictype (ffesymbol_specific (s
)),
15502 ffeintrin_kindtype (ffesymbol_specific (s
)),
15504 ffesymbol_kind (s
),
15505 ffesymbol_where (s
),
15506 FFETARGET_charactersizeNONE
));
15508 if (ffesymbol_is_doiter (s
))
15509 ffebld_symter_set_is_doiter (e
->u
.operand
, TRUE
);
15510 e
->u
.operand
= ffeexpr_collapse_symter (e
->u
.operand
,
15511 ffeexpr_tokens_
[0]);
15513 ffeexpr_exprstack_push_operand_ (e
);
15514 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
15517 /* ffeexpr_token_name_apos_ -- Rhs NAME APOSTROPHE
15519 Return a pointer to this function to the lexer (ffelex), which will
15520 invoke it for the next token.
15522 Expecting a NAME token, analyze the previous NAME token to see what kind,
15523 if any, typeless constant we've got.
15526 Expect a NAME instead of CHARACTER in this situation. */
15528 static ffelexHandler
15529 ffeexpr_token_name_apos_ (ffelexToken t
)
15533 ffelex_set_hexnum (FALSE
);
15535 switch (ffelex_token_type (t
))
15537 case FFELEX_typeNAME
:
15538 ffeexpr_tokens_
[2] = ffelex_token_use (t
);
15539 return (ffelexHandler
) ffeexpr_token_name_apos_name_
;
15545 if (ffest_ffebad_start (FFEBAD_INVALID_RADIX_SPECIFIER
))
15547 ffebad_string (ffelex_token_text (ffeexpr_tokens_
[0]));
15548 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
15549 ffelex_token_where_column (ffeexpr_tokens_
[0]));
15550 ffebad_here (1, ffelex_token_where_line (t
),
15551 ffelex_token_where_column (t
));
15555 ffelex_token_kill (ffeexpr_tokens_
[1]);
15557 e
= ffeexpr_expr_new_ ();
15558 e
->type
= FFEEXPR_exprtypeOPERAND_
;
15559 e
->u
.operand
= ffebld_new_any ();
15560 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
15561 e
->token
= ffeexpr_tokens_
[0];
15562 ffeexpr_exprstack_push_operand_ (e
);
15564 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
15567 /* ffeexpr_token_name_apos_name_ -- Rhs NAME APOSTROPHE NAME
15569 Return a pointer to this function to the lexer (ffelex), which will
15570 invoke it for the next token.
15572 Expecting an APOSTROPHE token, analyze the previous NAME token to see
15573 what kind, if any, typeless constant we've got. */
15575 static ffelexHandler
15576 ffeexpr_token_name_apos_name_ (ffelexToken t
)
15581 e
= ffeexpr_expr_new_ ();
15582 e
->type
= FFEEXPR_exprtypeOPERAND_
;
15583 e
->token
= ffeexpr_tokens_
[0];
15585 if ((ffelex_token_type (t
) == ffelex_token_type (ffeexpr_tokens_
[1]))
15586 && (ffelex_token_length (ffeexpr_tokens_
[0]) == 1)
15587 && (ffesrc_char_match_init ((c
= ffelex_token_text (ffeexpr_tokens_
[0])[0]),
15589 || ffesrc_char_match_init (c
, 'O', 'o')
15590 || ffesrc_char_match_init (c
, 'X', 'x')
15591 || ffesrc_char_match_init (c
, 'Z', 'z')))
15593 ffetargetCharacterSize size
;
15595 if (!ffe_is_typeless_boz ()) {
15599 case FFESRC_CASE_MATCH_INIT ('B', 'b', imatch_b
, no_imatch
):
15600 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_integerbinary
15601 (ffeexpr_tokens_
[2]));
15604 case FFESRC_CASE_MATCH_INIT ('O', 'o', imatch_o
, no_imatch
):
15605 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_integeroctal
15606 (ffeexpr_tokens_
[2]));
15609 case FFESRC_CASE_MATCH_INIT ('X', 'x', imatch_x
, no_imatch
):
15610 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_integerhex
15611 (ffeexpr_tokens_
[2]));
15614 case FFESRC_CASE_MATCH_INIT ('Z', 'z', imatch_z
, no_imatch
):
15615 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_integerhex
15616 (ffeexpr_tokens_
[2]));
15620 no_imatch
: /* :::::::::::::::::::: */
15621 assert ("not BOXZ!" == NULL
);
15625 ffebld_set_info (e
->u
.operand
,
15626 ffeinfo_new (FFEINFO_basictypeINTEGER
,
15627 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
15628 FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
15629 FFETARGET_charactersizeNONE
));
15630 ffeexpr_exprstack_push_operand_ (e
);
15631 ffelex_token_kill (ffeexpr_tokens_
[1]);
15632 ffelex_token_kill (ffeexpr_tokens_
[2]);
15633 return (ffelexHandler
) ffeexpr_token_binary_
;
15638 case FFESRC_CASE_MATCH_INIT ('B', 'b', match_b
, no_match
):
15639 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_typeless_bm
15640 (ffeexpr_tokens_
[2]));
15641 size
= ffetarget_size_typeless_binary (ffeexpr_tokens_
[2]);
15644 case FFESRC_CASE_MATCH_INIT ('O', 'o', match_o
, no_match
):
15645 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_typeless_om
15646 (ffeexpr_tokens_
[2]));
15647 size
= ffetarget_size_typeless_octal (ffeexpr_tokens_
[2]);
15650 case FFESRC_CASE_MATCH_INIT ('X', 'x', match_x
, no_match
):
15651 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_typeless_hxm
15652 (ffeexpr_tokens_
[2]));
15653 size
= ffetarget_size_typeless_hex (ffeexpr_tokens_
[2]);
15656 case FFESRC_CASE_MATCH_INIT ('Z', 'z', match_z
, no_match
):
15657 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_typeless_hzm
15658 (ffeexpr_tokens_
[2]));
15659 size
= ffetarget_size_typeless_hex (ffeexpr_tokens_
[2]);
15663 no_match
: /* :::::::::::::::::::: */
15664 assert ("not BOXZ!" == NULL
);
15665 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_typeless_hzm
15666 (ffeexpr_tokens_
[2]));
15667 size
= ffetarget_size_typeless_hex (ffeexpr_tokens_
[2]);
15670 ffebld_set_info (e
->u
.operand
,
15671 ffeinfo_new (FFEINFO_basictypeTYPELESS
, FFEINFO_kindtypeNONE
,
15672 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
, size
));
15673 ffeexpr_exprstack_push_operand_ (e
);
15674 ffelex_token_kill (ffeexpr_tokens_
[1]);
15675 ffelex_token_kill (ffeexpr_tokens_
[2]);
15676 return (ffelexHandler
) ffeexpr_token_binary_
;
15679 if (ffest_ffebad_start (FFEBAD_INVALID_RADIX_SPECIFIER
))
15681 ffebad_string (ffelex_token_text (ffeexpr_tokens_
[0]));
15682 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
15683 ffelex_token_where_column (ffeexpr_tokens_
[0]));
15684 ffebad_here (1, ffelex_token_where_line (t
), ffelex_token_where_column (t
));
15688 ffelex_token_kill (ffeexpr_tokens_
[1]);
15689 ffelex_token_kill (ffeexpr_tokens_
[2]);
15691 e
->type
= FFEEXPR_exprtypeOPERAND_
;
15692 e
->u
.operand
= ffebld_new_any ();
15693 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
15694 e
->token
= ffeexpr_tokens_
[0];
15695 ffeexpr_exprstack_push_operand_ (e
);
15697 switch (ffelex_token_type (t
))
15699 case FFELEX_typeAPOSTROPHE
:
15700 case FFELEX_typeQUOTE
:
15701 return (ffelexHandler
) ffeexpr_token_binary_
;
15704 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
15708 /* ffeexpr_token_percent_ -- Rhs PERCENT
15710 Handle a percent sign possibly followed by "LOC". If followed instead
15711 by "VAL", "REF", or "DESCR", issue an error message and substitute
15712 "LOC". If followed by something else, treat the percent sign as a
15713 spurious incorrect token and reprocess the token via _rhs_. */
15715 static ffelexHandler
15716 ffeexpr_token_percent_ (ffelexToken t
)
15718 switch (ffelex_token_type (t
))
15720 case FFELEX_typeNAME
:
15721 case FFELEX_typeNAMES
:
15722 ffeexpr_stack_
->percent
= ffeexpr_percent_ (t
);
15723 ffeexpr_tokens_
[1] = ffelex_token_use (t
);
15724 return (ffelexHandler
) ffeexpr_token_percent_name_
;
15727 if (ffest_ffebad_start (FFEBAD_INVALID_TOKEN_IN_EXPRESSION
))
15729 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
15730 ffelex_token_where_column (ffeexpr_tokens_
[0]));
15731 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->first_token
),
15732 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
15735 ffelex_token_kill (ffeexpr_tokens_
[0]);
15736 return (ffelexHandler
) ffeexpr_token_rhs_ (t
);
15740 /* ffeexpr_token_percent_name_ -- Rhs PERCENT NAME
15742 Make sure the token is OPEN_PAREN and prepare for the one-item list of
15743 LHS expressions. Else display an error message. */
15745 static ffelexHandler
15746 ffeexpr_token_percent_name_ (ffelexToken t
)
15748 ffelexHandler nexthandler
;
15750 if (ffelex_token_type (t
) != FFELEX_typeOPEN_PAREN
)
15752 if (ffest_ffebad_start (FFEBAD_INVALID_TOKEN_IN_EXPRESSION
))
15754 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
15755 ffelex_token_where_column (ffeexpr_tokens_
[0]));
15756 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->first_token
),
15757 ffelex_token_where_column (ffeexpr_stack_
->first_token
));
15760 ffelex_token_kill (ffeexpr_tokens_
[0]);
15761 nexthandler
= (ffelexHandler
) ffeexpr_token_rhs_ (ffeexpr_tokens_
[1]);
15762 ffelex_token_kill (ffeexpr_tokens_
[1]);
15763 return (ffelexHandler
) (*nexthandler
) (t
);
15766 switch (ffeexpr_stack_
->percent
)
15769 if (ffest_ffebad_start (FFEBAD_INVALID_PERCENT
))
15771 ffebad_here (0, ffelex_token_where_line (ffeexpr_tokens_
[0]),
15772 ffelex_token_where_column (ffeexpr_tokens_
[0]));
15773 ffebad_string (ffelex_token_text (ffeexpr_tokens_
[1]));
15776 ffeexpr_stack_
->percent
= FFEEXPR_percentLOC_
;
15777 /* Fall through. */
15778 case FFEEXPR_percentLOC_
:
15779 ffeexpr_stack_
->tokens
[0] = ffeexpr_tokens_
[0];
15780 ffelex_token_kill (ffeexpr_tokens_
[1]);
15781 ffeexpr_stack_
->tokens
[1] = ffelex_token_use (t
);
15782 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
15783 FFEEXPR_contextLOC_
,
15784 ffeexpr_cb_end_loc_
);
15788 /* ffeexpr_make_float_const_ -- Make a floating-point constant
15792 Pass 'E', 'D', or 'Q' for exponent letter. */
15795 ffeexpr_make_float_const_ (char exp_letter
, ffelexToken integer
,
15796 ffelexToken decimal
, ffelexToken fraction
,
15797 ffelexToken exponent
, ffelexToken exponent_sign
,
15798 ffelexToken exponent_digits
)
15802 e
= ffeexpr_expr_new_ ();
15803 e
->type
= FFEEXPR_exprtypeOPERAND_
;
15804 if (integer
!= NULL
)
15805 e
->token
= ffelex_token_use (integer
);
15808 assert (decimal
!= NULL
);
15809 e
->token
= ffelex_token_use (decimal
);
15812 switch (exp_letter
)
15814 #if !FFETARGET_okREALQUAD
15815 case FFESRC_CASE_MATCH_INIT ('Q', 'q', match_q
, no_match
):
15816 if (ffebad_start (FFEBAD_QUAD_UNSUPPORTED
))
15818 ffebad_here (0, ffelex_token_where_line (e
->token
),
15819 ffelex_token_where_column (e
->token
));
15822 goto match_d
; /* The FFESRC_CASE_* macros don't
15823 allow fall-through! */
15826 case FFESRC_CASE_MATCH_INIT ('D', 'd', match_d
, no_match
):
15827 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_realdouble
15828 (integer
, decimal
, fraction
, exponent
, exponent_sign
, exponent_digits
));
15829 ffebld_set_info (e
->u
.operand
,
15830 ffeinfo_new (FFEINFO_basictypeREAL
, FFEINFO_kindtypeREALDOUBLE
,
15831 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
, FFETARGET_charactersizeNONE
));
15834 case FFESRC_CASE_MATCH_INIT ('E', 'e', match_e
, no_match
):
15835 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_realdefault
15836 (integer
, decimal
, fraction
, exponent
, exponent_sign
, exponent_digits
));
15837 ffebld_set_info (e
->u
.operand
, ffeinfo_new (FFEINFO_basictypeREAL
,
15838 FFEINFO_kindtypeREALDEFAULT
, 0, FFEINFO_kindENTITY
,
15839 FFEINFO_whereCONSTANT
, FFETARGET_charactersizeNONE
));
15842 #if FFETARGET_okREALQUAD
15843 case FFESRC_CASE_MATCH_INIT ('Q', 'q', match_q
, no_match
):
15844 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_realquad
15845 (integer
, decimal
, fraction
, exponent
, exponent_sign
, exponent_digits
));
15846 ffebld_set_info (e
->u
.operand
,
15847 ffeinfo_new (FFEINFO_basictypeREAL
, FFEINFO_kindtypeREALQUAD
,
15848 0, FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
, FFETARGET_charactersizeNONE
));
15852 case 'I': /* Make an integer. */
15853 e
->u
.operand
= ffebld_new_conter (ffebld_constant_new_integerdefault
15854 (ffeexpr_tokens_
[0]));
15855 ffebld_set_info (e
->u
.operand
,
15856 ffeinfo_new (FFEINFO_basictypeINTEGER
,
15857 FFEINFO_kindtypeINTEGERDEFAULT
, 0,
15858 FFEINFO_kindENTITY
, FFEINFO_whereCONSTANT
,
15859 FFETARGET_charactersizeNONE
));
15863 no_match
: /* :::::::::::::::::::: */
15864 assert ("Lost the exponent letter!" == NULL
);
15867 ffeexpr_exprstack_push_operand_ (e
);
15870 /* Just like ffesymbol_declare_local, except performs any implicit info
15871 assignment necessary. */
15874 ffeexpr_declare_unadorned_ (ffelexToken t
, bool maybe_intrin
)
15880 s
= ffesymbol_declare_local (t
, maybe_intrin
);
15882 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
15883 /* Special-case these since they can involve a different concept
15884 of "state" (in the stmtfunc name space). */
15886 case FFEEXPR_contextDATAIMPDOINDEX_
:
15887 case FFEEXPR_contextDATAIMPDOCTRL_
:
15888 if (ffeexpr_context_outer_ (ffeexpr_stack_
)
15889 == FFEEXPR_contextDATAIMPDOINDEX_
)
15890 s
= ffeexpr_sym_impdoitem_ (s
, t
);
15892 if (ffeexpr_stack_
->is_rhs
)
15893 s
= ffeexpr_sym_impdoitem_ (s
, t
);
15895 s
= ffeexpr_sym_lhs_impdoctrl_ (s
, t
);
15896 bad
= (ffesymbol_kind (s
) != FFEINFO_kindENTITY
)
15897 || ((ffesymbol_where (s
) != FFEINFO_whereCONSTANT
)
15898 && (ffesymbol_where (s
) != FFEINFO_whereIMMEDIATE
));
15899 if (bad
&& (ffesymbol_kind (s
) != FFEINFO_kindANY
))
15900 ffesymbol_error (s
, t
);
15907 switch ((ffesymbol_sfdummyparent (s
) == NULL
)
15908 ? ffesymbol_state (s
)
15909 : FFESYMBOL_stateUNDERSTOOD
)
15911 case FFESYMBOL_stateNONE
: /* Before first exec, not seen in expr
15913 if (!ffest_seen_first_exec ())
15914 goto seen
; /* :::::::::::::::::::: */
15915 /* Fall through. */
15916 case FFESYMBOL_stateUNCERTAIN
: /* Unseen since first exec. */
15917 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
15919 case FFEEXPR_contextSUBROUTINEREF
:
15920 s
= ffeexpr_sym_lhs_call_ (s
, t
);
15923 case FFEEXPR_contextFILEEXTFUNC
:
15924 s
= ffeexpr_sym_lhs_extfunc_ (s
, t
);
15927 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
15928 s
= ffecom_sym_exec_transition (s
);
15929 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
15930 goto understood
; /* :::::::::::::::::::: */
15931 /* Fall through. */
15932 case FFEEXPR_contextACTUALARG_
:
15933 s
= ffeexpr_sym_rhs_actualarg_ (s
, t
);
15936 case FFEEXPR_contextDATA
:
15937 if (ffeexpr_stack_
->is_rhs
)
15938 s
= ffeexpr_sym_rhs_let_ (s
, t
);
15940 s
= ffeexpr_sym_lhs_data_ (s
, t
);
15943 case FFEEXPR_contextDATAIMPDOITEM_
:
15944 s
= ffeexpr_sym_lhs_data_ (s
, t
);
15947 case FFEEXPR_contextSFUNCDEF
:
15948 case FFEEXPR_contextSFUNCDEFINDEX_
:
15949 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
15950 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
15951 s
= ffecom_sym_exec_transition (s
);
15952 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
15953 goto understood
; /* :::::::::::::::::::: */
15954 /* Fall through. */
15955 case FFEEXPR_contextLET
:
15956 case FFEEXPR_contextPAREN_
:
15957 case FFEEXPR_contextACTUALARGEXPR_
:
15958 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
15959 case FFEEXPR_contextASSIGN
:
15960 case FFEEXPR_contextIOLIST
:
15961 case FFEEXPR_contextIOLISTDF
:
15962 case FFEEXPR_contextDO
:
15963 case FFEEXPR_contextDOWHILE
:
15964 case FFEEXPR_contextAGOTO
:
15965 case FFEEXPR_contextCGOTO
:
15966 case FFEEXPR_contextIF
:
15967 case FFEEXPR_contextARITHIF
:
15968 case FFEEXPR_contextFORMAT
:
15969 case FFEEXPR_contextSTOP
:
15970 case FFEEXPR_contextRETURN
:
15971 case FFEEXPR_contextSELECTCASE
:
15972 case FFEEXPR_contextCASE
:
15973 case FFEEXPR_contextFILEASSOC
:
15974 case FFEEXPR_contextFILEINT
:
15975 case FFEEXPR_contextFILEDFINT
:
15976 case FFEEXPR_contextFILELOG
:
15977 case FFEEXPR_contextFILENUM
:
15978 case FFEEXPR_contextFILENUMAMBIG
:
15979 case FFEEXPR_contextFILECHAR
:
15980 case FFEEXPR_contextFILENUMCHAR
:
15981 case FFEEXPR_contextFILEDFCHAR
:
15982 case FFEEXPR_contextFILEKEY
:
15983 case FFEEXPR_contextFILEUNIT
:
15984 case FFEEXPR_contextFILEUNIT_DF
:
15985 case FFEEXPR_contextFILEUNITAMBIG
:
15986 case FFEEXPR_contextFILEFORMAT
:
15987 case FFEEXPR_contextFILENAMELIST
:
15988 case FFEEXPR_contextFILEVXTCODE
:
15989 case FFEEXPR_contextINDEX_
:
15990 case FFEEXPR_contextIMPDOITEM_
:
15991 case FFEEXPR_contextIMPDOITEMDF_
:
15992 case FFEEXPR_contextIMPDOCTRL_
:
15993 case FFEEXPR_contextLOC_
:
15994 if (ffeexpr_stack_
->is_rhs
)
15995 s
= ffeexpr_sym_rhs_let_ (s
, t
);
15997 s
= ffeexpr_sym_lhs_let_ (s
, t
);
16000 case FFEEXPR_contextCHARACTERSIZE
:
16001 case FFEEXPR_contextEQUIVALENCE
:
16002 case FFEEXPR_contextINCLUDE
:
16003 case FFEEXPR_contextPARAMETER
:
16004 case FFEEXPR_contextDIMLIST
:
16005 case FFEEXPR_contextDIMLISTCOMMON
:
16006 case FFEEXPR_contextKINDTYPE
:
16007 case FFEEXPR_contextINITVAL
:
16008 case FFEEXPR_contextEQVINDEX_
:
16009 break; /* Will turn into errors below. */
16012 ffesymbol_error (s
, t
);
16015 /* Fall through. */
16016 case FFESYMBOL_stateUNDERSTOOD
: /* Nothing much more to learn. */
16017 understood
: /* :::::::::::::::::::: */
16018 k
= ffesymbol_kind (s
);
16019 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
16021 case FFEEXPR_contextSUBROUTINEREF
:
16022 bad
= ((k
!= FFEINFO_kindSUBROUTINE
)
16023 && ((ffesymbol_where (s
) != FFEINFO_whereINTRINSIC
)
16024 || (k
!= FFEINFO_kindNONE
)));
16027 case FFEEXPR_contextFILEEXTFUNC
:
16028 bad
= (k
!= FFEINFO_kindFUNCTION
)
16029 || (ffesymbol_where (s
) != FFEINFO_whereGLOBAL
);
16032 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
16033 case FFEEXPR_contextACTUALARG_
:
16036 case FFEINFO_kindENTITY
:
16040 case FFEINFO_kindFUNCTION
:
16041 case FFEINFO_kindSUBROUTINE
:
16043 = ((ffesymbol_where (s
) != FFEINFO_whereGLOBAL
)
16044 && (ffesymbol_where (s
) != FFEINFO_whereDUMMY
)
16045 && ((ffesymbol_where (s
) != FFEINFO_whereINTRINSIC
)
16046 || !ffeintrin_is_actualarg (ffesymbol_specific (s
))));
16049 case FFEINFO_kindNONE
:
16050 if (ffesymbol_where (s
) == FFEINFO_whereINTRINSIC
)
16052 bad
= !(ffeintrin_is_actualarg (ffesymbol_specific (s
)));
16056 /* If state is UNDERSTOOD here, it's CHAR*(*) or attrsANY,
16057 and in the former case, attrsTYPE is set, so we
16058 see this as an error as we should, since CHAR*(*)
16059 cannot be actually referenced in a main/block data
16062 if ((ffesymbol_attrs (s
) & (FFESYMBOL_attrsANY
16063 | FFESYMBOL_attrsEXTERNAL
16064 | FFESYMBOL_attrsTYPE
))
16065 == FFESYMBOL_attrsEXTERNAL
)
16077 case FFEEXPR_contextDATA
:
16078 if (ffeexpr_stack_
->is_rhs
)
16079 bad
= (k
!= FFEINFO_kindENTITY
)
16080 || (ffesymbol_where (s
) != FFEINFO_whereCONSTANT
);
16082 bad
= (k
!= FFEINFO_kindENTITY
)
16083 || ((ffesymbol_where (s
) != FFEINFO_whereNONE
)
16084 && (ffesymbol_where (s
) != FFEINFO_whereLOCAL
)
16085 && (ffesymbol_where (s
) != FFEINFO_whereCOMMON
));
16088 case FFEEXPR_contextDATAIMPDOITEM_
:
16089 bad
= TRUE
; /* Unadorned item never valid. */
16092 case FFEEXPR_contextSFUNCDEF
:
16093 case FFEEXPR_contextSFUNCDEFINDEX_
:
16094 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
16095 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
16096 case FFEEXPR_contextLET
:
16097 case FFEEXPR_contextPAREN_
:
16098 case FFEEXPR_contextACTUALARGEXPR_
:
16099 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
16100 case FFEEXPR_contextASSIGN
:
16101 case FFEEXPR_contextIOLIST
:
16102 case FFEEXPR_contextIOLISTDF
:
16103 case FFEEXPR_contextDO
:
16104 case FFEEXPR_contextDOWHILE
:
16105 case FFEEXPR_contextAGOTO
:
16106 case FFEEXPR_contextCGOTO
:
16107 case FFEEXPR_contextIF
:
16108 case FFEEXPR_contextARITHIF
:
16109 case FFEEXPR_contextFORMAT
:
16110 case FFEEXPR_contextSTOP
:
16111 case FFEEXPR_contextRETURN
:
16112 case FFEEXPR_contextSELECTCASE
:
16113 case FFEEXPR_contextCASE
:
16114 case FFEEXPR_contextFILEASSOC
:
16115 case FFEEXPR_contextFILEINT
:
16116 case FFEEXPR_contextFILEDFINT
:
16117 case FFEEXPR_contextFILELOG
:
16118 case FFEEXPR_contextFILENUM
:
16119 case FFEEXPR_contextFILENUMAMBIG
:
16120 case FFEEXPR_contextFILECHAR
:
16121 case FFEEXPR_contextFILENUMCHAR
:
16122 case FFEEXPR_contextFILEDFCHAR
:
16123 case FFEEXPR_contextFILEKEY
:
16124 case FFEEXPR_contextFILEUNIT
:
16125 case FFEEXPR_contextFILEUNIT_DF
:
16126 case FFEEXPR_contextFILEUNITAMBIG
:
16127 case FFEEXPR_contextFILEFORMAT
:
16128 case FFEEXPR_contextFILENAMELIST
:
16129 case FFEEXPR_contextFILEVXTCODE
:
16130 case FFEEXPR_contextINDEX_
:
16131 case FFEEXPR_contextIMPDOITEM_
:
16132 case FFEEXPR_contextIMPDOITEMDF_
:
16133 case FFEEXPR_contextIMPDOCTRL_
:
16134 case FFEEXPR_contextLOC_
:
16135 bad
= (k
!= FFEINFO_kindENTITY
); /* This catches "SUBROUTINE
16136 X(A);EXTERNAL A;CALL
16137 Y(A);B=A", for example. */
16140 case FFEEXPR_contextCHARACTERSIZE
:
16141 case FFEEXPR_contextEQUIVALENCE
:
16142 case FFEEXPR_contextPARAMETER
:
16143 case FFEEXPR_contextDIMLIST
:
16144 case FFEEXPR_contextDIMLISTCOMMON
:
16145 case FFEEXPR_contextKINDTYPE
:
16146 case FFEEXPR_contextINITVAL
:
16147 case FFEEXPR_contextEQVINDEX_
:
16148 bad
= (k
!= FFEINFO_kindENTITY
)
16149 || (ffesymbol_where (s
) != FFEINFO_whereCONSTANT
);
16152 case FFEEXPR_contextINCLUDE
:
16160 if (bad
&& (k
!= FFEINFO_kindANY
))
16161 ffesymbol_error (s
, t
);
16164 case FFESYMBOL_stateSEEN
: /* Seen but not yet in exec portion. */
16165 seen
: /* :::::::::::::::::::: */
16166 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
16168 case FFEEXPR_contextPARAMETER
:
16169 if (ffeexpr_stack_
->is_rhs
)
16170 ffesymbol_error (s
, t
);
16172 s
= ffeexpr_sym_lhs_parameter_ (s
, t
);
16175 case FFEEXPR_contextDATA
:
16176 s
= ffecom_sym_exec_transition (s
);
16177 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
16178 goto understood
; /* :::::::::::::::::::: */
16179 if (ffeexpr_stack_
->is_rhs
)
16180 ffesymbol_error (s
, t
);
16182 s
= ffeexpr_sym_lhs_data_ (s
, t
);
16183 goto understood
; /* :::::::::::::::::::: */
16185 case FFEEXPR_contextDATAIMPDOITEM_
:
16186 s
= ffecom_sym_exec_transition (s
);
16187 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
16188 goto understood
; /* :::::::::::::::::::: */
16189 s
= ffeexpr_sym_lhs_data_ (s
, t
);
16190 goto understood
; /* :::::::::::::::::::: */
16192 case FFEEXPR_contextEQUIVALENCE
:
16193 s
= ffeexpr_sym_lhs_equivalence_ (s
, t
);
16196 case FFEEXPR_contextDIMLIST
:
16197 s
= ffeexpr_sym_rhs_dimlist_ (s
, t
);
16200 case FFEEXPR_contextCHARACTERSIZE
:
16201 case FFEEXPR_contextKINDTYPE
:
16202 case FFEEXPR_contextDIMLISTCOMMON
:
16203 case FFEEXPR_contextINITVAL
:
16204 case FFEEXPR_contextEQVINDEX_
:
16205 ffesymbol_error (s
, t
);
16208 case FFEEXPR_contextINCLUDE
:
16209 ffesymbol_error (s
, t
);
16212 case FFEEXPR_contextACTUALARG_
: /* E.g. I in REAL A(Y(I)). */
16213 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
16214 s
= ffecom_sym_exec_transition (s
);
16215 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
16216 goto understood
; /* :::::::::::::::::::: */
16217 s
= ffeexpr_sym_rhs_actualarg_ (s
, t
);
16218 goto understood
; /* :::::::::::::::::::: */
16220 case FFEEXPR_contextINDEX_
:
16221 case FFEEXPR_contextACTUALARGEXPR_
:
16222 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
16223 case FFEEXPR_contextSFUNCDEF
:
16224 case FFEEXPR_contextSFUNCDEFINDEX_
:
16225 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
16226 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
16227 assert (ffeexpr_stack_
->is_rhs
);
16228 s
= ffecom_sym_exec_transition (s
);
16229 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
16230 goto understood
; /* :::::::::::::::::::: */
16231 s
= ffeexpr_sym_rhs_let_ (s
, t
);
16232 goto understood
; /* :::::::::::::::::::: */
16235 ffesymbol_error (s
, t
);
16241 assert ("bad symbol state" == NULL
);
16247 /* Have FOO in DATA (XYZ(FOO),...)/.../ or DATA (...,XYZ=FOO,BAR,BLETCH).
16248 Could be found via the "statement-function" name space (in which case
16249 it should become an iterator) or the local name space (in which case
16250 it should be either a named constant, or a variable that will have an
16251 sfunc name space sibling that should become an iterator). */
16254 ffeexpr_sym_impdoitem_ (ffesymbol sp
, ffelexToken t
)
16262 ffeinfoWhere where
;
16264 ss
= ffesymbol_state (sp
);
16266 if (ffesymbol_sfdummyparent (sp
) != NULL
)
16267 { /* Have symbol in sfunc name space. */
16270 case FFESYMBOL_stateNONE
: /* Used as iterator already. */
16271 if (ffeexpr_level_
< ffesymbol_maxentrynum (sp
))
16272 ffesymbol_error (sp
, t
); /* Can't use dead iterator. */
16274 { /* Can use dead iterator because we're at at
16275 least an innermore (higher-numbered) level
16276 than the iterator's outermost
16277 (lowest-numbered) level. */
16278 ffesymbol_signal_change (sp
);
16279 ffesymbol_set_state (sp
, FFESYMBOL_stateSEEN
);
16280 ffesymbol_set_maxentrynum (sp
, ffeexpr_level_
);
16281 ffesymbol_signal_unreported (sp
);
16285 case FFESYMBOL_stateSEEN
: /* Seen already in this or other
16286 implied-DO. Set symbol level
16287 number to outermost value, as that
16288 tells us we can see it as iterator
16289 at that level at the innermost. */
16290 if (ffeexpr_level_
< ffesymbol_maxentrynum (sp
))
16292 ffesymbol_signal_change (sp
);
16293 ffesymbol_set_maxentrynum (sp
, ffeexpr_level_
);
16294 ffesymbol_signal_unreported (sp
);
16298 case FFESYMBOL_stateUNCERTAIN
: /* Iterator. */
16299 assert (ffeexpr_level_
== ffesymbol_maxentrynum (sp
));
16300 ffesymbol_error (sp
, t
); /* (,,,I=I,10). */
16303 case FFESYMBOL_stateUNDERSTOOD
:
16307 assert ("Foo Bar!!" == NULL
);
16314 /* Got symbol in local name space, so we haven't seen it in impdo yet.
16315 First, if it is brand-new and we're in executable statements, set the
16316 attributes and exec-transition it to set state UNCERTAIN or UNDERSTOOD.
16317 Second, if it is now a constant (PARAMETER), then just return it, it
16318 can't be an implied-do iterator. If it is understood, complain if it is
16319 not a valid variable, but make the inner name space iterator anyway and
16320 return that. If it is not understood, improve understanding of the
16321 symbol accordingly, complain accordingly, in either case make the inner
16322 name space iterator and return that. */
16324 sa
= ffesymbol_attrs (sp
);
16326 if (ffesymbol_state_is_specable (ss
)
16327 && ffest_seen_first_exec ())
16329 assert (sa
== FFESYMBOL_attrsetNONE
);
16330 ffesymbol_signal_change (sp
);
16331 ffesymbol_set_state (sp
, FFESYMBOL_stateSEEN
);
16332 ffesymbol_resolve_intrin (sp
);
16333 if (ffeimplic_establish_symbol (sp
))
16334 ffesymbol_set_attr (sp
, FFESYMBOL_attrSFARG
);
16336 ffesymbol_error (sp
, t
);
16338 /* After the exec transition, the state will either be UNCERTAIN (could
16339 be a dummy or local var) or UNDERSTOOD (local var, because this is a
16340 PROGRAM/BLOCKDATA program unit). */
16342 sp
= ffecom_sym_exec_transition (sp
);
16343 sa
= ffesymbol_attrs (sp
);
16344 ss
= ffesymbol_state (sp
);
16348 kind
= ffesymbol_kind (sp
);
16349 where
= ffesymbol_where (sp
);
16351 if (ss
== FFESYMBOL_stateUNDERSTOOD
)
16353 if (kind
!= FFEINFO_kindENTITY
)
16354 ffesymbol_error (sp
, t
);
16355 if (where
== FFEINFO_whereCONSTANT
)
16360 /* Enhance understanding of local symbol. This used to imply exec
16361 transition, but that doesn't seem necessary, since the local symbol
16362 doesn't actually get put into an ffebld tree here -- we just learn
16363 more about it, just like when we see a local symbol's name in the
16364 dummy-arg list of a statement function. */
16366 if (ss
!= FFESYMBOL_stateUNCERTAIN
)
16368 /* Figure out what kind of object we've got based on previous
16369 declarations of or references to the object. */
16371 ns
= FFESYMBOL_stateSEEN
;
16373 if (sa
& FFESYMBOL_attrsANY
)
16375 else if (!(sa
& ~(FFESYMBOL_attrsADJUSTS
16376 | FFESYMBOL_attrsANY
16377 | FFESYMBOL_attrsCOMMON
16378 | FFESYMBOL_attrsDUMMY
16379 | FFESYMBOL_attrsEQUIV
16380 | FFESYMBOL_attrsINIT
16381 | FFESYMBOL_attrsNAMELIST
16382 | FFESYMBOL_attrsRESULT
16383 | FFESYMBOL_attrsSAVE
16384 | FFESYMBOL_attrsSFARG
16385 | FFESYMBOL_attrsTYPE
)))
16386 na
= sa
| FFESYMBOL_attrsSFARG
;
16388 na
= FFESYMBOL_attrsetNONE
;
16391 { /* stateUNCERTAIN. */
16392 na
= sa
| FFESYMBOL_attrsSFARG
;
16393 ns
= FFESYMBOL_stateUNDERSTOOD
;
16395 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16396 | FFESYMBOL_attrsADJUSTABLE
16397 | FFESYMBOL_attrsANYLEN
16398 | FFESYMBOL_attrsARRAY
16399 | FFESYMBOL_attrsDUMMY
16400 | FFESYMBOL_attrsEXTERNAL
16401 | FFESYMBOL_attrsSFARG
16402 | FFESYMBOL_attrsTYPE
)));
16404 if (sa
& FFESYMBOL_attrsEXTERNAL
)
16406 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16407 | FFESYMBOL_attrsDUMMY
16408 | FFESYMBOL_attrsEXTERNAL
16409 | FFESYMBOL_attrsTYPE
)));
16411 na
= FFESYMBOL_attrsetNONE
;
16413 else if (sa
& FFESYMBOL_attrsDUMMY
)
16415 assert (!(sa
& FFESYMBOL_attrsEXTERNAL
)); /* Handled above. */
16416 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
16417 | FFESYMBOL_attrsEXTERNAL
16418 | FFESYMBOL_attrsTYPE
)));
16420 kind
= FFEINFO_kindENTITY
;
16422 else if (sa
& FFESYMBOL_attrsARRAY
)
16424 assert (!(sa
& ~(FFESYMBOL_attrsARRAY
16425 | FFESYMBOL_attrsADJUSTABLE
16426 | FFESYMBOL_attrsTYPE
)));
16428 na
= FFESYMBOL_attrsetNONE
;
16430 else if (sa
& FFESYMBOL_attrsSFARG
)
16432 assert (!(sa
& ~(FFESYMBOL_attrsSFARG
16433 | FFESYMBOL_attrsTYPE
)));
16435 ns
= FFESYMBOL_stateUNCERTAIN
;
16437 else if (sa
& FFESYMBOL_attrsTYPE
)
16439 assert (!(sa
& (FFESYMBOL_attrsARRAY
16440 | FFESYMBOL_attrsDUMMY
16441 | FFESYMBOL_attrsEXTERNAL
16442 | FFESYMBOL_attrsSFARG
))); /* Handled above. */
16443 assert (!(sa
& ~(FFESYMBOL_attrsTYPE
16444 | FFESYMBOL_attrsADJUSTABLE
16445 | FFESYMBOL_attrsANYLEN
16446 | FFESYMBOL_attrsARRAY
16447 | FFESYMBOL_attrsDUMMY
16448 | FFESYMBOL_attrsEXTERNAL
16449 | FFESYMBOL_attrsSFARG
)));
16451 kind
= FFEINFO_kindENTITY
;
16453 if (sa
& (FFESYMBOL_attrsADJUSTABLE
| FFESYMBOL_attrsANYLEN
))
16454 na
= FFESYMBOL_attrsetNONE
;
16455 else if (ffest_is_entry_valid ())
16456 ns
= FFESYMBOL_stateUNCERTAIN
; /* Could be DUMMY or LOCAL. */
16458 where
= FFEINFO_whereLOCAL
;
16461 na
= FFESYMBOL_attrsetNONE
; /* Error. */
16464 /* Now see what we've got for a new object: NONE means a new error
16465 cropped up; ANY means an old error to be ignored; otherwise,
16466 everything's ok, update the object (symbol) and continue on. */
16468 if (na
== FFESYMBOL_attrsetNONE
)
16469 ffesymbol_error (sp
, t
);
16470 else if (!(na
& FFESYMBOL_attrsANY
))
16472 ffesymbol_signal_change (sp
); /* May need to back up to previous
16474 if (!ffeimplic_establish_symbol (sp
))
16475 ffesymbol_error (sp
, t
);
16478 ffesymbol_set_info (sp
,
16479 ffeinfo_new (ffesymbol_basictype (sp
),
16480 ffesymbol_kindtype (sp
),
16481 ffesymbol_rank (sp
),
16484 ffesymbol_size (sp
)));
16485 ffesymbol_set_attrs (sp
, na
);
16486 ffesymbol_set_state (sp
, ns
);
16487 ffesymbol_resolve_intrin (sp
);
16488 if (!ffesymbol_state_is_specable (ns
))
16489 sp
= ffecom_sym_learned (sp
);
16490 ffesymbol_signal_unreported (sp
); /* For debugging purposes. */
16495 /* Here we create the sfunc-name-space symbol representing what should
16496 become an iterator in this name space at this or an outermore (lower-
16497 numbered) expression level, else the implied-DO construct is in error. */
16499 s
= ffesymbol_declare_sfdummy (t
); /* Sets maxentrynum to 0 for new obj;
16500 also sets sfa_dummy_parent to
16502 assert (sp
== ffesymbol_sfdummyparent (s
));
16504 ffesymbol_signal_change (s
);
16505 ffesymbol_set_state (s
, FFESYMBOL_stateSEEN
);
16506 ffesymbol_set_maxentrynum (s
, ffeexpr_level_
);
16507 ffesymbol_set_info (s
,
16508 ffeinfo_new (FFEINFO_basictypeINTEGER
,
16509 FFEINFO_kindtypeINTEGERDEFAULT
,
16511 FFEINFO_kindENTITY
,
16512 FFEINFO_whereIMMEDIATE
,
16513 FFETARGET_charactersizeNONE
));
16514 ffesymbol_signal_unreported (s
);
16516 if ((ffesymbol_basictype (sp
) != FFEINFO_basictypeINTEGER
)
16517 && (ffesymbol_basictype (sp
) != FFEINFO_basictypeANY
))
16518 ffesymbol_error (s
, t
);
16523 /* Have FOO in CALL FOO. Local name space, executable context only. */
16526 ffeexpr_sym_lhs_call_ (ffesymbol s
, ffelexToken t
)
16531 ffeinfoWhere where
;
16533 ffeintrinSpec spec
;
16535 bool error
= FALSE
;
16537 assert ((ffesymbol_state (s
) == FFESYMBOL_stateNONE
)
16538 || (ffesymbol_state (s
) == FFESYMBOL_stateUNCERTAIN
));
16540 na
= sa
= ffesymbol_attrs (s
);
16542 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16543 | FFESYMBOL_attrsADJUSTABLE
16544 | FFESYMBOL_attrsANYLEN
16545 | FFESYMBOL_attrsARRAY
16546 | FFESYMBOL_attrsDUMMY
16547 | FFESYMBOL_attrsEXTERNAL
16548 | FFESYMBOL_attrsSFARG
16549 | FFESYMBOL_attrsTYPE
)));
16551 kind
= ffesymbol_kind (s
);
16552 where
= ffesymbol_where (s
);
16554 /* Figure out what kind of object we've got based on previous declarations
16555 of or references to the object. */
16557 if (sa
& FFESYMBOL_attrsEXTERNAL
)
16559 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16560 | FFESYMBOL_attrsDUMMY
16561 | FFESYMBOL_attrsEXTERNAL
16562 | FFESYMBOL_attrsTYPE
)));
16564 if (sa
& FFESYMBOL_attrsTYPE
)
16569 kind
= FFEINFO_kindSUBROUTINE
;
16571 if (sa
& FFESYMBOL_attrsDUMMY
)
16573 else if (sa
& FFESYMBOL_attrsACTUALARG
)
16574 ; /* Not DUMMY or TYPE. */
16575 else /* Not ACTUALARG, DUMMY, or TYPE. */
16576 where
= FFEINFO_whereGLOBAL
;
16579 else if (sa
& FFESYMBOL_attrsDUMMY
)
16581 assert (!(sa
& FFESYMBOL_attrsEXTERNAL
)); /* Handled above. */
16582 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
16583 | FFESYMBOL_attrsEXTERNAL
16584 | FFESYMBOL_attrsTYPE
)));
16586 if (sa
& FFESYMBOL_attrsTYPE
)
16589 kind
= FFEINFO_kindSUBROUTINE
;
16591 else if (sa
& FFESYMBOL_attrsARRAY
)
16593 assert (!(sa
& ~(FFESYMBOL_attrsARRAY
16594 | FFESYMBOL_attrsADJUSTABLE
16595 | FFESYMBOL_attrsTYPE
)));
16599 else if (sa
& FFESYMBOL_attrsSFARG
)
16601 assert (!(sa
& ~(FFESYMBOL_attrsSFARG
16602 | FFESYMBOL_attrsTYPE
)));
16606 else if (sa
& FFESYMBOL_attrsTYPE
)
16608 assert (!(sa
& (FFESYMBOL_attrsARRAY
16609 | FFESYMBOL_attrsDUMMY
16610 | FFESYMBOL_attrsEXTERNAL
16611 | FFESYMBOL_attrsSFARG
))); /* Handled above. */
16612 assert (!(sa
& ~(FFESYMBOL_attrsTYPE
16613 | FFESYMBOL_attrsADJUSTABLE
16614 | FFESYMBOL_attrsANYLEN
16615 | FFESYMBOL_attrsARRAY
16616 | FFESYMBOL_attrsDUMMY
16617 | FFESYMBOL_attrsEXTERNAL
16618 | FFESYMBOL_attrsSFARG
)));
16622 else if (sa
== FFESYMBOL_attrsetNONE
)
16624 assert (ffesymbol_state (s
) == FFESYMBOL_stateNONE
);
16626 if (ffeintrin_is_intrinsic (ffesymbol_text (s
), t
, FALSE
,
16627 &gen
, &spec
, &imp
))
16629 ffesymbol_signal_change (s
); /* May need to back up to previous
16631 ffesymbol_set_generic (s
, gen
);
16632 ffesymbol_set_specific (s
, spec
);
16633 ffesymbol_set_implementation (s
, imp
);
16634 ffesymbol_set_info (s
,
16635 ffeinfo_new (FFEINFO_basictypeNONE
,
16636 FFEINFO_kindtypeNONE
,
16638 FFEINFO_kindSUBROUTINE
,
16639 FFEINFO_whereINTRINSIC
,
16640 FFETARGET_charactersizeNONE
));
16641 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
16642 ffesymbol_resolve_intrin (s
);
16643 ffesymbol_reference (s
, t
, FALSE
);
16644 s
= ffecom_sym_learned (s
);
16645 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
16650 kind
= FFEINFO_kindSUBROUTINE
;
16651 where
= FFEINFO_whereGLOBAL
;
16656 /* Now see what we've got for a new object: NONE means a new error cropped
16657 up; ANY means an old error to be ignored; otherwise, everything's ok,
16658 update the object (symbol) and continue on. */
16661 ffesymbol_error (s
, t
);
16662 else if (!(na
& FFESYMBOL_attrsANY
))
16664 ffesymbol_signal_change (s
); /* May need to back up to previous
16666 ffesymbol_set_info (s
,
16667 ffeinfo_new (ffesymbol_basictype (s
),
16668 ffesymbol_kindtype (s
),
16669 ffesymbol_rank (s
),
16670 kind
, /* SUBROUTINE. */
16671 where
, /* GLOBAL or DUMMY. */
16672 ffesymbol_size (s
)));
16673 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
16674 ffesymbol_resolve_intrin (s
);
16675 ffesymbol_reference (s
, t
, FALSE
);
16676 s
= ffecom_sym_learned (s
);
16677 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
16683 /* Have FOO in DATA FOO/.../. Local name space and executable context
16684 only. (This will change in the future when DATA FOO may be followed
16685 by COMMON FOO or even INTEGER FOO(10), etc.) */
16688 ffeexpr_sym_lhs_data_ (ffesymbol s
, ffelexToken t
)
16693 ffeinfoWhere where
;
16694 bool error
= FALSE
;
16696 assert ((ffesymbol_state (s
) == FFESYMBOL_stateNONE
)
16697 || (ffesymbol_state (s
) == FFESYMBOL_stateUNCERTAIN
));
16699 na
= sa
= ffesymbol_attrs (s
);
16701 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16702 | FFESYMBOL_attrsADJUSTABLE
16703 | FFESYMBOL_attrsANYLEN
16704 | FFESYMBOL_attrsARRAY
16705 | FFESYMBOL_attrsDUMMY
16706 | FFESYMBOL_attrsEXTERNAL
16707 | FFESYMBOL_attrsSFARG
16708 | FFESYMBOL_attrsTYPE
)));
16710 kind
= ffesymbol_kind (s
);
16711 where
= ffesymbol_where (s
);
16713 /* Figure out what kind of object we've got based on previous declarations
16714 of or references to the object. */
16716 if (sa
& FFESYMBOL_attrsEXTERNAL
)
16718 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16719 | FFESYMBOL_attrsDUMMY
16720 | FFESYMBOL_attrsEXTERNAL
16721 | FFESYMBOL_attrsTYPE
)));
16725 else if (sa
& FFESYMBOL_attrsDUMMY
)
16727 assert (!(sa
& FFESYMBOL_attrsEXTERNAL
)); /* Handled above. */
16728 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
16729 | FFESYMBOL_attrsEXTERNAL
16730 | FFESYMBOL_attrsTYPE
)));
16734 else if (sa
& FFESYMBOL_attrsARRAY
)
16736 assert (!(sa
& ~(FFESYMBOL_attrsARRAY
16737 | FFESYMBOL_attrsADJUSTABLE
16738 | FFESYMBOL_attrsTYPE
)));
16740 if (sa
& FFESYMBOL_attrsADJUSTABLE
)
16742 where
= FFEINFO_whereLOCAL
;
16744 else if (sa
& FFESYMBOL_attrsSFARG
)
16746 assert (!(sa
& ~(FFESYMBOL_attrsSFARG
16747 | FFESYMBOL_attrsTYPE
)));
16749 where
= FFEINFO_whereLOCAL
;
16751 else if (sa
& FFESYMBOL_attrsTYPE
)
16753 assert (!(sa
& (FFESYMBOL_attrsARRAY
16754 | FFESYMBOL_attrsDUMMY
16755 | FFESYMBOL_attrsEXTERNAL
16756 | FFESYMBOL_attrsSFARG
))); /* Handled above. */
16757 assert (!(sa
& ~(FFESYMBOL_attrsTYPE
16758 | FFESYMBOL_attrsADJUSTABLE
16759 | FFESYMBOL_attrsANYLEN
16760 | FFESYMBOL_attrsARRAY
16761 | FFESYMBOL_attrsDUMMY
16762 | FFESYMBOL_attrsEXTERNAL
16763 | FFESYMBOL_attrsSFARG
)));
16765 if (sa
& (FFESYMBOL_attrsADJUSTABLE
| FFESYMBOL_attrsANYLEN
))
16769 kind
= FFEINFO_kindENTITY
;
16770 where
= FFEINFO_whereLOCAL
;
16773 else if (sa
== FFESYMBOL_attrsetNONE
)
16775 assert (ffesymbol_state (s
) == FFESYMBOL_stateNONE
);
16776 kind
= FFEINFO_kindENTITY
;
16777 where
= FFEINFO_whereLOCAL
;
16782 /* Now see what we've got for a new object: NONE means a new error cropped
16783 up; ANY means an old error to be ignored; otherwise, everything's ok,
16784 update the object (symbol) and continue on. */
16787 ffesymbol_error (s
, t
);
16788 else if (!(na
& FFESYMBOL_attrsANY
))
16790 ffesymbol_signal_change (s
); /* May need to back up to previous
16792 if (!ffeimplic_establish_symbol (s
))
16794 ffesymbol_error (s
, t
);
16797 ffesymbol_set_info (s
,
16798 ffeinfo_new (ffesymbol_basictype (s
),
16799 ffesymbol_kindtype (s
),
16800 ffesymbol_rank (s
),
16801 kind
, /* ENTITY. */
16802 where
, /* LOCAL. */
16803 ffesymbol_size (s
)));
16804 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
16805 ffesymbol_resolve_intrin (s
);
16806 s
= ffecom_sym_learned (s
);
16807 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
16813 /* Have FOO in EQUIVALENCE (...,FOO,...). Does not include
16814 EQUIVALENCE (...,BAR(FOO),...). */
16817 ffeexpr_sym_lhs_equivalence_ (ffesymbol s
, ffelexToken t
)
16822 ffeinfoWhere where
;
16824 na
= sa
= ffesymbol_attrs (s
);
16825 kind
= FFEINFO_kindENTITY
;
16826 where
= ffesymbol_where (s
);
16828 /* Figure out what kind of object we've got based on previous declarations
16829 of or references to the object. */
16831 if (!(sa
& ~(FFESYMBOL_attrsADJUSTS
16832 | FFESYMBOL_attrsARRAY
16833 | FFESYMBOL_attrsCOMMON
16834 | FFESYMBOL_attrsEQUIV
16835 | FFESYMBOL_attrsINIT
16836 | FFESYMBOL_attrsNAMELIST
16837 | FFESYMBOL_attrsSAVE
16838 | FFESYMBOL_attrsSFARG
16839 | FFESYMBOL_attrsTYPE
)))
16840 na
= sa
| FFESYMBOL_attrsEQUIV
;
16842 na
= FFESYMBOL_attrsetNONE
;
16844 /* Don't know why we're bothering to set kind and where in this code, but
16845 added the following to make it complete, in case it's really important.
16846 Generally this is left up to symbol exec transition. */
16848 if (where
== FFEINFO_whereNONE
)
16850 if (na
& (FFESYMBOL_attrsADJUSTS
16851 | FFESYMBOL_attrsCOMMON
))
16852 where
= FFEINFO_whereCOMMON
;
16853 else if (na
& FFESYMBOL_attrsSAVE
)
16854 where
= FFEINFO_whereLOCAL
;
16857 /* Now see what we've got for a new object: NONE means a new error cropped
16858 up; ANY means an old error to be ignored; otherwise, everything's ok,
16859 update the object (symbol) and continue on. */
16861 if (na
== FFESYMBOL_attrsetNONE
)
16862 ffesymbol_error (s
, t
);
16863 else if (!(na
& FFESYMBOL_attrsANY
))
16865 ffesymbol_signal_change (s
); /* May need to back up to previous
16867 ffesymbol_set_info (s
,
16868 ffeinfo_new (ffesymbol_basictype (s
),
16869 ffesymbol_kindtype (s
),
16870 ffesymbol_rank (s
),
16871 kind
, /* Always ENTITY. */
16872 where
, /* NONE, COMMON, or LOCAL. */
16873 ffesymbol_size (s
)));
16874 ffesymbol_set_attrs (s
, na
);
16875 ffesymbol_set_state (s
, FFESYMBOL_stateSEEN
);
16876 ffesymbol_resolve_intrin (s
);
16877 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
16883 /* Have FOO in OPEN(...,USEROPEN=FOO,...). Executable context only.
16885 Note that I think this should be considered semantically similar to
16886 doing CALL XYZ(FOO), in that it should be considered like an
16887 ACTUALARG context. In particular, without EXTERNAL being specified,
16888 it should not be allowed. */
16891 ffeexpr_sym_lhs_extfunc_ (ffesymbol s
, ffelexToken t
)
16896 ffeinfoWhere where
;
16897 bool needs_type
= FALSE
;
16898 bool error
= FALSE
;
16900 assert ((ffesymbol_state (s
) == FFESYMBOL_stateNONE
)
16901 || (ffesymbol_state (s
) == FFESYMBOL_stateUNCERTAIN
));
16903 na
= sa
= ffesymbol_attrs (s
);
16905 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16906 | FFESYMBOL_attrsADJUSTABLE
16907 | FFESYMBOL_attrsANYLEN
16908 | FFESYMBOL_attrsARRAY
16909 | FFESYMBOL_attrsDUMMY
16910 | FFESYMBOL_attrsEXTERNAL
16911 | FFESYMBOL_attrsSFARG
16912 | FFESYMBOL_attrsTYPE
)));
16914 kind
= ffesymbol_kind (s
);
16915 where
= ffesymbol_where (s
);
16917 /* Figure out what kind of object we've got based on previous declarations
16918 of or references to the object. */
16920 if (sa
& FFESYMBOL_attrsEXTERNAL
)
16922 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
16923 | FFESYMBOL_attrsDUMMY
16924 | FFESYMBOL_attrsEXTERNAL
16925 | FFESYMBOL_attrsTYPE
)));
16927 if (sa
& FFESYMBOL_attrsTYPE
)
16928 where
= FFEINFO_whereGLOBAL
;
16932 kind
= FFEINFO_kindFUNCTION
;
16935 if (sa
& FFESYMBOL_attrsDUMMY
)
16937 else if (sa
& FFESYMBOL_attrsACTUALARG
)
16938 ; /* Not DUMMY or TYPE. */
16939 else /* Not ACTUALARG, DUMMY, or TYPE. */
16940 where
= FFEINFO_whereGLOBAL
;
16943 else if (sa
& FFESYMBOL_attrsDUMMY
)
16945 assert (!(sa
& FFESYMBOL_attrsEXTERNAL
)); /* Handled above. */
16946 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
16947 | FFESYMBOL_attrsEXTERNAL
16948 | FFESYMBOL_attrsTYPE
)));
16950 kind
= FFEINFO_kindFUNCTION
;
16951 if (!(sa
& FFESYMBOL_attrsTYPE
))
16954 else if (sa
& FFESYMBOL_attrsARRAY
)
16956 assert (!(sa
& ~(FFESYMBOL_attrsARRAY
16957 | FFESYMBOL_attrsADJUSTABLE
16958 | FFESYMBOL_attrsTYPE
)));
16962 else if (sa
& FFESYMBOL_attrsSFARG
)
16964 assert (!(sa
& ~(FFESYMBOL_attrsSFARG
16965 | FFESYMBOL_attrsTYPE
)));
16969 else if (sa
& FFESYMBOL_attrsTYPE
)
16971 assert (!(sa
& (FFESYMBOL_attrsARRAY
16972 | FFESYMBOL_attrsDUMMY
16973 | FFESYMBOL_attrsEXTERNAL
16974 | FFESYMBOL_attrsSFARG
))); /* Handled above. */
16975 assert (!(sa
& ~(FFESYMBOL_attrsTYPE
16976 | FFESYMBOL_attrsADJUSTABLE
16977 | FFESYMBOL_attrsANYLEN
16978 | FFESYMBOL_attrsARRAY
16979 | FFESYMBOL_attrsDUMMY
16980 | FFESYMBOL_attrsEXTERNAL
16981 | FFESYMBOL_attrsSFARG
)));
16983 if (sa
& (FFESYMBOL_attrsADJUSTABLE
| FFESYMBOL_attrsANYLEN
))
16987 kind
= FFEINFO_kindFUNCTION
;
16988 where
= FFEINFO_whereGLOBAL
;
16991 else if (sa
== FFESYMBOL_attrsetNONE
)
16993 assert (ffesymbol_state (s
) == FFESYMBOL_stateNONE
);
16994 kind
= FFEINFO_kindFUNCTION
;
16995 where
= FFEINFO_whereGLOBAL
;
17001 /* Now see what we've got for a new object: NONE means a new error cropped
17002 up; ANY means an old error to be ignored; otherwise, everything's ok,
17003 update the object (symbol) and continue on. */
17006 ffesymbol_error (s
, t
);
17007 else if (!(na
& FFESYMBOL_attrsANY
))
17009 ffesymbol_signal_change (s
); /* May need to back up to previous
17011 if (needs_type
&& !ffeimplic_establish_symbol (s
))
17013 ffesymbol_error (s
, t
);
17016 if (!ffesymbol_explicitwhere (s
))
17018 ffebad_start (FFEBAD_NEED_EXTERNAL
);
17019 ffebad_here (0, ffelex_token_where_line (t
),
17020 ffelex_token_where_column (t
));
17021 ffebad_string (ffesymbol_text (s
));
17023 ffesymbol_set_explicitwhere (s
, TRUE
);
17025 ffesymbol_set_info (s
,
17026 ffeinfo_new (ffesymbol_basictype (s
),
17027 ffesymbol_kindtype (s
),
17028 ffesymbol_rank (s
),
17029 kind
, /* FUNCTION. */
17030 where
, /* GLOBAL or DUMMY. */
17031 ffesymbol_size (s
)));
17032 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
17033 ffesymbol_resolve_intrin (s
);
17034 ffesymbol_reference (s
, t
, FALSE
);
17035 s
= ffecom_sym_learned (s
);
17036 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
17042 /* Have FOO in DATA (stuff,FOO=1,10)/.../. */
17045 ffeexpr_sym_lhs_impdoctrl_ (ffesymbol s
, ffelexToken t
)
17049 /* If the symbol isn't in the sfunc name space, pretend as though we saw a
17050 reference to it already within the imp-DO construct at this level, so as
17051 to get a symbol that is in the sfunc name space. But this is an
17052 erroneous construct, and should be caught elsewhere. */
17054 if (ffesymbol_sfdummyparent (s
) == NULL
)
17056 s
= ffeexpr_sym_impdoitem_ (s
, t
);
17057 if (ffesymbol_sfdummyparent (s
) == NULL
)
17058 { /* PARAMETER FOO...DATA (A(I),FOO=...). */
17059 ffesymbol_error (s
, t
);
17064 ss
= ffesymbol_state (s
);
17068 case FFESYMBOL_stateNONE
: /* Used as iterator already. */
17069 if (ffeexpr_level_
< ffesymbol_maxentrynum (s
))
17070 ffesymbol_error (s
, t
); /* Can't reuse dead iterator. F90 disallows
17071 this; F77 allows it but it is a stupid
17074 { /* Can use dead iterator because we're at at
17075 least a innermore (higher-numbered) level
17076 than the iterator's outermost
17077 (lowest-numbered) level. This should be
17078 diagnosed later, because it means an item
17079 in this list didn't reference this
17082 ffesymbol_error (s
, t
); /* For now, complain. */
17083 #else /* Someday will detect all cases where initializer doesn't reference
17084 all applicable iterators, in which case reenable this code. */
17085 ffesymbol_signal_change (s
);
17086 ffesymbol_set_state (s
, FFESYMBOL_stateUNCERTAIN
);
17087 ffesymbol_set_maxentrynum (s
, ffeexpr_level_
);
17088 ffesymbol_signal_unreported (s
);
17093 case FFESYMBOL_stateSEEN
: /* Seen already in this or other implied-DO.
17094 If seen in outermore level, can't be an
17095 iterator here, so complain. If not seen
17096 at current level, complain for now,
17097 because that indicates something F90
17098 rejects (though we currently don't detect
17099 all such cases for now). */
17100 if (ffeexpr_level_
<= ffesymbol_maxentrynum (s
))
17102 ffesymbol_signal_change (s
);
17103 ffesymbol_set_state (s
, FFESYMBOL_stateUNCERTAIN
);
17104 ffesymbol_signal_unreported (s
);
17107 ffesymbol_error (s
, t
);
17110 case FFESYMBOL_stateUNCERTAIN
: /* Already iterator! */
17111 assert ("DATA implied-DO control var seen twice!!" == NULL
);
17112 ffesymbol_error (s
, t
);
17115 case FFESYMBOL_stateUNDERSTOOD
:
17119 assert ("Foo Bletch!!" == NULL
);
17126 /* Have FOO in PARAMETER (FOO=...). */
17129 ffeexpr_sym_lhs_parameter_ (ffesymbol s
, ffelexToken t
)
17133 sa
= ffesymbol_attrs (s
);
17135 /* Figure out what kind of object we've got based on previous declarations
17136 of or references to the object. */
17138 if (sa
& ~(FFESYMBOL_attrsANYLEN
17139 | FFESYMBOL_attrsTYPE
))
17141 if (!(sa
& FFESYMBOL_attrsANY
))
17142 ffesymbol_error (s
, t
);
17146 ffesymbol_signal_change (s
); /* May need to back up to previous
17148 if (!ffeimplic_establish_symbol (s
))
17150 ffesymbol_error (s
, t
);
17153 ffesymbol_set_info (s
,
17154 ffeinfo_new (ffesymbol_basictype (s
),
17155 ffesymbol_kindtype (s
),
17156 ffesymbol_rank (s
),
17157 FFEINFO_kindENTITY
,
17158 FFEINFO_whereCONSTANT
,
17159 ffesymbol_size (s
)));
17160 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
17161 ffesymbol_resolve_intrin (s
);
17162 s
= ffecom_sym_learned (s
);
17163 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
17169 /* Have FOO in CALL XYZ(...,FOO,...). Does not include any other
17170 embedding of FOO, such as CALL XYZ((FOO)) or CALL XYZ(FOO+1). */
17173 ffeexpr_sym_rhs_actualarg_ (ffesymbol s
, ffelexToken t
)
17178 ffeinfoWhere where
;
17180 bool needs_type
= FALSE
;
17182 assert ((ffesymbol_state (s
) == FFESYMBOL_stateNONE
)
17183 || (ffesymbol_state (s
) == FFESYMBOL_stateUNCERTAIN
));
17185 na
= sa
= ffesymbol_attrs (s
);
17187 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
17188 | FFESYMBOL_attrsADJUSTABLE
17189 | FFESYMBOL_attrsANYLEN
17190 | FFESYMBOL_attrsARRAY
17191 | FFESYMBOL_attrsDUMMY
17192 | FFESYMBOL_attrsEXTERNAL
17193 | FFESYMBOL_attrsSFARG
17194 | FFESYMBOL_attrsTYPE
)));
17196 kind
= ffesymbol_kind (s
);
17197 where
= ffesymbol_where (s
);
17199 /* Figure out what kind of object we've got based on previous declarations
17200 of or references to the object. */
17202 ns
= FFESYMBOL_stateUNDERSTOOD
;
17204 if (sa
& FFESYMBOL_attrsEXTERNAL
)
17206 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
17207 | FFESYMBOL_attrsDUMMY
17208 | FFESYMBOL_attrsEXTERNAL
17209 | FFESYMBOL_attrsTYPE
)));
17211 if (sa
& FFESYMBOL_attrsTYPE
)
17212 where
= FFEINFO_whereGLOBAL
;
17216 ns
= FFESYMBOL_stateUNCERTAIN
;
17218 if (sa
& FFESYMBOL_attrsDUMMY
)
17219 assert (kind
== FFEINFO_kindNONE
); /* FUNCTION, SUBROUTINE. */
17220 else if (sa
& FFESYMBOL_attrsACTUALARG
)
17221 ; /* Not DUMMY or TYPE. */
17223 /* Not ACTUALARG, DUMMY, or TYPE. */
17225 assert (kind
== FFEINFO_kindNONE
); /* FUNCTION, SUBROUTINE. */
17226 na
|= FFESYMBOL_attrsACTUALARG
;
17227 where
= FFEINFO_whereGLOBAL
;
17231 else if (sa
& FFESYMBOL_attrsDUMMY
)
17233 assert (!(sa
& FFESYMBOL_attrsEXTERNAL
)); /* Handled above. */
17234 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
17235 | FFESYMBOL_attrsEXTERNAL
17236 | FFESYMBOL_attrsTYPE
)));
17238 kind
= FFEINFO_kindENTITY
;
17239 if (!(sa
& FFESYMBOL_attrsTYPE
))
17242 else if (sa
& FFESYMBOL_attrsARRAY
)
17244 assert (!(sa
& ~(FFESYMBOL_attrsARRAY
17245 | FFESYMBOL_attrsADJUSTABLE
17246 | FFESYMBOL_attrsTYPE
)));
17248 where
= FFEINFO_whereLOCAL
;
17250 else if (sa
& FFESYMBOL_attrsSFARG
)
17252 assert (!(sa
& ~(FFESYMBOL_attrsSFARG
17253 | FFESYMBOL_attrsTYPE
)));
17255 where
= FFEINFO_whereLOCAL
;
17257 else if (sa
& FFESYMBOL_attrsTYPE
)
17259 assert (!(sa
& (FFESYMBOL_attrsARRAY
17260 | FFESYMBOL_attrsDUMMY
17261 | FFESYMBOL_attrsEXTERNAL
17262 | FFESYMBOL_attrsSFARG
))); /* Handled above. */
17263 assert (!(sa
& ~(FFESYMBOL_attrsTYPE
17264 | FFESYMBOL_attrsADJUSTABLE
17265 | FFESYMBOL_attrsANYLEN
17266 | FFESYMBOL_attrsARRAY
17267 | FFESYMBOL_attrsDUMMY
17268 | FFESYMBOL_attrsEXTERNAL
17269 | FFESYMBOL_attrsSFARG
)));
17271 if (sa
& FFESYMBOL_attrsANYLEN
)
17272 ns
= FFESYMBOL_stateNONE
;
17275 kind
= FFEINFO_kindENTITY
;
17276 where
= FFEINFO_whereLOCAL
;
17279 else if (sa
== FFESYMBOL_attrsetNONE
)
17281 /* New state is left empty because there isn't any state flag to
17282 set for this case, and it's UNDERSTOOD after all. */
17283 assert (ffesymbol_state (s
) == FFESYMBOL_stateNONE
);
17284 kind
= FFEINFO_kindENTITY
;
17285 where
= FFEINFO_whereLOCAL
;
17289 ns
= FFESYMBOL_stateNONE
; /* Error. */
17291 /* Now see what we've got for a new object: NONE means a new error cropped
17292 up; ANY means an old error to be ignored; otherwise, everything's ok,
17293 update the object (symbol) and continue on. */
17295 if (ns
== FFESYMBOL_stateNONE
)
17296 ffesymbol_error (s
, t
);
17297 else if (!(na
& FFESYMBOL_attrsANY
))
17299 ffesymbol_signal_change (s
); /* May need to back up to previous
17301 if (needs_type
&& !ffeimplic_establish_symbol (s
))
17303 ffesymbol_error (s
, t
);
17306 ffesymbol_set_info (s
,
17307 ffeinfo_new (ffesymbol_basictype (s
),
17308 ffesymbol_kindtype (s
),
17309 ffesymbol_rank (s
),
17312 ffesymbol_size (s
)));
17313 ffesymbol_set_attrs (s
, na
);
17314 ffesymbol_set_state (s
, ns
);
17315 s
= ffecom_sym_learned (s
);
17316 ffesymbol_reference (s
, t
, FALSE
);
17317 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
17323 /* Have FOO in DIMENSION XYZ(FOO) or any array declarator containing
17324 a reference to FOO. */
17327 ffeexpr_sym_rhs_dimlist_ (ffesymbol s
, ffelexToken t
)
17332 ffeinfoWhere where
;
17334 na
= sa
= ffesymbol_attrs (s
);
17335 kind
= FFEINFO_kindENTITY
;
17336 where
= ffesymbol_where (s
);
17338 /* Figure out what kind of object we've got based on previous declarations
17339 of or references to the object. */
17341 if (!(sa
& ~(FFESYMBOL_attrsADJUSTS
17342 | FFESYMBOL_attrsCOMMON
17343 | FFESYMBOL_attrsDUMMY
17344 | FFESYMBOL_attrsEQUIV
17345 | FFESYMBOL_attrsINIT
17346 | FFESYMBOL_attrsNAMELIST
17347 | FFESYMBOL_attrsSFARG
17348 | FFESYMBOL_attrsARRAY
17349 | FFESYMBOL_attrsTYPE
)))
17350 na
= sa
| FFESYMBOL_attrsADJUSTS
;
17352 na
= FFESYMBOL_attrsetNONE
;
17354 /* Since this symbol definitely is going into an expression (the
17355 dimension-list for some dummy array, presumably), figure out WHERE if
17358 if (where
== FFEINFO_whereNONE
)
17360 if (na
& (FFESYMBOL_attrsCOMMON
17361 | FFESYMBOL_attrsEQUIV
17362 | FFESYMBOL_attrsINIT
17363 | FFESYMBOL_attrsNAMELIST
))
17364 where
= FFEINFO_whereCOMMON
;
17365 else if (na
& FFESYMBOL_attrsDUMMY
)
17366 where
= FFEINFO_whereDUMMY
;
17369 /* Now see what we've got for a new object: NONE means a new error cropped
17370 up; ANY means an old error to be ignored; otherwise, everything's ok,
17371 update the object (symbol) and continue on. */
17373 if (na
== FFESYMBOL_attrsetNONE
)
17374 ffesymbol_error (s
, t
);
17375 else if (!(na
& FFESYMBOL_attrsANY
))
17377 ffesymbol_signal_change (s
); /* May need to back up to previous
17379 if (!ffeimplic_establish_symbol (s
))
17381 ffesymbol_error (s
, t
);
17384 ffesymbol_set_info (s
,
17385 ffeinfo_new (ffesymbol_basictype (s
),
17386 ffesymbol_kindtype (s
),
17387 ffesymbol_rank (s
),
17388 kind
, /* Always ENTITY. */
17389 where
, /* NONE, COMMON, or DUMMY. */
17390 ffesymbol_size (s
)));
17391 ffesymbol_set_attrs (s
, na
);
17392 ffesymbol_set_state (s
, FFESYMBOL_stateSEEN
);
17393 ffesymbol_resolve_intrin (s
);
17394 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
17400 /* Have FOO in XYZ = ...FOO.... Does not include cases like FOO in
17401 XYZ = BAR(FOO), as such cases are handled elsewhere. */
17404 ffeexpr_sym_rhs_let_ (ffesymbol s
, ffelexToken t
)
17409 ffeinfoWhere where
;
17410 bool error
= FALSE
;
17412 assert ((ffesymbol_state (s
) == FFESYMBOL_stateNONE
)
17413 || (ffesymbol_state (s
) == FFESYMBOL_stateUNCERTAIN
));
17415 na
= sa
= ffesymbol_attrs (s
);
17417 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
17418 | FFESYMBOL_attrsADJUSTABLE
17419 | FFESYMBOL_attrsANYLEN
17420 | FFESYMBOL_attrsARRAY
17421 | FFESYMBOL_attrsDUMMY
17422 | FFESYMBOL_attrsEXTERNAL
17423 | FFESYMBOL_attrsSFARG
17424 | FFESYMBOL_attrsTYPE
)));
17426 kind
= ffesymbol_kind (s
);
17427 where
= ffesymbol_where (s
);
17429 /* Figure out what kind of object we've got based on previous declarations
17430 of or references to the object. */
17432 if (sa
& FFESYMBOL_attrsEXTERNAL
)
17434 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
17435 | FFESYMBOL_attrsDUMMY
17436 | FFESYMBOL_attrsEXTERNAL
17437 | FFESYMBOL_attrsTYPE
)));
17441 else if (sa
& FFESYMBOL_attrsDUMMY
)
17443 assert (!(sa
& FFESYMBOL_attrsEXTERNAL
)); /* Handled above. */
17444 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
17445 | FFESYMBOL_attrsEXTERNAL
17446 | FFESYMBOL_attrsTYPE
)));
17448 kind
= FFEINFO_kindENTITY
;
17450 else if (sa
& FFESYMBOL_attrsARRAY
)
17452 assert (!(sa
& ~(FFESYMBOL_attrsARRAY
17453 | FFESYMBOL_attrsADJUSTABLE
17454 | FFESYMBOL_attrsTYPE
)));
17456 where
= FFEINFO_whereLOCAL
;
17458 else if (sa
& FFESYMBOL_attrsSFARG
)
17460 assert (!(sa
& ~(FFESYMBOL_attrsSFARG
17461 | FFESYMBOL_attrsTYPE
)));
17463 where
= FFEINFO_whereLOCAL
;
17465 else if (sa
& FFESYMBOL_attrsTYPE
)
17467 assert (!(sa
& (FFESYMBOL_attrsARRAY
17468 | FFESYMBOL_attrsDUMMY
17469 | FFESYMBOL_attrsEXTERNAL
17470 | FFESYMBOL_attrsSFARG
))); /* Handled above. */
17471 assert (!(sa
& ~(FFESYMBOL_attrsTYPE
17472 | FFESYMBOL_attrsADJUSTABLE
17473 | FFESYMBOL_attrsANYLEN
17474 | FFESYMBOL_attrsARRAY
17475 | FFESYMBOL_attrsDUMMY
17476 | FFESYMBOL_attrsEXTERNAL
17477 | FFESYMBOL_attrsSFARG
)));
17479 if (sa
& FFESYMBOL_attrsANYLEN
)
17483 kind
= FFEINFO_kindENTITY
;
17484 where
= FFEINFO_whereLOCAL
;
17487 else if (sa
== FFESYMBOL_attrsetNONE
)
17489 assert (ffesymbol_state (s
) == FFESYMBOL_stateNONE
);
17490 kind
= FFEINFO_kindENTITY
;
17491 where
= FFEINFO_whereLOCAL
;
17496 /* Now see what we've got for a new object: NONE means a new error cropped
17497 up; ANY means an old error to be ignored; otherwise, everything's ok,
17498 update the object (symbol) and continue on. */
17501 ffesymbol_error (s
, t
);
17502 else if (!(na
& FFESYMBOL_attrsANY
))
17504 ffesymbol_signal_change (s
); /* May need to back up to previous
17506 if (!ffeimplic_establish_symbol (s
))
17508 ffesymbol_error (s
, t
);
17511 ffesymbol_set_info (s
,
17512 ffeinfo_new (ffesymbol_basictype (s
),
17513 ffesymbol_kindtype (s
),
17514 ffesymbol_rank (s
),
17515 kind
, /* ENTITY. */
17516 where
, /* LOCAL. */
17517 ffesymbol_size (s
)));
17518 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
17519 ffesymbol_resolve_intrin (s
);
17520 s
= ffecom_sym_learned (s
);
17521 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
17527 /* ffeexpr_declare_parenthesized_ -- ffesymbol wrapper for NAME(...) operand
17531 ffeexprParenType_ paren_type;
17533 s = ffeexpr_declare_parenthesized_ (t, maybe_intrin, &paren_type);
17535 Just like ffesymbol_declare_local, except performs any implicit info
17536 assignment necessary, and it returns the type of the parenthesized list
17537 (list of function args, list of array args, or substring spec). */
17540 ffeexpr_declare_parenthesized_ (ffelexToken t
, bool maybe_intrin
,
17541 ffeexprParenType_
*paren_type
)
17544 ffesymbolState st
; /* Effective state. */
17548 if (maybe_intrin
&& ffesrc_check_symbol ())
17549 { /* Knock off some easy cases. */
17550 switch (ffeexpr_stack_
->context
)
17552 case FFEEXPR_contextSUBROUTINEREF
:
17553 case FFEEXPR_contextDATA
:
17554 case FFEEXPR_contextDATAIMPDOINDEX_
:
17555 case FFEEXPR_contextSFUNCDEF
:
17556 case FFEEXPR_contextSFUNCDEFINDEX_
:
17557 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
17558 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
17559 case FFEEXPR_contextLET
:
17560 case FFEEXPR_contextPAREN_
:
17561 case FFEEXPR_contextACTUALARGEXPR_
:
17562 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
17563 case FFEEXPR_contextIOLIST
:
17564 case FFEEXPR_contextIOLISTDF
:
17565 case FFEEXPR_contextDO
:
17566 case FFEEXPR_contextDOWHILE
:
17567 case FFEEXPR_contextACTUALARG_
:
17568 case FFEEXPR_contextCGOTO
:
17569 case FFEEXPR_contextIF
:
17570 case FFEEXPR_contextARITHIF
:
17571 case FFEEXPR_contextFORMAT
:
17572 case FFEEXPR_contextSTOP
:
17573 case FFEEXPR_contextRETURN
:
17574 case FFEEXPR_contextSELECTCASE
:
17575 case FFEEXPR_contextCASE
:
17576 case FFEEXPR_contextFILEASSOC
:
17577 case FFEEXPR_contextFILEINT
:
17578 case FFEEXPR_contextFILEDFINT
:
17579 case FFEEXPR_contextFILELOG
:
17580 case FFEEXPR_contextFILENUM
:
17581 case FFEEXPR_contextFILENUMAMBIG
:
17582 case FFEEXPR_contextFILECHAR
:
17583 case FFEEXPR_contextFILENUMCHAR
:
17584 case FFEEXPR_contextFILEDFCHAR
:
17585 case FFEEXPR_contextFILEKEY
:
17586 case FFEEXPR_contextFILEUNIT
:
17587 case FFEEXPR_contextFILEUNIT_DF
:
17588 case FFEEXPR_contextFILEUNITAMBIG
:
17589 case FFEEXPR_contextFILEFORMAT
:
17590 case FFEEXPR_contextFILENAMELIST
:
17591 case FFEEXPR_contextFILEVXTCODE
:
17592 case FFEEXPR_contextINDEX_
:
17593 case FFEEXPR_contextIMPDOITEM_
:
17594 case FFEEXPR_contextIMPDOITEMDF_
:
17595 case FFEEXPR_contextIMPDOCTRL_
:
17596 case FFEEXPR_contextDATAIMPDOCTRL_
:
17597 case FFEEXPR_contextCHARACTERSIZE
:
17598 case FFEEXPR_contextPARAMETER
:
17599 case FFEEXPR_contextDIMLIST
:
17600 case FFEEXPR_contextDIMLISTCOMMON
:
17601 case FFEEXPR_contextKINDTYPE
:
17602 case FFEEXPR_contextINITVAL
:
17603 case FFEEXPR_contextEQVINDEX_
:
17604 break; /* These could be intrinsic invocations. */
17606 case FFEEXPR_contextAGOTO
:
17607 case FFEEXPR_contextFILEFORMATNML
:
17608 case FFEEXPR_contextALLOCATE
:
17609 case FFEEXPR_contextDEALLOCATE
:
17610 case FFEEXPR_contextHEAPSTAT
:
17611 case FFEEXPR_contextNULLIFY
:
17612 case FFEEXPR_contextINCLUDE
:
17613 case FFEEXPR_contextDATAIMPDOITEM_
:
17614 case FFEEXPR_contextLOC_
:
17615 case FFEEXPR_contextINDEXORACTUALARG_
:
17616 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
17617 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
17618 case FFEEXPR_contextPARENFILENUM_
:
17619 case FFEEXPR_contextPARENFILEUNIT_
:
17620 maybe_intrin
= FALSE
;
17621 break; /* Can't be intrinsic invocation. */
17624 assert ("blah! blah! waaauuggh!" == NULL
);
17629 s
= ffesymbol_declare_local (t
, maybe_intrin
);
17631 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
17632 /* Special-case these since they can involve a different concept
17633 of "state" (in the stmtfunc name space). */
17635 case FFEEXPR_contextDATAIMPDOINDEX_
:
17636 case FFEEXPR_contextDATAIMPDOCTRL_
:
17637 if (ffeexpr_context_outer_ (ffeexpr_stack_
)
17638 == FFEEXPR_contextDATAIMPDOINDEX_
)
17639 s
= ffeexpr_sym_impdoitem_ (s
, t
);
17641 if (ffeexpr_stack_
->is_rhs
)
17642 s
= ffeexpr_sym_impdoitem_ (s
, t
);
17644 s
= ffeexpr_sym_lhs_impdoctrl_ (s
, t
);
17645 if (ffesymbol_kind (s
) != FFEINFO_kindANY
)
17646 ffesymbol_error (s
, t
);
17653 switch ((ffesymbol_sfdummyparent (s
) == NULL
)
17654 ? ffesymbol_state (s
)
17655 : FFESYMBOL_stateUNDERSTOOD
)
17657 case FFESYMBOL_stateNONE
: /* Before first exec, not seen in expr
17659 if (!ffest_seen_first_exec ())
17660 goto seen
; /* :::::::::::::::::::: */
17661 /* Fall through. */
17662 case FFESYMBOL_stateUNCERTAIN
: /* Unseen since first exec. */
17663 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
17665 case FFEEXPR_contextSUBROUTINEREF
:
17666 s
= ffeexpr_sym_lhs_call_ (s
, t
); /* "CALL FOO"=="CALL
17670 case FFEEXPR_contextDATA
:
17671 if (ffeexpr_stack_
->is_rhs
)
17672 s
= ffeexpr_sym_rhs_let_ (s
, t
);
17674 s
= ffeexpr_sym_lhs_data_ (s
, t
);
17677 case FFEEXPR_contextDATAIMPDOITEM_
:
17678 s
= ffeexpr_sym_lhs_data_ (s
, t
);
17681 case FFEEXPR_contextSFUNCDEF
:
17682 case FFEEXPR_contextSFUNCDEFINDEX_
:
17683 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
17684 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
17685 s
= ffecom_sym_exec_transition (s
);
17686 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
17687 goto understood
; /* :::::::::::::::::::: */
17688 /* Fall through. */
17689 case FFEEXPR_contextLET
:
17690 case FFEEXPR_contextPAREN_
:
17691 case FFEEXPR_contextACTUALARGEXPR_
:
17692 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
17693 case FFEEXPR_contextIOLIST
:
17694 case FFEEXPR_contextIOLISTDF
:
17695 case FFEEXPR_contextDO
:
17696 case FFEEXPR_contextDOWHILE
:
17697 case FFEEXPR_contextACTUALARG_
:
17698 case FFEEXPR_contextCGOTO
:
17699 case FFEEXPR_contextIF
:
17700 case FFEEXPR_contextARITHIF
:
17701 case FFEEXPR_contextFORMAT
:
17702 case FFEEXPR_contextSTOP
:
17703 case FFEEXPR_contextRETURN
:
17704 case FFEEXPR_contextSELECTCASE
:
17705 case FFEEXPR_contextCASE
:
17706 case FFEEXPR_contextFILEASSOC
:
17707 case FFEEXPR_contextFILEINT
:
17708 case FFEEXPR_contextFILEDFINT
:
17709 case FFEEXPR_contextFILELOG
:
17710 case FFEEXPR_contextFILENUM
:
17711 case FFEEXPR_contextFILENUMAMBIG
:
17712 case FFEEXPR_contextFILECHAR
:
17713 case FFEEXPR_contextFILENUMCHAR
:
17714 case FFEEXPR_contextFILEDFCHAR
:
17715 case FFEEXPR_contextFILEKEY
:
17716 case FFEEXPR_contextFILEUNIT
:
17717 case FFEEXPR_contextFILEUNIT_DF
:
17718 case FFEEXPR_contextFILEUNITAMBIG
:
17719 case FFEEXPR_contextFILEFORMAT
:
17720 case FFEEXPR_contextFILENAMELIST
:
17721 case FFEEXPR_contextFILEVXTCODE
:
17722 case FFEEXPR_contextINDEX_
:
17723 case FFEEXPR_contextIMPDOITEM_
:
17724 case FFEEXPR_contextIMPDOITEMDF_
:
17725 case FFEEXPR_contextIMPDOCTRL_
:
17726 case FFEEXPR_contextLOC_
:
17727 if (ffeexpr_stack_
->is_rhs
)
17728 s
= ffeexpr_paren_rhs_let_ (s
, t
);
17730 s
= ffeexpr_paren_lhs_let_ (s
, t
);
17733 case FFEEXPR_contextASSIGN
:
17734 case FFEEXPR_contextAGOTO
:
17735 case FFEEXPR_contextCHARACTERSIZE
:
17736 case FFEEXPR_contextEQUIVALENCE
:
17737 case FFEEXPR_contextINCLUDE
:
17738 case FFEEXPR_contextPARAMETER
:
17739 case FFEEXPR_contextDIMLIST
:
17740 case FFEEXPR_contextDIMLISTCOMMON
:
17741 case FFEEXPR_contextKINDTYPE
:
17742 case FFEEXPR_contextINITVAL
:
17743 case FFEEXPR_contextEQVINDEX_
:
17744 break; /* Will turn into errors below. */
17747 ffesymbol_error (s
, t
);
17750 /* Fall through. */
17751 case FFESYMBOL_stateUNDERSTOOD
: /* Nothing much more to learn. */
17752 understood
: /* :::::::::::::::::::: */
17754 /* State might have changed, update it. */
17755 st
= ((ffesymbol_sfdummyparent (s
) == NULL
)
17756 ? ffesymbol_state (s
)
17757 : FFESYMBOL_stateUNDERSTOOD
);
17759 k
= ffesymbol_kind (s
);
17760 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
17762 case FFEEXPR_contextSUBROUTINEREF
:
17763 bad
= ((k
!= FFEINFO_kindSUBROUTINE
)
17764 && ((ffesymbol_where (s
) != FFEINFO_whereINTRINSIC
)
17765 || (k
!= FFEINFO_kindNONE
)));
17768 case FFEEXPR_contextDATA
:
17769 if (ffeexpr_stack_
->is_rhs
)
17770 bad
= (k
!= FFEINFO_kindENTITY
)
17771 || (ffesymbol_where (s
) != FFEINFO_whereCONSTANT
);
17773 bad
= (k
!= FFEINFO_kindENTITY
)
17774 || ((ffesymbol_where (s
) != FFEINFO_whereNONE
)
17775 && (ffesymbol_where (s
) != FFEINFO_whereLOCAL
)
17776 && (ffesymbol_where (s
) != FFEINFO_whereCOMMON
));
17779 case FFEEXPR_contextDATAIMPDOITEM_
:
17780 bad
= (k
!= FFEINFO_kindENTITY
) || (ffesymbol_rank (s
) == 0)
17781 || ((ffesymbol_where (s
) != FFEINFO_whereNONE
)
17782 && (ffesymbol_where (s
) != FFEINFO_whereLOCAL
)
17783 && (ffesymbol_where (s
) != FFEINFO_whereCOMMON
));
17786 case FFEEXPR_contextSFUNCDEF
:
17787 case FFEEXPR_contextSFUNCDEFINDEX_
:
17788 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
17789 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
17790 case FFEEXPR_contextLET
:
17791 case FFEEXPR_contextPAREN_
:
17792 case FFEEXPR_contextACTUALARGEXPR_
:
17793 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
17794 case FFEEXPR_contextIOLIST
:
17795 case FFEEXPR_contextIOLISTDF
:
17796 case FFEEXPR_contextDO
:
17797 case FFEEXPR_contextDOWHILE
:
17798 case FFEEXPR_contextACTUALARG_
:
17799 case FFEEXPR_contextCGOTO
:
17800 case FFEEXPR_contextIF
:
17801 case FFEEXPR_contextARITHIF
:
17802 case FFEEXPR_contextFORMAT
:
17803 case FFEEXPR_contextSTOP
:
17804 case FFEEXPR_contextRETURN
:
17805 case FFEEXPR_contextSELECTCASE
:
17806 case FFEEXPR_contextCASE
:
17807 case FFEEXPR_contextFILEASSOC
:
17808 case FFEEXPR_contextFILEINT
:
17809 case FFEEXPR_contextFILEDFINT
:
17810 case FFEEXPR_contextFILELOG
:
17811 case FFEEXPR_contextFILENUM
:
17812 case FFEEXPR_contextFILENUMAMBIG
:
17813 case FFEEXPR_contextFILECHAR
:
17814 case FFEEXPR_contextFILENUMCHAR
:
17815 case FFEEXPR_contextFILEDFCHAR
:
17816 case FFEEXPR_contextFILEKEY
:
17817 case FFEEXPR_contextFILEUNIT
:
17818 case FFEEXPR_contextFILEUNIT_DF
:
17819 case FFEEXPR_contextFILEUNITAMBIG
:
17820 case FFEEXPR_contextFILEFORMAT
:
17821 case FFEEXPR_contextFILENAMELIST
:
17822 case FFEEXPR_contextFILEVXTCODE
:
17823 case FFEEXPR_contextINDEX_
:
17824 case FFEEXPR_contextIMPDOITEM_
:
17825 case FFEEXPR_contextIMPDOITEMDF_
:
17826 case FFEEXPR_contextIMPDOCTRL_
:
17827 case FFEEXPR_contextLOC_
:
17828 bad
= FALSE
; /* Let paren-switch handle the cases. */
17831 case FFEEXPR_contextASSIGN
:
17832 case FFEEXPR_contextAGOTO
:
17833 case FFEEXPR_contextCHARACTERSIZE
:
17834 case FFEEXPR_contextEQUIVALENCE
:
17835 case FFEEXPR_contextPARAMETER
:
17836 case FFEEXPR_contextDIMLIST
:
17837 case FFEEXPR_contextDIMLISTCOMMON
:
17838 case FFEEXPR_contextKINDTYPE
:
17839 case FFEEXPR_contextINITVAL
:
17840 case FFEEXPR_contextEQVINDEX_
:
17841 bad
= (k
!= FFEINFO_kindENTITY
)
17842 || (ffesymbol_where (s
) != FFEINFO_whereCONSTANT
);
17845 case FFEEXPR_contextINCLUDE
:
17854 switch (bad
? FFEINFO_kindANY
: k
)
17856 case FFEINFO_kindNONE
: /* Case "CHARACTER X,Y; Y=X(?". */
17857 if (ffesymbol_where (s
) == FFEINFO_whereINTRINSIC
)
17859 if (ffeexpr_context_outer_ (ffeexpr_stack_
)
17860 == FFEEXPR_contextSUBROUTINEREF
)
17861 *paren_type
= FFEEXPR_parentypeSUBROUTINE_
;
17863 *paren_type
= FFEEXPR_parentypeFUNCTION_
;
17866 if (st
== FFESYMBOL_stateUNDERSTOOD
)
17869 *paren_type
= FFEEXPR_parentypeANY_
;
17872 *paren_type
= FFEEXPR_parentypeFUNSUBSTR_
;
17875 case FFEINFO_kindFUNCTION
:
17876 *paren_type
= FFEEXPR_parentypeFUNCTION_
;
17877 switch (ffesymbol_where (s
))
17879 case FFEINFO_whereLOCAL
:
17880 bad
= TRUE
; /* Attempt to recurse! */
17883 case FFEINFO_whereCONSTANT
:
17884 bad
= ((ffesymbol_sfexpr (s
) == NULL
)
17885 || (ffebld_op (ffesymbol_sfexpr (s
))
17886 == FFEBLD_opANY
)); /* Attempt to recurse! */
17894 case FFEINFO_kindSUBROUTINE
:
17895 if ((ffeexpr_stack_
->context
!= FFEEXPR_contextSUBROUTINEREF
)
17896 || (ffeexpr_stack_
->previous
!= NULL
))
17899 *paren_type
= FFEEXPR_parentypeANY_
;
17903 *paren_type
= FFEEXPR_parentypeSUBROUTINE_
;
17904 switch (ffesymbol_where (s
))
17906 case FFEINFO_whereLOCAL
:
17907 case FFEINFO_whereCONSTANT
:
17908 bad
= TRUE
; /* Attempt to recurse! */
17916 case FFEINFO_kindENTITY
:
17917 if (ffesymbol_rank (s
) == 0)
17919 if (ffesymbol_basictype (s
) == FFEINFO_basictypeCHARACTER
)
17920 *paren_type
= FFEEXPR_parentypeSUBSTRING_
;
17924 *paren_type
= FFEEXPR_parentypeANY_
;
17928 *paren_type
= FFEEXPR_parentypeARRAY_
;
17932 case FFEINFO_kindANY
:
17934 *paren_type
= FFEEXPR_parentypeANY_
;
17940 if (k
== FFEINFO_kindANY
)
17943 ffesymbol_error (s
, t
);
17948 case FFESYMBOL_stateSEEN
: /* Seen but not yet in exec portion. */
17949 seen
: /* :::::::::::::::::::: */
17951 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
17953 case FFEEXPR_contextPARAMETER
:
17954 if (ffeexpr_stack_
->is_rhs
)
17955 ffesymbol_error (s
, t
);
17957 s
= ffeexpr_sym_lhs_parameter_ (s
, t
);
17960 case FFEEXPR_contextDATA
:
17961 s
= ffecom_sym_exec_transition (s
);
17962 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
17963 goto understood
; /* :::::::::::::::::::: */
17964 if (ffeexpr_stack_
->is_rhs
)
17965 ffesymbol_error (s
, t
);
17967 s
= ffeexpr_sym_lhs_data_ (s
, t
);
17968 goto understood
; /* :::::::::::::::::::: */
17970 case FFEEXPR_contextDATAIMPDOITEM_
:
17971 s
= ffecom_sym_exec_transition (s
);
17972 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
17973 goto understood
; /* :::::::::::::::::::: */
17974 s
= ffeexpr_sym_lhs_data_ (s
, t
);
17975 goto understood
; /* :::::::::::::::::::: */
17977 case FFEEXPR_contextEQUIVALENCE
:
17978 s
= ffeexpr_sym_lhs_equivalence_ (s
, t
);
17982 case FFEEXPR_contextDIMLIST
:
17983 s
= ffeexpr_sym_rhs_dimlist_ (s
, t
);
17987 case FFEEXPR_contextCHARACTERSIZE
:
17988 case FFEEXPR_contextKINDTYPE
:
17989 case FFEEXPR_contextDIMLISTCOMMON
:
17990 case FFEEXPR_contextINITVAL
:
17991 case FFEEXPR_contextEQVINDEX_
:
17994 case FFEEXPR_contextINCLUDE
:
17997 case FFEEXPR_contextINDEX_
:
17998 case FFEEXPR_contextACTUALARGEXPR_
:
17999 case FFEEXPR_contextINDEXORACTUALARGEXPR_
:
18000 case FFEEXPR_contextSFUNCDEF
:
18001 case FFEEXPR_contextSFUNCDEFINDEX_
:
18002 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
18003 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
18004 assert (ffeexpr_stack_
->is_rhs
);
18005 s
= ffecom_sym_exec_transition (s
);
18006 if (ffesymbol_state (s
) == FFESYMBOL_stateUNDERSTOOD
)
18007 goto understood
; /* :::::::::::::::::::: */
18008 s
= ffeexpr_paren_rhs_let_ (s
, t
);
18009 goto understood
; /* :::::::::::::::::::: */
18014 k
= ffesymbol_kind (s
);
18015 switch (bad
? FFEINFO_kindANY
: k
)
18017 case FFEINFO_kindNONE
: /* Case "CHARACTER X,Y; Y=X(?". */
18018 *paren_type
= FFEEXPR_parentypeFUNSUBSTR_
;
18021 case FFEINFO_kindFUNCTION
:
18022 *paren_type
= FFEEXPR_parentypeFUNCTION_
;
18023 switch (ffesymbol_where (s
))
18025 case FFEINFO_whereLOCAL
:
18026 bad
= TRUE
; /* Attempt to recurse! */
18029 case FFEINFO_whereCONSTANT
:
18030 bad
= ((ffesymbol_sfexpr (s
) == NULL
)
18031 || (ffebld_op (ffesymbol_sfexpr (s
))
18032 == FFEBLD_opANY
)); /* Attempt to recurse! */
18040 case FFEINFO_kindSUBROUTINE
:
18041 *paren_type
= FFEEXPR_parentypeANY_
;
18042 bad
= TRUE
; /* Cannot possibly be in
18043 contextSUBROUTINEREF. */
18046 case FFEINFO_kindENTITY
:
18047 if (ffesymbol_rank (s
) == 0)
18049 if (ffeexpr_stack_
->context
== FFEEXPR_contextEQUIVALENCE
)
18050 *paren_type
= FFEEXPR_parentypeEQUIVALENCE_
;
18051 else if (ffesymbol_basictype (s
) == FFEINFO_basictypeCHARACTER
)
18052 *paren_type
= FFEEXPR_parentypeSUBSTRING_
;
18056 *paren_type
= FFEEXPR_parentypeANY_
;
18060 *paren_type
= FFEEXPR_parentypeARRAY_
;
18064 case FFEINFO_kindANY
:
18066 *paren_type
= FFEEXPR_parentypeANY_
;
18072 if (k
== FFEINFO_kindANY
)
18075 ffesymbol_error (s
, t
);
18081 assert ("bad symbol state" == NULL
);
18086 /* Have FOO in XYZ = ...FOO(...).... Executable context only. */
18089 ffeexpr_paren_rhs_let_ (ffesymbol s
, ffelexToken t
)
18094 ffeinfoWhere where
;
18096 ffeintrinSpec spec
;
18098 bool maybe_ambig
= FALSE
;
18099 bool error
= FALSE
;
18101 assert ((ffesymbol_state (s
) == FFESYMBOL_stateNONE
)
18102 || (ffesymbol_state (s
) == FFESYMBOL_stateUNCERTAIN
));
18104 na
= sa
= ffesymbol_attrs (s
);
18106 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
18107 | FFESYMBOL_attrsADJUSTABLE
18108 | FFESYMBOL_attrsANYLEN
18109 | FFESYMBOL_attrsARRAY
18110 | FFESYMBOL_attrsDUMMY
18111 | FFESYMBOL_attrsEXTERNAL
18112 | FFESYMBOL_attrsSFARG
18113 | FFESYMBOL_attrsTYPE
)));
18115 kind
= ffesymbol_kind (s
);
18116 where
= ffesymbol_where (s
);
18118 /* Figure out what kind of object we've got based on previous declarations
18119 of or references to the object. */
18121 if (sa
& FFESYMBOL_attrsEXTERNAL
)
18123 assert (!(sa
& ~(FFESYMBOL_attrsACTUALARG
18124 | FFESYMBOL_attrsDUMMY
18125 | FFESYMBOL_attrsEXTERNAL
18126 | FFESYMBOL_attrsTYPE
)));
18128 if (sa
& FFESYMBOL_attrsTYPE
)
18129 where
= FFEINFO_whereGLOBAL
;
18133 kind
= FFEINFO_kindFUNCTION
;
18135 if (sa
& FFESYMBOL_attrsDUMMY
)
18137 else if (sa
& FFESYMBOL_attrsACTUALARG
)
18138 ; /* Not DUMMY or TYPE. */
18139 else /* Not ACTUALARG, DUMMY, or TYPE. */
18140 where
= FFEINFO_whereGLOBAL
;
18143 else if (sa
& FFESYMBOL_attrsDUMMY
)
18145 assert (!(sa
& FFESYMBOL_attrsEXTERNAL
)); /* Handled above. */
18146 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
18147 | FFESYMBOL_attrsEXTERNAL
18148 | FFESYMBOL_attrsTYPE
)));
18150 kind
= FFEINFO_kindFUNCTION
;
18151 maybe_ambig
= TRUE
; /* If basictypeCHARACTER, can't be sure; kind
18152 could be ENTITY w/substring ref. */
18154 else if (sa
& FFESYMBOL_attrsARRAY
)
18156 assert (!(sa
& ~(FFESYMBOL_attrsARRAY
18157 | FFESYMBOL_attrsADJUSTABLE
18158 | FFESYMBOL_attrsTYPE
)));
18160 where
= FFEINFO_whereLOCAL
;
18162 else if (sa
& FFESYMBOL_attrsSFARG
)
18164 assert (!(sa
& ~(FFESYMBOL_attrsSFARG
18165 | FFESYMBOL_attrsTYPE
)));
18167 where
= FFEINFO_whereLOCAL
; /* Actually an error, but at least we
18168 know it's a local var. */
18170 else if (sa
& FFESYMBOL_attrsTYPE
)
18172 assert (!(sa
& (FFESYMBOL_attrsARRAY
18173 | FFESYMBOL_attrsDUMMY
18174 | FFESYMBOL_attrsEXTERNAL
18175 | FFESYMBOL_attrsSFARG
))); /* Handled above. */
18176 assert (!(sa
& ~(FFESYMBOL_attrsTYPE
18177 | FFESYMBOL_attrsADJUSTABLE
18178 | FFESYMBOL_attrsANYLEN
18179 | FFESYMBOL_attrsARRAY
18180 | FFESYMBOL_attrsDUMMY
18181 | FFESYMBOL_attrsEXTERNAL
18182 | FFESYMBOL_attrsSFARG
)));
18184 if (ffeintrin_is_intrinsic (ffesymbol_text (s
), t
, FALSE
,
18185 &gen
, &spec
, &imp
))
18187 if (!(sa
& FFESYMBOL_attrsANYLEN
)
18188 && (ffeimplic_peek_symbol_type (s
, NULL
)
18189 == FFEINFO_basictypeCHARACTER
))
18190 return s
; /* Haven't learned anything yet. */
18192 ffesymbol_signal_change (s
); /* May need to back up to previous
18194 ffesymbol_set_generic (s
, gen
);
18195 ffesymbol_set_specific (s
, spec
);
18196 ffesymbol_set_implementation (s
, imp
);
18197 ffesymbol_set_info (s
,
18198 ffeinfo_new (ffesymbol_basictype (s
),
18199 ffesymbol_kindtype (s
),
18201 FFEINFO_kindFUNCTION
,
18202 FFEINFO_whereINTRINSIC
,
18203 ffesymbol_size (s
)));
18204 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
18205 ffesymbol_resolve_intrin (s
);
18206 ffesymbol_reference (s
, t
, FALSE
);
18207 s
= ffecom_sym_learned (s
);
18208 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
18212 if (sa
& FFESYMBOL_attrsANYLEN
)
18213 error
= TRUE
; /* Error, since the only way we can,
18214 given CHARACTER*(*) FOO, accept
18215 FOO(...) is for FOO to be a dummy
18216 arg or constant, but it can't
18217 become either now. */
18218 else if (sa
& FFESYMBOL_attrsADJUSTABLE
)
18220 kind
= FFEINFO_kindENTITY
;
18221 where
= FFEINFO_whereLOCAL
;
18225 kind
= FFEINFO_kindFUNCTION
;
18226 where
= FFEINFO_whereGLOBAL
;
18227 maybe_ambig
= TRUE
; /* If basictypeCHARACTER, can't be sure;
18228 could be ENTITY/LOCAL w/substring ref. */
18231 else if (sa
== FFESYMBOL_attrsetNONE
)
18233 assert (ffesymbol_state (s
) == FFESYMBOL_stateNONE
);
18235 if (ffeintrin_is_intrinsic (ffesymbol_text (s
), t
, FALSE
,
18236 &gen
, &spec
, &imp
))
18238 if (ffeimplic_peek_symbol_type (s
, NULL
)
18239 == FFEINFO_basictypeCHARACTER
)
18240 return s
; /* Haven't learned anything yet. */
18242 ffesymbol_signal_change (s
); /* May need to back up to previous
18244 ffesymbol_set_generic (s
, gen
);
18245 ffesymbol_set_specific (s
, spec
);
18246 ffesymbol_set_implementation (s
, imp
);
18247 ffesymbol_set_info (s
,
18248 ffeinfo_new (ffesymbol_basictype (s
),
18249 ffesymbol_kindtype (s
),
18251 FFEINFO_kindFUNCTION
,
18252 FFEINFO_whereINTRINSIC
,
18253 ffesymbol_size (s
)));
18254 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
18255 ffesymbol_resolve_intrin (s
);
18256 s
= ffecom_sym_learned (s
);
18257 ffesymbol_reference (s
, t
, FALSE
);
18258 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
18262 kind
= FFEINFO_kindFUNCTION
;
18263 where
= FFEINFO_whereGLOBAL
;
18264 maybe_ambig
= TRUE
; /* If basictypeCHARACTER, can't be sure;
18265 could be ENTITY/LOCAL w/substring ref. */
18270 /* Now see what we've got for a new object: NONE means a new error cropped
18271 up; ANY means an old error to be ignored; otherwise, everything's ok,
18272 update the object (symbol) and continue on. */
18275 ffesymbol_error (s
, t
);
18276 else if (!(na
& FFESYMBOL_attrsANY
))
18278 ffesymbol_signal_change (s
); /* May need to back up to previous
18280 if (!ffeimplic_establish_symbol (s
))
18282 ffesymbol_error (s
, t
);
18286 && (ffesymbol_basictype (s
) == FFEINFO_basictypeCHARACTER
))
18287 return s
; /* Still not sure, let caller deal with it
18290 ffesymbol_set_info (s
,
18291 ffeinfo_new (ffesymbol_basictype (s
),
18292 ffesymbol_kindtype (s
),
18293 ffesymbol_rank (s
),
18296 ffesymbol_size (s
)));
18297 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
18298 ffesymbol_resolve_intrin (s
);
18299 s
= ffecom_sym_learned (s
);
18300 ffesymbol_reference (s
, t
, FALSE
);
18301 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
18307 /* ffeexpr_token_arguments_ -- OPEN_PAREN [expr COMMA]...expr
18309 Return a pointer to this function to the lexer (ffelex), which will
18310 invoke it for the next token.
18312 Handle expression (which might be null) and COMMA or CLOSE_PAREN. */
18314 static ffelexHandler
18315 ffeexpr_token_arguments_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
18317 ffeexprExpr_ procedure
;
18320 ffeexprContext ctx
;
18321 bool check_intrin
= FALSE
; /* Set TRUE if intrinsic is REAL(Z) or AIMAG(Z). */
18323 procedure
= ffeexpr_stack_
->exprstack
;
18324 info
= ffebld_info (procedure
->u
.operand
);
18326 /* Is there an expression to add? If the expression is nil,
18327 it might still be an argument. It is if:
18329 - The current token is comma, or
18331 - The -fugly-comma flag was specified *and* the procedure
18332 being invoked is external.
18334 Otherwise, if neither of the above is the case, just
18335 ignore this (nil) expression. */
18338 || (ffelex_token_type (t
) == FFELEX_typeCOMMA
)
18339 || (ffe_is_ugly_comma ()
18340 && (ffeinfo_where (info
) == FFEINFO_whereGLOBAL
)))
18342 /* This expression, even if nil, is apparently intended as an argument. */
18344 /* Internal procedure (CONTAINS, or statement function)? */
18346 if (ffeinfo_where (info
) == FFEINFO_whereCONSTANT
)
18349 && ffebad_start (FFEBAD_NULL_ARGUMENT
))
18351 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18352 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18353 ffebad_here (1, ffelex_token_where_line (t
),
18354 ffelex_token_where_column (t
));
18362 if (ffeexpr_stack_
->next_dummy
== NULL
)
18363 { /* Report later which was the first extra argument. */
18364 if (ffeexpr_stack_
->tokens
[1] == NULL
)
18366 ffeexpr_stack_
->tokens
[1] = ffelex_token_use (ft
);
18367 ffeexpr_stack_
->num_args
= 0;
18369 ++ffeexpr_stack_
->num_args
; /* Count # of extra arguments. */
18373 if ((ffeinfo_rank (ffebld_info (expr
)) != 0)
18374 && ffebad_start (FFEBAD_ARRAY_AS_SFARG
))
18377 ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18378 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18379 ffebad_here (1, ffelex_token_where_line (ft
),
18380 ffelex_token_where_column (ft
));
18381 ffebad_string (ffesymbol_text (ffesymbol_sfdummyparent
18382 (ffebld_symter (ffebld_head
18383 (ffeexpr_stack_
->next_dummy
)))));
18388 expr
= ffeexpr_convert_expr (expr
, ft
,
18389 ffebld_head (ffeexpr_stack_
->next_dummy
),
18390 ffeexpr_stack_
->tokens
[0],
18391 FFEEXPR_contextLET
);
18392 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
18394 --ffeexpr_stack_
->num_args
; /* Count down # of args. */
18395 ffeexpr_stack_
->next_dummy
18396 = ffebld_trail (ffeexpr_stack_
->next_dummy
);
18403 && ffe_is_pedantic ()
18404 && ffebad_start (FFEBAD_NULL_ARGUMENT_W
))
18406 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18407 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18408 ffebad_here (1, ffelex_token_where_line (t
),
18409 ffelex_token_where_column (t
));
18412 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
18416 switch (ffelex_token_type (t
))
18418 case FFELEX_typeCOMMA
:
18419 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
18421 case FFEEXPR_contextSFUNCDEF
:
18422 case FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
:
18423 case FFEEXPR_contextSFUNCDEFINDEX_
:
18424 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
:
18425 ctx
= FFEEXPR_contextSFUNCDEFACTUALARG_
;
18428 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
18429 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
18430 assert ("bad context" == NULL
);
18431 ctx
= FFEEXPR_context
;
18435 ctx
= FFEEXPR_contextACTUALARG_
;
18438 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
, ctx
,
18439 ffeexpr_token_arguments_
);
18445 if ((ffeinfo_where (info
) == FFEINFO_whereCONSTANT
)
18446 && (ffeexpr_stack_
->next_dummy
!= NULL
))
18447 { /* Too few arguments. */
18448 if (ffebad_start (FFEBAD_TOO_FEW_ARGUMENTS
))
18452 sprintf (num
, "%" ffebldListLength_f
"u", ffeexpr_stack_
->num_args
);
18454 ffebad_here (0, ffelex_token_where_line (t
),
18455 ffelex_token_where_column (t
));
18456 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18457 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18458 ffebad_string (num
);
18459 ffebad_string (ffesymbol_text (ffesymbol_sfdummyparent (ffebld_symter
18460 (ffebld_head (ffeexpr_stack_
->next_dummy
)))));
18464 ffeexpr_stack_
->next_dummy
!= NULL
;
18465 ffeexpr_stack_
->next_dummy
18466 = ffebld_trail (ffeexpr_stack_
->next_dummy
))
18468 expr
= ffebld_new_conter (ffebld_constant_new_integerdefault_val (0));
18469 ffebld_set_info (expr
, ffeinfo_new_any ());
18470 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
18474 if ((ffeinfo_where (info
) == FFEINFO_whereCONSTANT
)
18475 && (ffeexpr_stack_
->tokens
[1] != NULL
))
18476 { /* Too many arguments to statement function. */
18477 if (ffebad_start (FFEBAD_TOO_MANY_ARGUMENTS
))
18481 sprintf (num
, "%" ffebldListLength_f
"u", ffeexpr_stack_
->num_args
);
18483 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->tokens
[1]),
18484 ffelex_token_where_column (ffeexpr_stack_
->tokens
[1]));
18485 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18486 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18487 ffebad_string (num
);
18490 ffelex_token_kill (ffeexpr_stack_
->tokens
[1]);
18492 ffebld_end_list (&ffeexpr_stack_
->bottom
);
18494 if (ffebld_op (procedure
->u
.operand
) == FFEBLD_opANY
)
18496 reduced
= ffebld_new_any ();
18497 ffebld_set_info (reduced
, ffeinfo_new_any ());
18501 if (ffeexpr_stack_
->context
!= FFEEXPR_contextSUBROUTINEREF
)
18502 reduced
= ffebld_new_funcref (procedure
->u
.operand
,
18503 ffeexpr_stack_
->expr
);
18505 reduced
= ffebld_new_subrref (procedure
->u
.operand
,
18506 ffeexpr_stack_
->expr
);
18507 if (ffebld_symter_generic (procedure
->u
.operand
) != FFEINTRIN_genNONE
)
18508 ffeintrin_fulfill_generic (&reduced
, &info
, ffeexpr_stack_
->tokens
[0]);
18509 else if (ffebld_symter_specific (procedure
->u
.operand
)
18510 != FFEINTRIN_specNONE
)
18511 ffeintrin_fulfill_specific (&reduced
, &info
, &check_intrin
,
18512 ffeexpr_stack_
->tokens
[0]);
18514 ffeexpr_fulfill_call_ (&reduced
, ffeexpr_stack_
->tokens
[0]);
18516 if (ffebld_op (reduced
) != FFEBLD_opANY
)
18517 ffebld_set_info (reduced
,
18518 ffeinfo_new (ffeinfo_basictype (info
),
18519 ffeinfo_kindtype (info
),
18521 FFEINFO_kindENTITY
,
18522 FFEINFO_whereFLEETING
,
18523 ffeinfo_size (info
)));
18525 ffebld_set_info (reduced
, ffeinfo_new_any ());
18527 if (ffebld_op (reduced
) == FFEBLD_opFUNCREF
)
18528 reduced
= ffeexpr_collapse_funcref (reduced
, ffeexpr_stack_
->tokens
[0]);
18529 ffeexpr_stack_
->exprstack
= procedure
->previous
; /* Pops
18530 not-quite-operand off
18532 procedure
->u
.operand
= reduced
; /* Save the line/column ffewhere
18534 ffeexpr_exprstack_push_operand_ (procedure
); /* Push it back on stack. */
18535 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
18537 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
18538 ffeexpr_is_substr_ok_
= FALSE
; /* Nobody likes "FUNC(3)(1:1)".... */
18540 /* If the intrinsic needs checking (is REAL(Z) or AIMAG(Z), where
18541 Z is DOUBLE COMPLEX), and a command-line option doesn't already
18542 establish interpretation, probably complain. */
18546 && !ffe_is_ugly_complex ())
18548 /* If the outer expression is REAL(me...), issue diagnostic
18549 only if next token isn't the close-paren for REAL(me). */
18551 if ((ffeexpr_stack_
->previous
!= NULL
)
18552 && (ffeexpr_stack_
->previous
->exprstack
!= NULL
)
18553 && (ffeexpr_stack_
->previous
->exprstack
->type
== FFEEXPR_exprtypeOPERAND_
)
18554 && ((reduced
= ffeexpr_stack_
->previous
->exprstack
->u
.operand
) != NULL
)
18555 && (ffebld_op (reduced
) == FFEBLD_opSYMTER
)
18556 && (ffebld_symter_implementation (reduced
) == FFEINTRIN_impREAL
))
18557 return (ffelexHandler
) ffeexpr_token_intrincheck_
;
18559 /* Diagnose the ambiguity now. */
18561 if (ffebad_start (FFEBAD_INTRINSIC_CMPAMBIG
))
18563 ffebad_string (ffeintrin_name_implementation
18564 (ffebld_symter_implementation
18566 (ffeexpr_stack_
->exprstack
->u
.operand
))));
18567 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->exprstack
->token
),
18568 ffelex_token_where_column (ffeexpr_stack_
->exprstack
->token
));
18572 return (ffelexHandler
) ffeexpr_token_substrp_
;
18575 if (ffest_ffebad_start (FFEBAD_INVALID_TOKEN_IN_EXPRESSION
))
18577 ffebad_here (0, ffelex_token_where_line (t
),
18578 ffelex_token_where_column (t
));
18579 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18580 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18583 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
18584 ffeexpr_is_substr_ok_
= FALSE
;/* Nobody likes "FUNC(3)(1:1)".... */
18586 (ffelexHandler
) ffeexpr_find_close_paren_ (t
,
18588 ffeexpr_token_substrp_
);
18591 /* ffeexpr_token_elements_ -- OPEN_PAREN [expr COMMA]...expr
18593 Return a pointer to this array to the lexer (ffelex), which will
18594 invoke it for the next token.
18596 Handle expression and COMMA or CLOSE_PAREN. */
18598 static ffelexHandler
18599 ffeexpr_token_elements_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
18601 ffeexprExpr_ array
;
18604 ffeinfoWhere where
;
18605 ffetargetIntegerDefault val
;
18606 ffetargetIntegerDefault lval
= 0;
18607 ffetargetIntegerDefault uval
= 0;
18613 array
= ffeexpr_stack_
->exprstack
;
18614 info
= ffebld_info (array
->u
.operand
);
18616 if ((expr
== NULL
) /* && ((ffeexpr_stack_->rank != 0) ||
18617 (ffelex_token_type(t) ==
18618 FFELEX_typeCOMMA)) */ )
18620 if (ffebad_start (FFEBAD_NULL_ELEMENT
))
18622 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18623 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18624 ffebad_here (1, ffelex_token_where_line (t
),
18625 ffelex_token_where_column (t
));
18628 if (ffeexpr_stack_
->rank
< ffeinfo_rank (info
))
18629 { /* Don't bother if we're going to complain
18631 expr
= ffebld_new_conter (ffebld_constant_new_integerdefault_val (1));
18632 ffebld_set_info (expr
, ffeinfo_new_any ());
18638 else if (ffeinfo_rank (info
) == 0)
18639 { /* In EQUIVALENCE context, ffeinfo_rank(info)
18641 ++ffeexpr_stack_
->rank
; /* Track anyway, may need for new VXT
18643 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
18647 ++ffeexpr_stack_
->rank
;
18648 if (ffeexpr_stack_
->rank
> ffeinfo_rank (info
))
18649 { /* Report later which was the first extra
18651 if (ffeexpr_stack_
->rank
== ffeinfo_rank (info
) + 1)
18652 ffeexpr_stack_
->tokens
[1] = ffelex_token_use (ft
);
18656 switch (ffeinfo_where (ffebld_info (expr
)))
18658 case FFEINFO_whereCONSTANT
:
18661 case FFEINFO_whereIMMEDIATE
:
18662 ffeexpr_stack_
->constant
= FALSE
;
18666 ffeexpr_stack_
->constant
= FALSE
;
18667 ffeexpr_stack_
->immediate
= FALSE
;
18670 if (ffebld_op (expr
) == FFEBLD_opCONTER
18671 && ffebld_kindtype (expr
) == FFEINFO_kindtypeINTEGERDEFAULT
)
18673 val
= ffebld_constant_integerdefault (ffebld_conter (expr
));
18675 lbound
= ffebld_left (ffebld_head (ffeexpr_stack_
->bound_list
));
18676 if (lbound
== NULL
)
18681 else if (ffebld_op (lbound
) == FFEBLD_opCONTER
)
18684 lval
= ffebld_constant_integerdefault (ffebld_conter (lbound
));
18689 ubound
= ffebld_right (ffebld_head (ffeexpr_stack_
->bound_list
));
18690 assert (ubound
!= NULL
);
18691 if (ffebld_op (ubound
) == FFEBLD_opCONTER
)
18694 uval
= ffebld_constant_integerdefault (ffebld_conter (ubound
));
18699 if ((lcheck
&& (val
< lval
)) || (ucheck
&& (val
> uval
)))
18701 ffebad_start (FFEBAD_RANGE_ARRAY
);
18702 ffebad_here (0, ffelex_token_where_line (ft
),
18703 ffelex_token_where_column (ft
));
18707 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
18708 ffeexpr_stack_
->bound_list
= ffebld_trail (ffeexpr_stack_
->bound_list
);
18712 switch (ffelex_token_type (t
))
18714 case FFELEX_typeCOMMA
:
18715 switch (ffeexpr_context_outer_ (ffeexpr_stack_
))
18717 case FFEEXPR_contextDATAIMPDOITEM_
:
18718 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
18719 FFEEXPR_contextDATAIMPDOINDEX_
,
18720 ffeexpr_token_elements_
);
18722 case FFEEXPR_contextEQUIVALENCE
:
18723 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
18724 FFEEXPR_contextEQVINDEX_
,
18725 ffeexpr_token_elements_
);
18727 case FFEEXPR_contextSFUNCDEF
:
18728 case FFEEXPR_contextSFUNCDEFINDEX_
:
18729 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
18730 FFEEXPR_contextSFUNCDEFINDEX_
,
18731 ffeexpr_token_elements_
);
18733 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
18734 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
18735 assert ("bad context" == NULL
);
18739 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
18740 FFEEXPR_contextINDEX_
,
18741 ffeexpr_token_elements_
);
18748 if ((ffeexpr_stack_
->rank
!= ffeinfo_rank (info
))
18749 && (ffeinfo_rank (info
) != 0))
18753 if (ffeexpr_stack_
->rank
< ffeinfo_rank (info
))
18755 if (ffebad_start (FFEBAD_TOO_FEW_ELEMENTS
))
18757 sprintf (num
, "%d",
18758 (int) (ffeinfo_rank (info
) - ffeexpr_stack_
->rank
));
18760 ffebad_here (0, ffelex_token_where_line (t
),
18761 ffelex_token_where_column (t
));
18763 ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18764 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18765 ffebad_string (num
);
18771 if (ffebad_start (FFEBAD_TOO_MANY_ELEMENTS
))
18773 sprintf (num
, "%d",
18774 (int) (ffeexpr_stack_
->rank
- ffeinfo_rank (info
)));
18777 ffelex_token_where_line (ffeexpr_stack_
->tokens
[1]),
18778 ffelex_token_where_column (ffeexpr_stack_
->tokens
[1]));
18780 ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18781 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18782 ffebad_string (num
);
18785 ffelex_token_kill (ffeexpr_stack_
->tokens
[1]);
18787 while (ffeexpr_stack_
->rank
++ < ffeinfo_rank (info
))
18789 expr
= ffebld_new_conter (ffebld_constant_new_integerdefault_val (1));
18790 ffebld_set_info (expr
, ffeinfo_new (FFEINFO_basictypeINTEGER
,
18791 FFEINFO_kindtypeINTEGERDEFAULT
,
18792 0, FFEINFO_kindENTITY
,
18793 FFEINFO_whereCONSTANT
,
18794 FFETARGET_charactersizeNONE
));
18795 ffebld_append_item (&ffeexpr_stack_
->bottom
, expr
);
18798 ffebld_end_list (&ffeexpr_stack_
->bottom
);
18800 if (ffebld_op (array
->u
.operand
) == FFEBLD_opANY
)
18802 reduced
= ffebld_new_any ();
18803 ffebld_set_info (reduced
, ffeinfo_new_any ());
18807 reduced
= ffebld_new_arrayref (array
->u
.operand
, ffeexpr_stack_
->expr
);
18808 if (ffeexpr_stack_
->constant
)
18809 where
= FFEINFO_whereFLEETING_CADDR
;
18810 else if (ffeexpr_stack_
->immediate
)
18811 where
= FFEINFO_whereFLEETING_IADDR
;
18813 where
= FFEINFO_whereFLEETING
;
18814 ffebld_set_info (reduced
,
18815 ffeinfo_new (ffeinfo_basictype (info
),
18816 ffeinfo_kindtype (info
),
18818 FFEINFO_kindENTITY
,
18820 ffeinfo_size (info
)));
18821 reduced
= ffeexpr_collapse_arrayref (reduced
, ffeexpr_stack_
->tokens
[0]);
18824 ffeexpr_stack_
->exprstack
= array
->previous
; /* Pops not-quite-operand off
18826 array
->u
.operand
= reduced
; /* Save the line/column ffewhere info. */
18827 ffeexpr_exprstack_push_operand_ (array
); /* Push it back on stack. */
18829 switch (ffeinfo_basictype (info
))
18831 case FFEINFO_basictypeCHARACTER
:
18832 ffeexpr_is_substr_ok_
= TRUE
; /* Everyone likes "FOO(3)(1:1)".... */
18835 case FFEINFO_basictypeNONE
:
18836 ffeexpr_is_substr_ok_
= TRUE
;
18837 assert (ffeexpr_stack_
->context
== FFEEXPR_contextEQUIVALENCE
);
18841 ffeexpr_is_substr_ok_
= FALSE
;
18845 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
18847 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
18848 return (ffelexHandler
) ffeexpr_token_substrp_
;
18851 if (ffest_ffebad_start (FFEBAD_INVALID_TOKEN_IN_EXPRESSION
))
18853 ffebad_here (0, ffelex_token_where_line (t
),
18854 ffelex_token_where_column (t
));
18855 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18856 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18859 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
18861 (ffelexHandler
) ffeexpr_find_close_paren_ (t
,
18863 ffeexpr_token_substrp_
);
18866 /* ffeexpr_token_equivalence_ -- OPEN_PAREN expr
18868 Return a pointer to this array to the lexer (ffelex), which will
18869 invoke it for the next token.
18871 If token is COLON, pass off to _substr_, else init list and pass off
18872 to _elements_. This handles the case "EQUIVALENCE (FOO(expr?", where
18873 ? marks the token, and where FOO's rank/type has not yet been established,
18874 meaning we could be in a list of indices or in a substring
18877 static ffelexHandler
18878 ffeexpr_token_equivalence_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
18880 if (ffelex_token_type (t
) == FFELEX_typeCOLON
)
18881 return ffeexpr_token_substring_ (ft
, expr
, t
);
18883 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
18884 return ffeexpr_token_elements_ (ft
, expr
, t
);
18887 /* ffeexpr_token_substring_ -- NAME(of kindENTITY) OPEN_PAREN expr
18889 Return a pointer to this function to the lexer (ffelex), which will
18890 invoke it for the next token.
18892 Handle expression (which may be null) and COLON. */
18894 static ffelexHandler
18895 ffeexpr_token_substring_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
18897 ffeexprExpr_ string
;
18899 ffetargetIntegerDefault i
;
18900 ffeexprContext ctx
;
18901 ffetargetCharacterSize size
;
18903 string
= ffeexpr_stack_
->exprstack
;
18904 info
= ffebld_info (string
->u
.operand
);
18905 size
= ffebld_size_max (string
->u
.operand
);
18907 if (ffelex_token_type (t
) == FFELEX_typeCOLON
)
18910 && (ffebld_op (expr
) == FFEBLD_opCONTER
)
18911 && (((i
= ffebld_constant_integerdefault (ffebld_conter (expr
)))
18913 || ((size
!= FFETARGET_charactersizeNONE
) && (i
> size
))))
18915 ffebad_start (FFEBAD_RANGE_SUBSTR
);
18916 ffebad_here (0, ffelex_token_where_line (ft
),
18917 ffelex_token_where_column (ft
));
18920 ffeexpr_stack_
->expr
= expr
;
18922 switch (ffeexpr_stack_
->context
)
18924 case FFEEXPR_contextSFUNCDEF
:
18925 case FFEEXPR_contextSFUNCDEFINDEX_
:
18926 ctx
= FFEEXPR_contextSFUNCDEFINDEX_
;
18929 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
18930 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
18931 assert ("bad context" == NULL
);
18932 ctx
= FFEEXPR_context
;
18936 ctx
= FFEEXPR_contextINDEX_
;
18940 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
, ctx
,
18941 ffeexpr_token_substring_1_
);
18944 if (ffest_ffebad_start (FFEBAD_MISSING_COLON_IN_SUBSTR
))
18946 ffebad_here (0, ffelex_token_where_line (t
),
18947 ffelex_token_where_column (t
));
18948 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
18949 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
18953 ffeexpr_stack_
->expr
= NULL
;
18954 return (ffelexHandler
) ffeexpr_token_substring_1_ (ft
, expr
, t
);
18957 /* ffeexpr_token_substring_1_ -- NAME OPEN_PAREN [expr COMMA]...expr
18959 Return a pointer to this function to the lexer (ffelex), which will
18960 invoke it for the next token.
18962 Handle expression (which might be null) and CLOSE_PAREN. */
18964 static ffelexHandler
18965 ffeexpr_token_substring_1_ (ffelexToken ft
, ffebld last
, ffelexToken t
)
18967 ffeexprExpr_ string
;
18970 ffebld first
= ffeexpr_stack_
->expr
;
18975 ffeinfoWhere where
;
18976 ffeinfoKindtype first_kt
;
18977 ffeinfoKindtype last_kt
;
18978 ffetargetIntegerDefault first_val
;
18979 ffetargetIntegerDefault last_val
;
18980 ffetargetCharacterSize size
;
18981 ffetargetCharacterSize strop_size_max
;
18984 string
= ffeexpr_stack_
->exprstack
;
18985 strop
= string
->u
.operand
;
18986 info
= ffebld_info (strop
);
18989 || (ffebld_op (first
) == FFEBLD_opCONTER
18990 && ffebld_kindtype (first
) == FFEINFO_kindtypeINTEGERDEFAULT
))
18991 { /* The starting point is known. */
18992 first_val
= (first
== NULL
) ? 1
18993 : ffebld_constant_integerdefault (ffebld_conter (first
));
18994 first_known
= TRUE
;
18997 { /* Assume start of the entity. */
18999 first_known
= FALSE
;
19003 && (ffebld_op (last
) == FFEBLD_opCONTER
19004 && ffebld_kindtype (last
) == FFEINFO_kindtypeINTEGERDEFAULT
))
19005 { /* The ending point is known. */
19006 last_val
= ffebld_constant_integerdefault (ffebld_conter (last
));
19009 { /* The beginning point is a constant. */
19010 if (first_val
<= last_val
)
19011 size
= last_val
- first_val
+ 1;
19014 if (0 && ffe_is_90 ())
19019 ffebad_start (FFEBAD_ZERO_SIZE
);
19020 ffebad_here (0, ffelex_token_where_line (ft
),
19021 ffelex_token_where_column (ft
));
19027 size
= FFETARGET_charactersizeNONE
;
19029 strop_size_max
= ffebld_size_max (strop
);
19031 if ((strop_size_max
!= FFETARGET_charactersizeNONE
)
19032 && (last_val
> strop_size_max
))
19033 { /* Beyond maximum possible end of string. */
19034 ffebad_start (FFEBAD_RANGE_SUBSTR
);
19035 ffebad_here (0, ffelex_token_where_line (ft
),
19036 ffelex_token_where_column (ft
));
19041 size
= FFETARGET_charactersizeNONE
; /* The size is not known. */
19043 #if 0 /* Don't do this, or "is size of target
19044 known?" would no longer be easily
19045 answerable. To see if there is a max
19046 size, use ffebld_size_max; to get only the
19047 known size, else NONE, use
19048 ffebld_size_known; use ffebld_size if
19049 values are sure to be the same (not
19050 opSUBSTR or opCONCATENATE or known to have
19051 known length). By getting rid of this
19052 "useful info" stuff, we don't end up
19053 blank-padding the constant in the
19054 assignment "A(I:J)='XYZ'" to the known
19056 if (size
== FFETARGET_charactersizeNONE
)
19057 size
= strop_size_max
; /* Assume we use the entire string. */
19071 lwh
= FFEINFO_whereCONSTANT
;
19073 lwh
= ffeinfo_where (ffebld_info (first
));
19075 rwh
= FFEINFO_whereCONSTANT
;
19077 rwh
= ffeinfo_where (ffebld_info (last
));
19081 case FFEINFO_whereCONSTANT
:
19084 case FFEINFO_whereCONSTANT
:
19085 where
= FFEINFO_whereCONSTANT
;
19088 case FFEINFO_whereIMMEDIATE
:
19089 where
= FFEINFO_whereIMMEDIATE
;
19093 where
= FFEINFO_whereFLEETING
;
19098 case FFEINFO_whereIMMEDIATE
:
19101 case FFEINFO_whereCONSTANT
:
19102 case FFEINFO_whereIMMEDIATE
:
19103 where
= FFEINFO_whereIMMEDIATE
;
19107 where
= FFEINFO_whereFLEETING
;
19113 where
= FFEINFO_whereFLEETING
;
19118 first_kt
= FFEINFO_kindtypeINTEGERDEFAULT
;
19120 first_kt
= ffeinfo_kindtype (ffebld_info (first
));
19122 last_kt
= FFEINFO_kindtypeINTEGERDEFAULT
;
19124 last_kt
= ffeinfo_kindtype (ffebld_info (last
));
19128 case FFEINFO_whereCONSTANT
:
19129 switch (ffeinfo_where (info
))
19131 case FFEINFO_whereCONSTANT
:
19134 case FFEINFO_whereIMMEDIATE
: /* Not possible, actually. */
19135 where
= FFEINFO_whereIMMEDIATE
;
19139 where
= FFEINFO_whereFLEETING_CADDR
;
19144 case FFEINFO_whereIMMEDIATE
:
19145 switch (ffeinfo_where (info
))
19147 case FFEINFO_whereCONSTANT
:
19148 case FFEINFO_whereIMMEDIATE
: /* Not possible, actually. */
19152 where
= FFEINFO_whereFLEETING_IADDR
;
19158 switch (ffeinfo_where (info
))
19160 case FFEINFO_whereCONSTANT
:
19161 where
= FFEINFO_whereCONSTANT_SUBOBJECT
; /* An F90 concept. */
19164 case FFEINFO_whereIMMEDIATE
: /* Not possible, actually. */
19166 where
= FFEINFO_whereFLEETING
;
19172 if (ffebld_op (strop
) == FFEBLD_opANY
)
19174 reduced
= ffebld_new_any ();
19175 ffebld_set_info (reduced
, ffeinfo_new_any ());
19179 reduced
= ffebld_new_substr (strop
, substrlist
);
19180 ffebld_set_info (reduced
, ffeinfo_new
19181 (FFEINFO_basictypeCHARACTER
,
19182 ffeinfo_kindtype (info
),
19184 FFEINFO_kindENTITY
,
19187 reduced
= ffeexpr_collapse_substr (reduced
, ffeexpr_stack_
->tokens
[0]);
19190 ffeexpr_stack_
->exprstack
= string
->previous
; /* Pops not-quite-operand off
19192 string
->u
.operand
= reduced
; /* Save the line/column ffewhere info. */
19193 ffeexpr_exprstack_push_operand_ (string
); /* Push it back on stack. */
19195 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
19197 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
19198 ffeexpr_is_substr_ok_
= FALSE
; /* Nobody likes "FOO(3:5)(1:1)".... */
19199 return (ffelexHandler
) ffeexpr_token_substrp_
;
19202 if (ffest_ffebad_start (FFEBAD_INVALID_TOKEN_IN_EXPRESSION
))
19204 ffebad_here (0, ffelex_token_where_line (t
),
19205 ffelex_token_where_column (t
));
19206 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->tokens
[0]),
19207 ffelex_token_where_column (ffeexpr_stack_
->tokens
[0]));
19211 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
19212 ffeexpr_is_substr_ok_
= FALSE
;/* Nobody likes "FOO(3:5)(1:1)".... */
19214 (ffelexHandler
) ffeexpr_find_close_paren_ (t
,
19216 ffeexpr_token_substrp_
);
19219 /* ffeexpr_token_substrp_ -- Rhs <character entity>
19221 Return a pointer to this function to the lexer (ffelex), which will
19222 invoke it for the next token.
19224 If OPEN_PAREN, treat as start of a substring ("(3:4)") construct, and
19225 issue error message if flag (serves as argument) is set. Else, just
19226 forward token to binary_. */
19228 static ffelexHandler
19229 ffeexpr_token_substrp_ (ffelexToken t
)
19231 ffeexprContext ctx
;
19233 if (ffelex_token_type (t
) != FFELEX_typeOPEN_PAREN
)
19234 return (ffelexHandler
) ffeexpr_token_binary_ (t
);
19236 ffeexpr_stack_
->tokens
[0] = ffelex_token_use (t
);
19238 switch (ffeexpr_stack_
->context
)
19240 case FFEEXPR_contextSFUNCDEF
:
19241 case FFEEXPR_contextSFUNCDEFINDEX_
:
19242 ctx
= FFEEXPR_contextSFUNCDEFINDEX_
;
19245 case FFEEXPR_contextSFUNCDEFACTUALARG_
:
19246 case FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
:
19247 assert ("bad context" == NULL
);
19248 ctx
= FFEEXPR_context
;
19252 ctx
= FFEEXPR_contextINDEX_
;
19256 if (!ffeexpr_is_substr_ok_
)
19258 if (ffebad_start (FFEBAD_BAD_SUBSTR
))
19260 ffebad_here (0, ffelex_token_where_line (t
),
19261 ffelex_token_where_column (t
));
19262 ffebad_here (1, ffelex_token_where_line (ffeexpr_stack_
->exprstack
->token
),
19263 ffelex_token_where_column (ffeexpr_stack_
->exprstack
->token
));
19267 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
, ctx
,
19268 ffeexpr_token_anything_
);
19271 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
, ctx
,
19272 ffeexpr_token_substring_
);
19275 static ffelexHandler
19276 ffeexpr_token_intrincheck_ (ffelexToken t
)
19278 if ((ffelex_token_type (t
) != FFELEX_typeCLOSE_PAREN
)
19279 && ffebad_start (FFEBAD_INTRINSIC_CMPAMBIG
))
19281 ffebad_string (ffeintrin_name_implementation
19282 (ffebld_symter_implementation
19284 (ffeexpr_stack_
->exprstack
->u
.operand
))));
19285 ffebad_here (0, ffelex_token_where_line (ffeexpr_stack_
->exprstack
->token
),
19286 ffelex_token_where_column (ffeexpr_stack_
->exprstack
->token
));
19290 return (ffelexHandler
) ffeexpr_token_substrp_ (t
);
19293 /* ffeexpr_token_funsubstr_ -- NAME OPEN_PAREN expr
19295 Return a pointer to this function to the lexer (ffelex), which will
19296 invoke it for the next token.
19298 If COLON, do everything we would have done since _parenthesized_ if
19299 we had known NAME represented a kindENTITY instead of a kindFUNCTION.
19300 If not COLON, do likewise for kindFUNCTION instead. */
19302 static ffelexHandler
19303 ffeexpr_token_funsubstr_ (ffelexToken ft
, ffebld expr
, ffelexToken t
)
19305 ffeinfoWhere where
;
19308 ffebld symter
= ffeexpr_stack_
->exprstack
->u
.operand
;
19311 ffeintrinSpec spec
;
19314 s
= ffebld_symter (symter
);
19315 sa
= ffesymbol_attrs (s
);
19316 where
= ffesymbol_where (s
);
19318 /* We get here only if we don't already know enough about FOO when seeing a
19319 FOO(stuff) reference, and FOO might turn out to be a CHARACTER type. If
19320 "stuff" is a substring reference, then FOO is a CHARACTER scalar type.
19321 Else FOO is a function, either intrinsic or external. If intrinsic, it
19322 wouldn't necessarily be CHARACTER type, so unless it has already been
19323 declared DUMMY, it hasn't had its type established yet. It can't be
19324 CHAR*(*) in any case, though it can have an explicit CHAR*n type. */
19326 assert (!(sa
& ~(FFESYMBOL_attrsDUMMY
19327 | FFESYMBOL_attrsTYPE
)));
19329 needs_type
= !(ffesymbol_attrs (s
) & FFESYMBOL_attrsDUMMY
);
19331 ffesymbol_signal_change (s
); /* Probably already done, but in case.... */
19333 if (ffelex_token_type (t
) == FFELEX_typeCOLON
)
19334 { /* Definitely an ENTITY (char substring). */
19335 if (needs_type
&& !ffeimplic_establish_symbol (s
))
19337 ffesymbol_error (s
, ffeexpr_stack_
->tokens
[0]);
19338 return (ffelexHandler
) ffeexpr_token_arguments_ (ft
, expr
, t
);
19341 ffesymbol_set_info (s
,
19342 ffeinfo_new (ffesymbol_basictype (s
),
19343 ffesymbol_kindtype (s
),
19344 ffesymbol_rank (s
),
19345 FFEINFO_kindENTITY
,
19346 (where
== FFEINFO_whereNONE
)
19347 ? FFEINFO_whereLOCAL
19349 ffesymbol_size (s
)));
19350 ffebld_set_info (symter
, ffeinfo_use (ffesymbol_info (s
)));
19352 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
19353 ffesymbol_resolve_intrin (s
);
19354 s
= ffecom_sym_learned (s
);
19355 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
19357 ffeexpr_stack_
->exprstack
->u
.operand
19358 = ffeexpr_collapse_symter (symter
, ffeexpr_tokens_
[0]);
19360 return (ffelexHandler
) ffeexpr_token_substring_ (ft
, expr
, t
);
19363 /* The "stuff" isn't a substring notation, so we now know the overall
19364 reference is to a function. */
19366 if (ffeintrin_is_intrinsic (ffesymbol_text (s
), ffeexpr_stack_
->tokens
[0],
19367 FALSE
, &gen
, &spec
, &imp
))
19369 ffebld_symter_set_generic (symter
, gen
);
19370 ffebld_symter_set_specific (symter
, spec
);
19371 ffebld_symter_set_implementation (symter
, imp
);
19372 ffesymbol_set_generic (s
, gen
);
19373 ffesymbol_set_specific (s
, spec
);
19374 ffesymbol_set_implementation (s
, imp
);
19375 ffesymbol_set_info (s
,
19376 ffeinfo_new (ffesymbol_basictype (s
),
19377 ffesymbol_kindtype (s
),
19379 FFEINFO_kindFUNCTION
,
19380 FFEINFO_whereINTRINSIC
,
19381 ffesymbol_size (s
)));
19384 { /* Not intrinsic, now needs CHAR type. */
19385 if (!ffeimplic_establish_symbol (s
))
19387 ffesymbol_error (s
, ffeexpr_stack_
->tokens
[0]);
19388 return (ffelexHandler
) ffeexpr_token_arguments_ (ft
, expr
, t
);
19391 ffesymbol_set_info (s
,
19392 ffeinfo_new (ffesymbol_basictype (s
),
19393 ffesymbol_kindtype (s
),
19394 ffesymbol_rank (s
),
19395 FFEINFO_kindFUNCTION
,
19396 (where
== FFEINFO_whereNONE
)
19397 ? FFEINFO_whereGLOBAL
19399 ffesymbol_size (s
)));
19402 ffebld_set_info (symter
, ffeinfo_use (ffesymbol_info (s
)));
19404 ffesymbol_set_state (s
, FFESYMBOL_stateUNDERSTOOD
);
19405 ffesymbol_resolve_intrin (s
);
19406 s
= ffecom_sym_learned (s
);
19407 ffesymbol_reference (s
, ffeexpr_stack_
->tokens
[0], FALSE
);
19408 ffesymbol_signal_unreported (s
); /* For debugging purposes. */
19409 ffebld_init_list (&ffeexpr_stack_
->expr
, &ffeexpr_stack_
->bottom
);
19410 return (ffelexHandler
) ffeexpr_token_arguments_ (ft
, expr
, t
);
19413 /* ffeexpr_token_anything_ -- NAME OPEN_PAREN any-expr
19415 Handle basically any expression, looking for CLOSE_PAREN. */
19417 static ffelexHandler
19418 ffeexpr_token_anything_ (ffelexToken ft UNUSED
, ffebld expr UNUSED
,
19421 ffeexprExpr_ e
= ffeexpr_stack_
->exprstack
;
19423 switch (ffelex_token_type (t
))
19425 case FFELEX_typeCOMMA
:
19426 case FFELEX_typeCOLON
:
19427 return (ffelexHandler
) ffeexpr_rhs (ffeexpr_stack_
->pool
,
19428 FFEEXPR_contextACTUALARG_
,
19429 ffeexpr_token_anything_
);
19432 e
->u
.operand
= ffebld_new_any ();
19433 ffebld_set_info (e
->u
.operand
, ffeinfo_new_any ());
19434 ffelex_token_kill (ffeexpr_stack_
->tokens
[0]);
19435 ffeexpr_is_substr_ok_
= FALSE
;
19436 if (ffelex_token_type (t
) == FFELEX_typeCLOSE_PAREN
)
19437 return (ffelexHandler
) ffeexpr_token_substrp_
;
19438 return (ffelexHandler
) ffeexpr_token_substrp_ (t
);
19442 /* Terminate module. */
19445 ffeexpr_terminate_2 ()
19447 assert (ffeexpr_stack_
== NULL
);
19448 assert (ffeexpr_level_
== 0);