blob: bf456a1afc13415cc68e430b2165cf6fd46f0466 [file] [log] [blame]
/* stb.c -- Implementation File (module.c template V1.0)
Copyright (C) 1995, 1996, 2002 Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
GNU Fortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Fortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Fortran; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
Related Modules:
st.c
Description:
Parses the proper form for statements, builds up expression trees for
them, but does not actually implement them. Uses ffebad (primarily via
ffesta_ffebad_start) to indicate errors in form. In many cases, an invalid
statement form indicates another possible statement needs to be looked at
by ffest. In a few cases, a valid statement form might not completely
determine the nature of the statement, as in REALFUNCTIONA(B), which is
a valid form for either the first statement of a function named A taking
an argument named B or for the declaration of a real array named FUNCTIONA
with an adjustable size of B. A similar (though somewhat easier) choice
must be made for the statement-function-def vs. assignment forms, as in
the case of FOO(A) = A+2.0.
A given parser consists of one or more state handlers, the first of which
is the initial state, and the last of which (for any given input) returns
control to a final state handler (ffesta_zero or ffesta_two, explained
below). The functions handling the states for a given parser usually have
the same names, differing only in the final number, as in ffestb_foo_
(handles the initial state), ffestb_foo_1_, ffestb_foo_2_ (handle
subsequent states), although liberties sometimes are taken with the "foo"
part either when keywords are clarified into given statements or are
transferred into other possible areas. (For example, the type-name
states can hop over to _dummy_ functions when the FUNCTION or RECURSIVE
keywords are seen, though this kind of thing is kept to a minimum.) Only
the names without numbers are exported to the rest of ffest; the others
are local (static).
Each initial state is provided with the first token in ffesta_tokens[0],
which will be killed upon return to the final state (ffesta_zero or
ffelex_swallow_tokens passed through to ffesta_zero), so while it may
be changed to another token, a valid token must be left there to be
killed. Also, a "convenient" array of tokens are left in
ffesta_tokens[1..FFESTA_tokensMAX]. The initial state of this set of
elements is undefined, thus, if tokens are stored here, they must be
killed before returning to the final state. Any parser may also use
cross-state local variables by sticking a structure containing storage
for those variables in the local union ffestb_local_ (unless the union
goes on strike). Furthermore, parsers that handle more than one first or
second tokens (like _varlist_, which handles EXTERNAL, INTENT, INTRINSIC,
OPTIONAL,
PUBLIC, or PRIVATE, and _endxyz_, which handles ENDBLOCK, ENDBLOCKDATA,
ENDDO, ENDIF, and so on) may expect arguments from ffest in the
ffest-wide union ffest_args_, the substructure specific to the parser.
A parser's responsibility is: to call either ffesta_confirmed or
ffest_ffebad_start before returning to the final state; to be the only
parser that can possibly call ffesta_confirmed for a given statement;
to call ffest_ffebad_start immediately upon recognizing a bad token
(specifically one that another statement parser might confirm upon);
to call ffestc functions only after calling ffesta_confirmed and only
when ffesta_is_inhibited returns FALSE; and to call ffesta_is_inhibited
only after calling ffesta_confirmed. Confirm as early as reasonably
possible, even when only one ffestc function is called for the statement
later on, because early confirmation can enhance the error-reporting
capabilities if a subsequent error is detected and this parser isn't
the first possibility for the statement.
To assist the parser, functions like ffesta_ffebad_1t and _1p_ have
been provided to make use of ffest_ffebad_start fairly easy.
Modifications:
*/
/* Include files. */
#include "proj.h"
#include "stb.h"
#include "bad.h"
#include "expr.h"
#include "lex.h"
#include "malloc.h"
#include "src.h"
#include "sta.h"
#include "stc.h"
#include "stp.h"
#include "str.h"
/* Externals defined here. */
struct _ffestb_args_ ffestb_args;
/* Simple definitions and enumerations. */
#define FFESTB_KILL_EASY_ 1 /* 1 for only one _subr_kill_xyz_ fn. */
/* Internal typedefs. */
union ffestb_subrargs_u_
{
struct
{
ffesttTokenList labels; /* Input arg, must not be NULL. */
ffelexHandler handler; /* Input arg, call me when done. */
bool ok; /* Output arg, TRUE if list ended in
CLOSE_PAREN. */
}
label_list;
struct
{
ffesttDimList dims; /* Input arg, must not be NULL. */
ffelexHandler handler; /* Input arg, call me when done. */
mallocPool pool; /* Pool to allocate into. */
bool ok; /* Output arg, TRUE if list ended in
CLOSE_PAREN. */
ffeexprContext ctx; /* DIMLIST or DIMLISTCOMMON. */
#ifdef FFECOM_dimensionsMAX
int ndims; /* For backends that really can't have
infinite dims. */
#endif
}
dim_list;
struct
{
ffesttTokenList args; /* Input arg, must not be NULL. */
ffelexHandler handler; /* Input arg, call me when done. */
ffelexToken close_paren;/* Output arg if ok, CLOSE_PAREN token. */
bool is_subr; /* Input arg, TRUE if list in subr-def
context. */
bool ok; /* Output arg, TRUE if list ended in
CLOSE_PAREN. */
bool names; /* Do ffelex_set_names(TRUE) before return. */
}
name_list;
};
union ffestb_local_u_
{
struct
{
ffebld expr;
}
call_stmt;
struct
{
ffebld expr;
}
go_to;
struct
{
ffebld dest;
bool vxtparam; /* If assignment might really be VXT
PARAMETER stmt. */
}
let;
struct
{
ffebld expr;
}
if_stmt;
struct
{
ffebld expr;
}
else_stmt;
struct
{
ffebld expr;
}
dowhile;
struct
{
ffebld var;
ffebld start;
ffebld end;
}
do_stmt;
struct
{
bool is_cblock;
}
R522;
struct
{
ffebld expr;
bool started;
}
parameter;
struct
{
ffesttExprList exprs;
bool started;
}
equivalence;
struct
{
ffebld expr;
bool started;
}
data;
struct
{
ffestrOther kw;
}
varlist;
#if FFESTR_F90
struct
{
ffestrOther kw;
}
type;
#endif
struct
{
ffelexHandler next;
}
construct;
struct
{
ffesttFormatList f;
ffestpFormatType current; /* What we're currently working on. */
ffelexToken t; /* Token of what we're currently working on. */
ffesttFormatValue pre;
ffesttFormatValue post;
ffesttFormatValue dot;
ffesttFormatValue exp;
bool sign; /* _3_, pos/neg; elsewhere, signed/unsigned. */
bool complained; /* If run-time expr seen in nonexec context. */
}
format;
#if FFESTR_F90
struct
{
bool started;
}
moduleprocedure;
#endif
struct
{
ffebld expr;
}
selectcase;
struct
{
ffesttCaseList cases;
}
case_stmt;
#if FFESTR_F90
struct
{
ffesttExprList exprs;
ffebld expr;
}
heap;
#endif
#if FFESTR_F90
struct
{
ffesttExprList exprs;
}
R624;
#endif
#if FFESTR_F90
struct
{
ffestpDefinedOperator operator;
bool assignment; /* TRUE for INTERFACE ASSIGNMENT, FALSE for
...OPERATOR. */
bool slash; /* TRUE if OPEN_ARRAY, FALSE if OPEN_PAREN. */
}
interface;
#endif
struct
{
bool is_cblock;
}
V014;
#if FFESTR_VXT
struct
{
bool started;
ffebld u;
ffebld m;
ffebld n;
ffebld asv;
}
V025;
#endif
struct
{
ffestpBeruIx ix;
bool label;
bool left;
ffeexprContext context;
}
beru;
struct
{
ffestpCloseIx ix;
bool label;
bool left;
ffeexprContext context;
}
close;
struct
{
ffestpDeleteIx ix;
bool label;
bool left;
ffeexprContext context;
}
delete;
struct
{
ffestpDeleteIx ix;
bool label;
bool left;
ffeexprContext context;
}
find;
struct
{
ffestpInquireIx ix;
bool label;
bool left;
ffeexprContext context;
bool may_be_iolength;
}
inquire;
struct
{
ffestpOpenIx ix;
bool label;
bool left;
ffeexprContext context;
}
open;
struct
{
ffestpReadIx ix;
bool label;
bool left;
ffeexprContext context;
}
read;
struct
{
ffestpRewriteIx ix;
bool label;
bool left;
ffeexprContext context;
}
rewrite;
struct
{
ffestpWriteIx ix;
bool label;
bool left;
ffeexprContext context;
}
vxtcode;
struct
{
ffestpWriteIx ix;
bool label;
bool left;
ffeexprContext context;
}
write;
#if FFESTR_F90
struct
{
bool started;
}
structure;
#endif
struct
{
bool started;
}
common;
struct
{
bool started;
}
dimension;
struct
{
bool started;
}
dimlist;
struct
{
const char *badname;
ffestrFirst first_kw;
bool is_subr;
}
dummy;
struct
{
ffebld kind; /* Kind type parameter, if any. */
ffelexToken kindt; /* Kind type first token, if any. */
ffebld len; /* Length type parameter, if any. */
ffelexToken lent; /* Length type parameter, if any. */
ffelexHandler handler;
ffelexToken recursive;
ffebld expr;
ffesttTokenList toklist;/* For ambiguity resolution. */
ffesttImpList imps; /* List of IMPLICIT letters. */
ffelexHandler imp_handler; /* Call if paren list wasn't letters. */
const char *badname;
ffestrOther kw; /* INTENT(IN/OUT/INOUT). */
ffestpType type;
bool parameter; /* If PARAMETER attribute seen (governs =expr
context). */
bool coloncolon; /* If COLONCOLON seen (allows =expr). */
bool aster_after; /* "*" seen after, not before,
[RECURSIVE]FUNCTIONxyz. */
bool empty; /* Ambig function dummy arg list empty so
far? */
bool imp_started; /* Started IMPLICIT statement already. */
bool imp_seen_comma; /* TRUE if next COMMA within parens means not
R541. */
}
decl;
struct
{
bool started;
}
vxtparam;
}; /* Merge with the one in ffestb later. */
/* Private include files. */
/* Internal structure definitions. */
/* Static objects accessed by functions in this module. */
static union ffestb_subrargs_u_ ffestb_subrargs_;
static union ffestb_local_u_ ffestb_local_;
/* Static functions (internal). */
static void ffestb_subr_ambig_to_ents_ (void);
static ffelexHandler ffestb_subr_ambig_nope_ (ffelexToken t);
static ffelexHandler ffestb_subr_dimlist_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_subr_dimlist_1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_subr_dimlist_2_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_subr_name_list_ (ffelexToken t);
static ffelexHandler ffestb_subr_name_list_1_ (ffelexToken t);
static void ffestb_subr_R1001_append_p_ (void);
static ffelexHandler ffestb_decl_kindparam_ (ffelexToken t);
static ffelexHandler ffestb_decl_kindparam_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_kindparam_2_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_starkind_ (ffelexToken t);
static ffelexHandler ffestb_decl_starlen_ (ffelexToken t);
static ffelexHandler ffestb_decl_starlen_1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_typeparams_ (ffelexToken t);
static ffelexHandler ffestb_decl_typeparams_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_typeparams_2_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_typeparams_3_ (ffelexToken ft, ffebld expr,
ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_decl_typetype1_ (ffelexToken t);
static ffelexHandler ffestb_decl_typetype2_ (ffelexToken t);
#endif
static ffelexHandler ffestb_subr_label_list_ (ffelexToken t);
static ffelexHandler ffestb_subr_label_list_1_ (ffelexToken t);
static ffelexHandler ffestb_do1_ (ffelexToken t);
static ffelexHandler ffestb_do2_ (ffelexToken t);
static ffelexHandler ffestb_do3_ (ffelexToken t);
static ffelexHandler ffestb_do4_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_do5_ (ffelexToken t);
static ffelexHandler ffestb_do6_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_do7_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_do8_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_do9_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_else1_ (ffelexToken t);
static ffelexHandler ffestb_else2_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_else3_ (ffelexToken t);
static ffelexHandler ffestb_else4_ (ffelexToken t);
static ffelexHandler ffestb_else5_ (ffelexToken t);
static ffelexHandler ffestb_end1_ (ffelexToken t);
static ffelexHandler ffestb_end2_ (ffelexToken t);
static ffelexHandler ffestb_end3_ (ffelexToken t);
static ffelexHandler ffestb_goto1_ (ffelexToken t);
static ffelexHandler ffestb_goto2_ (ffelexToken t);
static ffelexHandler ffestb_goto3_ (ffelexToken t);
static ffelexHandler ffestb_goto4_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_goto5_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_goto6_ (ffelexToken t);
static ffelexHandler ffestb_goto7_ (ffelexToken t);
static ffelexHandler ffestb_halt1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_if1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_if2_ (ffelexToken t);
static ffelexHandler ffestb_if3_ (ffelexToken t);
static ffelexHandler ffestb_let1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_let2_ (ffelexToken ft, ffebld expr,
ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_type1_ (ffelexToken t);
static ffelexHandler ffestb_type2_ (ffelexToken t);
static ffelexHandler ffestb_type3_ (ffelexToken t);
static ffelexHandler ffestb_type4_ (ffelexToken t);
#endif
#if FFESTR_F90
static ffelexHandler ffestb_varlist1_ (ffelexToken t);
static ffelexHandler ffestb_varlist2_ (ffelexToken t);
static ffelexHandler ffestb_varlist3_ (ffelexToken t);
static ffelexHandler ffestb_varlist4_ (ffelexToken t);
#endif
static ffelexHandler ffestb_varlist5_ (ffelexToken t);
static ffelexHandler ffestb_varlist6_ (ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_where1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_where2_ (ffelexToken t);
static ffelexHandler ffestb_where3_ (ffelexToken t);
#endif
static ffelexHandler ffestb_R5221_ (ffelexToken t);
static ffelexHandler ffestb_R5222_ (ffelexToken t);
static ffelexHandler ffestb_R5223_ (ffelexToken t);
static ffelexHandler ffestb_R5224_ (ffelexToken t);
static ffelexHandler ffestb_R5281_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R5282_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R5283_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R5284_ (ffelexToken t);
static ffelexHandler ffestb_R5371_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R5372_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R5373_ (ffelexToken t);
static ffelexHandler ffestb_R5421_ (ffelexToken t);
static ffelexHandler ffestb_R5422_ (ffelexToken t);
static ffelexHandler ffestb_R5423_ (ffelexToken t);
static ffelexHandler ffestb_R5424_ (ffelexToken t);
static ffelexHandler ffestb_R5425_ (ffelexToken t);
static ffelexHandler ffestb_R5441_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R5442_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R5443_ (ffelexToken t);
static ffelexHandler ffestb_R5444_ (ffelexToken t);
static ffelexHandler ffestb_R8341_ (ffelexToken t);
static ffelexHandler ffestb_R8351_ (ffelexToken t);
static ffelexHandler ffestb_R8381_ (ffelexToken t);
static ffelexHandler ffestb_R8382_ (ffelexToken t);
static ffelexHandler ffestb_R8383_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R8401_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R8402_ (ffelexToken t);
static ffelexHandler ffestb_R8403_ (ffelexToken t);
static ffelexHandler ffestb_R8404_ (ffelexToken t);
static ffelexHandler ffestb_R8405_ (ffelexToken t);
static ffelexHandler ffestb_R8406_ (ffelexToken t);
static ffelexHandler ffestb_R8407_ (ffelexToken t);
static ffelexHandler ffestb_R11021_ (ffelexToken t);
static ffelexHandler ffestb_R1111_1_ (ffelexToken t);
static ffelexHandler ffestb_R1111_2_ (ffelexToken t);
static ffelexHandler ffestb_R12121_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R12271_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_construct1_ (ffelexToken t);
static ffelexHandler ffestb_construct2_ (ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_heap1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_heap2_ (ffelexToken t);
static ffelexHandler ffestb_heap3_ (ffelexToken t);
static ffelexHandler ffestb_heap4_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_heap5_ (ffelexToken t);
#endif
#if FFESTR_F90
static ffelexHandler ffestb_module1_ (ffelexToken t);
static ffelexHandler ffestb_module2_ (ffelexToken t);
static ffelexHandler ffestb_module3_ (ffelexToken t);
#endif
static ffelexHandler ffestb_R8091_ (ffelexToken t);
static ffelexHandler ffestb_R8092_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R8093_ (ffelexToken t);
static ffelexHandler ffestb_R8101_ (ffelexToken t);
static ffelexHandler ffestb_R8102_ (ffelexToken t);
static ffelexHandler ffestb_R8103_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R8104_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R10011_ (ffelexToken t);
static ffelexHandler ffestb_R10012_ (ffelexToken t);
static ffelexHandler ffestb_R10013_ (ffelexToken t);
static ffelexHandler ffestb_R10014_ (ffelexToken t);
static ffelexHandler ffestb_R10015_ (ffelexToken t);
static ffelexHandler ffestb_R10016_ (ffelexToken t);
static ffelexHandler ffestb_R10017_ (ffelexToken t);
static ffelexHandler ffestb_R10018_ (ffelexToken t);
static ffelexHandler ffestb_R10019_ (ffelexToken t);
static ffelexHandler ffestb_R100110_ (ffelexToken t);
static ffelexHandler ffestb_R100111_ (ffelexToken t);
static ffelexHandler ffestb_R100112_ (ffelexToken t);
static ffelexHandler ffestb_R100113_ (ffelexToken t);
static ffelexHandler ffestb_R100114_ (ffelexToken t);
static ffelexHandler ffestb_R100115_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R100116_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R100117_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R100118_ (ffelexToken ft, ffebld expr,
ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_R11071_ (ffelexToken t);
static ffelexHandler ffestb_R11072_ (ffelexToken t);
static ffelexHandler ffestb_R11073_ (ffelexToken t);
static ffelexHandler ffestb_R11074_ (ffelexToken t);
static ffelexHandler ffestb_R11075_ (ffelexToken t);
static ffelexHandler ffestb_R11076_ (ffelexToken t);
static ffelexHandler ffestb_R11077_ (ffelexToken t);
static ffelexHandler ffestb_R11078_ (ffelexToken t);
static ffelexHandler ffestb_R11079_ (ffelexToken t);
static ffelexHandler ffestb_R110710_ (ffelexToken t);
static ffelexHandler ffestb_R110711_ (ffelexToken t);
static ffelexHandler ffestb_R110712_ (ffelexToken t);
#endif
#if FFESTR_F90
static ffelexHandler ffestb_R12021_ (ffelexToken t);
static ffelexHandler ffestb_R12022_ (ffelexToken t);
static ffelexHandler ffestb_R12023_ (ffelexToken t);
static ffelexHandler ffestb_R12024_ (ffelexToken t);
static ffelexHandler ffestb_R12025_ (ffelexToken t);
static ffelexHandler ffestb_R12026_ (ffelexToken t);
#endif
static ffelexHandler ffestb_S3P41_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0141_ (ffelexToken t);
static ffelexHandler ffestb_V0142_ (ffelexToken t);
static ffelexHandler ffestb_V0143_ (ffelexToken t);
static ffelexHandler ffestb_V0144_ (ffelexToken t);
#if FFESTR_VXT
static ffelexHandler ffestb_V0251_ (ffelexToken t);
static ffelexHandler ffestb_V0252_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0253_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0254_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0255_ (ffelexToken t);
static ffelexHandler ffestb_V0256_ (ffelexToken t);
static ffelexHandler ffestb_V0257_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0258_ (ffelexToken t);
#endif
#if FFESTB_KILL_EASY_
static void ffestb_subr_kill_easy_ (ffestpInquireIx max);
#else
static void ffestb_subr_kill_accept_ (void);
static void ffestb_subr_kill_beru_ (void);
static void ffestb_subr_kill_close_ (void);
static void ffestb_subr_kill_delete_ (void);
static void ffestb_subr_kill_find_ (void); /* Not written yet. */
static void ffestb_subr_kill_inquire_ (void);
static void ffestb_subr_kill_open_ (void);
static void ffestb_subr_kill_print_ (void);
static void ffestb_subr_kill_read_ (void);
static void ffestb_subr_kill_rewrite_ (void);
static void ffestb_subr_kill_type_ (void);
static void ffestb_subr_kill_vxtcode_ (void); /* Not written yet. */
static void ffestb_subr_kill_write_ (void);
#endif
static ffelexHandler ffestb_beru1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_beru2_ (ffelexToken t);
static ffelexHandler ffestb_beru3_ (ffelexToken t);
static ffelexHandler ffestb_beru4_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_beru5_ (ffelexToken t);
static ffelexHandler ffestb_beru6_ (ffelexToken t);
static ffelexHandler ffestb_beru7_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_beru8_ (ffelexToken t);
static ffelexHandler ffestb_beru9_ (ffelexToken t);
static ffelexHandler ffestb_beru10_ (ffelexToken t);
#if FFESTR_VXT
static ffelexHandler ffestb_vxtcode1_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_vxtcode2_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_vxtcode3_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_vxtcode4_ (ffelexToken t);
static ffelexHandler ffestb_vxtcode5_ (ffelexToken t);
static ffelexHandler ffestb_vxtcode6_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_vxtcode7_ (ffelexToken t);
static ffelexHandler ffestb_vxtcode8_ (ffelexToken t);
static ffelexHandler ffestb_vxtcode9_ (ffelexToken t);
static ffelexHandler ffestb_vxtcode10_ (ffelexToken ft, ffebld expr,
ffelexToken t);
#endif
static ffelexHandler ffestb_R9041_ (ffelexToken t);
static ffelexHandler ffestb_R9042_ (ffelexToken t);
static ffelexHandler ffestb_R9043_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9044_ (ffelexToken t);
static ffelexHandler ffestb_R9045_ (ffelexToken t);
static ffelexHandler ffestb_R9046_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9047_ (ffelexToken t);
static ffelexHandler ffestb_R9048_ (ffelexToken t);
static ffelexHandler ffestb_R9049_ (ffelexToken t);
static ffelexHandler ffestb_R9071_ (ffelexToken t);
static ffelexHandler ffestb_R9072_ (ffelexToken t);
static ffelexHandler ffestb_R9073_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9074_ (ffelexToken t);
static ffelexHandler ffestb_R9075_ (ffelexToken t);
static ffelexHandler ffestb_R9076_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9077_ (ffelexToken t);
static ffelexHandler ffestb_R9078_ (ffelexToken t);
static ffelexHandler ffestb_R9079_ (ffelexToken t);
static ffelexHandler ffestb_R9091_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9092_ (ffelexToken t);
static ffelexHandler ffestb_R9093_ (ffelexToken t);
static ffelexHandler ffestb_R9094_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9095_ (ffelexToken t);
static ffelexHandler ffestb_R9096_ (ffelexToken t);
static ffelexHandler ffestb_R9097_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9098_ (ffelexToken t);
static ffelexHandler ffestb_R9099_ (ffelexToken t);
static ffelexHandler ffestb_R90910_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R90911_ (ffelexToken t);
static ffelexHandler ffestb_R90912_ (ffelexToken t);
static ffelexHandler ffestb_R90913_ (ffelexToken t);
static ffelexHandler ffestb_R90914_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R90915_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9101_ (ffelexToken t);
static ffelexHandler ffestb_R9102_ (ffelexToken t);
static ffelexHandler ffestb_R9103_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9104_ (ffelexToken t);
static ffelexHandler ffestb_R9105_ (ffelexToken t);
static ffelexHandler ffestb_R9106_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9107_ (ffelexToken t);
static ffelexHandler ffestb_R9108_ (ffelexToken t);
static ffelexHandler ffestb_R9109_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R91010_ (ffelexToken t);
static ffelexHandler ffestb_R91011_ (ffelexToken t);
static ffelexHandler ffestb_R91012_ (ffelexToken t);
static ffelexHandler ffestb_R91013_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R91014_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9111_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9112_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9231_ (ffelexToken t);
static ffelexHandler ffestb_R9232_ (ffelexToken t);
static ffelexHandler ffestb_R9233_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9234_ (ffelexToken t);
static ffelexHandler ffestb_R9235_ (ffelexToken t);
static ffelexHandler ffestb_R9236_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R9237_ (ffelexToken t);
static ffelexHandler ffestb_R9238_ (ffelexToken t);
static ffelexHandler ffestb_R9239_ (ffelexToken t);
static ffelexHandler ffestb_R92310_ (ffelexToken t);
static ffelexHandler ffestb_R92311_ (ffelexToken ft, ffebld expr,
ffelexToken t);
#if FFESTR_VXT
static ffelexHandler ffestb_V0181_ (ffelexToken t);
static ffelexHandler ffestb_V0182_ (ffelexToken t);
static ffelexHandler ffestb_V0183_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0184_ (ffelexToken t);
static ffelexHandler ffestb_V0185_ (ffelexToken t);
static ffelexHandler ffestb_V0186_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0187_ (ffelexToken t);
static ffelexHandler ffestb_V0188_ (ffelexToken t);
static ffelexHandler ffestb_V0189_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V01810_ (ffelexToken t);
static ffelexHandler ffestb_V01811_ (ffelexToken t);
static ffelexHandler ffestb_V01812_ (ffelexToken t);
static ffelexHandler ffestb_V01813_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0191_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0192_ (ffelexToken ft, ffebld expr,
ffelexToken t);
#endif
static ffelexHandler ffestb_V0201_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0202_ (ffelexToken ft, ffebld expr,
ffelexToken t);
#if FFESTR_VXT
static ffelexHandler ffestb_V0211_ (ffelexToken t);
static ffelexHandler ffestb_V0212_ (ffelexToken t);
static ffelexHandler ffestb_V0213_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0214_ (ffelexToken t);
static ffelexHandler ffestb_V0215_ (ffelexToken t);
static ffelexHandler ffestb_V0216_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0217_ (ffelexToken t);
static ffelexHandler ffestb_V0218_ (ffelexToken t);
static ffelexHandler ffestb_V0219_ (ffelexToken t);
static ffelexHandler ffestb_V0261_ (ffelexToken t);
static ffelexHandler ffestb_V0262_ (ffelexToken t);
static ffelexHandler ffestb_V0263_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0264_ (ffelexToken t);
static ffelexHandler ffestb_V0265_ (ffelexToken t);
static ffelexHandler ffestb_V0266_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0267_ (ffelexToken t);
static ffelexHandler ffestb_V0268_ (ffelexToken t);
static ffelexHandler ffestb_V0269_ (ffelexToken t);
#endif
#if FFESTR_F90
static ffelexHandler ffestb_dimlist1_ (ffelexToken t);
static ffelexHandler ffestb_dimlist2_ (ffelexToken t);
static ffelexHandler ffestb_dimlist3_ (ffelexToken t);
static ffelexHandler ffestb_dimlist4_ (ffelexToken t);
#endif
static ffelexHandler ffestb_dummy1_ (ffelexToken t);
static ffelexHandler ffestb_dummy2_ (ffelexToken t);
static ffelexHandler ffestb_R5241_ (ffelexToken t);
static ffelexHandler ffestb_R5242_ (ffelexToken t);
static ffelexHandler ffestb_R5243_ (ffelexToken t);
static ffelexHandler ffestb_R5244_ (ffelexToken t);
static ffelexHandler ffestb_R5471_ (ffelexToken t);
static ffelexHandler ffestb_R5472_ (ffelexToken t);
static ffelexHandler ffestb_R5473_ (ffelexToken t);
static ffelexHandler ffestb_R5474_ (ffelexToken t);
static ffelexHandler ffestb_R5475_ (ffelexToken t);
static ffelexHandler ffestb_R5476_ (ffelexToken t);
static ffelexHandler ffestb_R5477_ (ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_R6241_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_R6242_ (ffelexToken t);
#endif
static ffelexHandler ffestb_R12291_ (ffelexToken t);
static ffelexHandler ffestb_R12292_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_chartype1_ (ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_decl_recursive1_ (ffelexToken t);
static ffelexHandler ffestb_decl_recursive2_ (ffelexToken t);
static ffelexHandler ffestb_decl_recursive3_ (ffelexToken t);
static ffelexHandler ffestb_decl_recursive4_ (ffelexToken t);
#endif
static ffelexHandler ffestb_decl_attrs_ (ffelexToken t);
static ffelexHandler ffestb_decl_attrs_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_attrs_2_ (ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_decl_attrs_3_ (ffelexToken t);
static ffelexHandler ffestb_decl_attrs_4_ (ffelexToken t);
static ffelexHandler ffestb_decl_attrs_5_ (ffelexToken t);
static ffelexHandler ffestb_decl_attrs_6_ (ffelexToken t);
#endif
static ffelexHandler ffestb_decl_attrs_7_ (ffelexToken t);
static ffelexHandler ffestb_decl_attrsp_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_2_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_3_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_4_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_5_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_6_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_ents_7_ (ffelexToken t);
static ffelexHandler ffestb_decl_ents_8_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_ents_9_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_ents_10_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_ents_11_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_2_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_3_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_4_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_entsp_5_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_6_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_7_ (ffelexToken t);
static ffelexHandler ffestb_decl_entsp_8_ (ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_decl_func_ (ffelexToken t);
#endif
static ffelexHandler ffestb_decl_funcname_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_2_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_3_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_decl_funcname_4_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_5_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_6_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_7_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_8_ (ffelexToken t);
static ffelexHandler ffestb_decl_funcname_9_ (ffelexToken t);
#if FFESTR_VXT
static ffelexHandler ffestb_V0031_ (ffelexToken t);
static ffelexHandler ffestb_V0032_ (ffelexToken t);
static ffelexHandler ffestb_V0033_ (ffelexToken t);
static ffelexHandler ffestb_V0034_ (ffelexToken t);
static ffelexHandler ffestb_V0035_ (ffelexToken t);
static ffelexHandler ffestb_V0036_ (ffelexToken t);
static ffelexHandler ffestb_V0161_ (ffelexToken t);
static ffelexHandler ffestb_V0162_ (ffelexToken t);
static ffelexHandler ffestb_V0163_ (ffelexToken t);
static ffelexHandler ffestb_V0164_ (ffelexToken t);
static ffelexHandler ffestb_V0165_ (ffelexToken t);
static ffelexHandler ffestb_V0166_ (ffelexToken t);
#endif
static ffelexHandler ffestb_V0271_ (ffelexToken t);
static ffelexHandler ffestb_V0272_ (ffelexToken ft, ffebld expr,
ffelexToken t);
static ffelexHandler ffestb_V0273_ (ffelexToken t);
static ffelexHandler ffestb_decl_R5391_ (ffelexToken t);
static ffelexHandler ffestb_decl_R5392_ (ffelexToken t);
#if FFESTR_F90
static ffelexHandler ffestb_decl_R5393_ (ffelexToken t);
#endif
static ffelexHandler ffestb_decl_R5394_ (ffelexToken t);
static ffelexHandler ffestb_decl_R5395_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539letters_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539letters_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539letters_2_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539letters_3_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539letters_4_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539letters_5_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539maybe_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539maybe_1_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539maybe_2_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539maybe_3_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539maybe_4_ (ffelexToken t);
static ffelexHandler ffestb_decl_R539maybe_5_ (ffelexToken t);
/* Internal macros. */
#if FFESTB_KILL_EASY_
#define ffestb_subr_kill_accept_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_acceptix)
#define ffestb_subr_kill_beru_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_beruix)
#define ffestb_subr_kill_close_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_closeix)
#define ffestb_subr_kill_delete_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_deleteix)
#define ffestb_subr_kill_find_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_findix)
#define ffestb_subr_kill_inquire_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_inquireix)
#define ffestb_subr_kill_open_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_openix)
#define ffestb_subr_kill_print_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_printix)
#define ffestb_subr_kill_read_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_readix)
#define ffestb_subr_kill_rewrite_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_rewriteix)
#define ffestb_subr_kill_type_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_typeix)
#define ffestb_subr_kill_vxtcode_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_vxtcodeix)
#define ffestb_subr_kill_write_() \
ffestb_subr_kill_easy_((ffestpInquireIx) FFESTP_writeix)
#endif
/* ffestb_subr_ambig_nope_ -- Cleans up and aborts ambig w/o confirming
ffestb_subr_ambig_nope_();
Switch from ambiguity handling in _entsp_ functions to handling entities
in _ents_ (perform housekeeping tasks). */
static ffelexHandler
ffestb_subr_ambig_nope_ (ffelexToken t)
{
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
if (ffestb_local_.decl.kindt != NULL)
ffelex_token_kill (ffestb_local_.decl.kindt);
if (ffestb_local_.decl.lent != NULL)
ffelex_token_kill (ffestb_local_.decl.lent);
ffelex_token_kill (ffesta_tokens[1]);
ffelex_token_kill (ffesta_tokens[2]);
ffestt_tokenlist_kill (ffestb_local_.decl.toklist);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "FUNCTION", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_subr_ambig_to_ents_ -- Switches from ambiguity to entity decl
ffestb_subr_ambig_to_ents_();
Switch from ambiguity handling in _entsp_ functions to handling entities
in _ents_ (perform housekeeping tasks). */
static void
ffestb_subr_ambig_to_ents_ ()
{
ffelexToken nt;
nt = ffelex_token_name_from_names (ffesta_tokens[1], 0, 0);
ffelex_token_kill (ffesta_tokens[1]);
ffelex_token_kill (ffesta_tokens[2]);
ffesta_tokens[1] = nt;
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
if (!ffestb_local_.decl.aster_after)
{
if (ffestb_local_.decl.type == FFESTP_typeCHARACTER)
{
if (!ffesta_is_inhibited ())
ffestc_decl_start (ffestb_local_.decl.type, ffesta_tokens[0],
ffestb_local_.decl.kind, ffestb_local_.decl.kindt,
ffestb_local_.decl.len, ffestb_local_.decl.lent);
if (ffestb_local_.decl.kindt != NULL)
{
ffelex_token_kill (ffestb_local_.decl.kindt);
ffestb_local_.decl.kind = NULL;
ffestb_local_.decl.kindt = NULL;
}
if (ffestb_local_.decl.lent != NULL)
{
ffelex_token_kill (ffestb_local_.decl.lent);
ffestb_local_.decl.len = NULL;
ffestb_local_.decl.lent = NULL;
}
}
else
{
if (!ffesta_is_inhibited ())
ffestc_decl_start (ffestb_local_.decl.type, ffesta_tokens[0],
ffestb_local_.decl.kind, ffestb_local_.decl.kindt, NULL,
NULL);
if (ffestb_local_.decl.kindt != NULL)
{
ffelex_token_kill (ffestb_local_.decl.kindt);
ffestb_local_.decl.kind = NULL;
ffestb_local_.decl.kindt = NULL;
}
}
return;
}
if (ffestb_local_.decl.type == FFESTP_typeCHARACTER)
{
if (!ffesta_is_inhibited ())
ffestc_decl_start (ffestb_local_.decl.type, ffesta_tokens[0],
ffestb_local_.decl.kind, ffestb_local_.decl.kindt, NULL, NULL);
if (ffestb_local_.decl.kindt != NULL)
{
ffelex_token_kill (ffestb_local_.decl.kindt);
ffestb_local_.decl.kind = NULL;
ffestb_local_.decl.kindt = NULL;
}
}
else if (!ffesta_is_inhibited ())
ffestc_decl_start (ffestb_local_.decl.type, ffesta_tokens[0],
NULL, NULL, NULL, NULL);
/* NAME/NAMES token already in ffesta_tokens[1]. */
}
/* ffestb_subr_dimlist_ -- OPEN_PAREN expr
(ffestb_subr_dimlist_) // to expression handler
Deal with a dimension list.
19-Dec-90 JCB 1.1
Detect too many dimensions if backend wants it. */
static ffelexHandler
ffestb_subr_dimlist_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
if (expr == NULL)
break;
#ifdef FFECOM_dimensionsMAX
if (ffestb_subrargs_.dim_list.ndims++ == FFECOM_dimensionsMAX)
{
ffesta_ffebad_1t (FFEBAD_TOO_MANY_DIMS, ft);
ffestb_subrargs_.dim_list.ok = TRUE; /* Not a parse error, really. */
return (ffelexHandler) ffestb_subrargs_.dim_list.handler;
}
#endif
ffestt_dimlist_append (ffestb_subrargs_.dim_list.dims, NULL, expr,
ffelex_token_use (t));
ffestb_subrargs_.dim_list.ok = TRUE;
return (ffelexHandler) ffestb_subrargs_.dim_list.handler;
case FFELEX_typeCOMMA:
if ((expr != NULL) && (ffebld_op (expr) == FFEBLD_opSTAR))
break;
#ifdef FFECOM_dimensionsMAX
if (ffestb_subrargs_.dim_list.ndims++ == FFECOM_dimensionsMAX)
{
ffesta_ffebad_1t (FFEBAD_TOO_MANY_DIMS, ft);
return (ffelexHandler) ffeexpr_rhs (ffestb_subrargs_.dim_list.pool,
ffestb_subrargs_.dim_list.ctx,
(ffeexprCallback) ffestb_subr_dimlist_2_);
}
#endif
ffestt_dimlist_append (ffestb_subrargs_.dim_list.dims, NULL, expr,
ffelex_token_use (t));
return (ffelexHandler) ffeexpr_rhs (ffestb_subrargs_.dim_list.pool,
ffestb_subrargs_.dim_list.ctx,
(ffeexprCallback) ffestb_subr_dimlist_);
case FFELEX_typeCOLON:
if ((expr != NULL) && (ffebld_op (expr) == FFEBLD_opSTAR))
break;
#ifdef FFECOM_dimensionsMAX
if (ffestb_subrargs_.dim_list.ndims++ == FFECOM_dimensionsMAX)
{
ffesta_ffebad_1t (FFEBAD_TOO_MANY_DIMS, ft);
return (ffelexHandler) ffeexpr_rhs (ffestb_subrargs_.dim_list.pool,
ffestb_subrargs_.dim_list.ctx,
(ffeexprCallback) ffestb_subr_dimlist_2_);
}
#endif
ffestt_dimlist_append (ffestb_subrargs_.dim_list.dims, expr, NULL,
ffelex_token_use (t)); /* NULL second expr for
now, just plug in. */
return (ffelexHandler) ffeexpr_rhs (ffestb_subrargs_.dim_list.pool,
ffestb_subrargs_.dim_list.ctx,
(ffeexprCallback) ffestb_subr_dimlist_1_);
default:
break;
}
ffestb_subrargs_.dim_list.ok = FALSE;
return (ffelexHandler) ffestb_subrargs_.dim_list.handler (t);
}
/* ffestb_subr_dimlist_1_ -- OPEN_PAREN expr COLON expr
(ffestb_subr_dimlist_1_) // to expression handler
Get the upper bound. */
static ffelexHandler
ffestb_subr_dimlist_1_ (ffelexToken ft UNUSED, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
ffestb_subrargs_.dim_list.dims->previous->upper = expr;
ffestb_subrargs_.dim_list.ok = TRUE;
return (ffelexHandler) ffestb_subrargs_.dim_list.handler;
case FFELEX_typeCOMMA:
if ((expr != NULL) && (ffebld_op (expr) == FFEBLD_opSTAR))
break;
ffestb_subrargs_.dim_list.dims->previous->upper = expr;
return (ffelexHandler) ffeexpr_rhs (ffestb_subrargs_.dim_list.pool,
ffestb_subrargs_.dim_list.ctx, (ffeexprCallback) ffestb_subr_dimlist_);
default:
break;
}
ffestb_subrargs_.dim_list.ok = FALSE;
return (ffelexHandler) ffestb_subrargs_.dim_list.handler (t);
}
/* ffestb_subr_dimlist_2_ -- OPEN_PAREN too-many-dim-exprs
(ffestb_subr_dimlist_2_) // to expression handler
Get the upper bound. */
static ffelexHandler
ffestb_subr_dimlist_2_ (ffelexToken ft UNUSED, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
ffestb_subrargs_.dim_list.ok = TRUE; /* Not a parse error, really. */
return (ffelexHandler) ffestb_subrargs_.dim_list.handler;
case FFELEX_typeCOMMA:
case FFELEX_typeCOLON:
if ((expr != NULL) && (ffebld_op (expr) == FFEBLD_opSTAR))
break;
return (ffelexHandler) ffeexpr_rhs (ffestb_subrargs_.dim_list.pool,
ffestb_subrargs_.dim_list.ctx,
(ffeexprCallback) ffestb_subr_dimlist_2_);
default:
break;
}
ffestb_subrargs_.dim_list.ok = FALSE;
return (ffelexHandler) ffestb_subrargs_.dim_list.handler (t);
}
/* ffestb_subr_name_list_ -- Collect a list of name args and close-paren
return ffestb_subr_name_list_; // to lexer after seeing OPEN_PAREN
This implements R1224 in the Fortran 90 spec. The arg list may be
empty, or be a comma-separated list (an optional trailing comma currently
results in a warning but no other effect) of arguments. For functions,
however, "*" is invalid (we implement dummy-arg-name, rather than R1224
dummy-arg, which itself is either dummy-arg-name or "*"). */
static ffelexHandler
ffestb_subr_name_list_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
if (ffestt_tokenlist_count (ffestb_subrargs_.name_list.args) != 0)
{ /* Trailing comma, warn. */
ffebad_start (FFEBAD_TRAILING_COMMA);
ffebad_here (0, ffelex_token_where_line (t), ffelex_token_where_column (t));
ffebad_finish ();
}
ffestb_subrargs_.name_list.ok = TRUE;
ffestb_subrargs_.name_list.close_paren = ffelex_token_use (t);
if (ffestb_subrargs_.name_list.names)
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_subrargs_.name_list.handler;
case FFELEX_typeASTERISK:
if (!ffestb_subrargs_.name_list.is_subr)
break;
case FFELEX_typeNAME:
ffestt_tokenlist_append (ffestb_subrargs_.name_list.args,
ffelex_token_use (t));
return (ffelexHandler) ffestb_subr_name_list_1_;
default:
break;
}
ffestb_subrargs_.name_list.ok = FALSE;
ffestb_subrargs_.name_list.close_paren = ffelex_token_use (t);
if (ffestb_subrargs_.name_list.names)
ffelex_set_names (TRUE);
return (ffelexHandler) (*ffestb_subrargs_.name_list.handler) (t);
}
/* ffestb_subr_name_list_1_ -- NAME or ASTERISK
return ffestb_subr_name_list_1_; // to lexer
The next token must be COMMA or CLOSE_PAREN, either way go to original
state, but only after adding the appropriate name list item. */
static ffelexHandler
ffestb_subr_name_list_1_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
return (ffelexHandler) ffestb_subr_name_list_;
case FFELEX_typeCLOSE_PAREN:
ffestb_subrargs_.name_list.ok = TRUE;
ffestb_subrargs_.name_list.close_paren = ffelex_token_use (t);
if (ffestb_subrargs_.name_list.names)
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_subrargs_.name_list.handler;
default:
ffestb_subrargs_.name_list.ok = FALSE;
ffestb_subrargs_.name_list.close_paren = ffelex_token_use (t);
if (ffestb_subrargs_.name_list.names)
ffelex_set_names (TRUE);
return (ffelexHandler) (*ffestb_subrargs_.name_list.handler) (t);
}
}
static void
ffestb_subr_R1001_append_p_ (void)
{
ffesttFormatList f;
if (!ffestb_local_.format.pre.present)
{
ffesta_ffebad_1t (FFEBAD_FORMAT_BAD_P_SPEC, ffestb_local_.format.t);
ffelex_token_kill (ffestb_local_.format.t);
return;
}
f = ffestt_formatlist_append (ffestb_local_.format.f);
f->type = FFESTP_formattypeP;
f->t = ffestb_local_.format.t;
f->u.R1010.val = ffestb_local_.format.pre;
}
/* ffestb_decl_kindparam_ -- "type" OPEN_PAREN
return ffestb_decl_kindparam_; // to lexer
Handle "[KIND=]expr)". */
static ffelexHandler
ffestb_decl_kindparam_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeNAME:
ffesta_tokens[1] = ffelex_token_use (t);
return (ffelexHandler) ffestb_decl_kindparam_1_;
default:
return (ffelexHandler) (*((ffelexHandler)
ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextKINDTYPE,
(ffeexprCallback) ffestb_decl_kindparam_2_)))
(t);
}
}
/* ffestb_decl_kindparam_1_ -- "type" OPEN_PAREN NAME
return ffestb_decl_kindparam_1_; // to lexer
Handle "[KIND=]expr)". */
static ffelexHandler
ffestb_decl_kindparam_1_ (ffelexToken t)
{
ffelexHandler next;
ffelexToken nt;
switch (ffelex_token_type (t))
{
case FFELEX_typeEQUALS:
ffesta_confirmed ();
if (ffestr_other (ffesta_tokens[1]) != FFESTR_otherKIND)
break;
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextKINDTYPE, (ffeexprCallback) ffestb_decl_kindparam_2_);
default:
nt = ffesta_tokens[1];
next = (ffelexHandler) (*((ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextKINDTYPE, (ffeexprCallback) ffestb_decl_kindparam_2_)))
(nt);
ffelex_token_kill (nt);
return (ffelexHandler) (*next) (t);
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
ffesta_tokens[1]);
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_kindparam_2_ -- "type" OPEN_PAREN ["KIND="] expr
(ffestb_decl_kindparam_2_) // to expression handler
Handle "[KIND=]expr)". */
static ffelexHandler
ffestb_decl_kindparam_2_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
ffestb_local_.decl.kind = expr;
ffestb_local_.decl.kindt = ffelex_token_use (ft);
ffestb_local_.decl.len = NULL;
ffestb_local_.decl.lent = NULL;
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_local_.decl.handler;
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_starkind_ -- "type" ASTERISK
return ffestb_decl_starkind_; // to lexer
Handle NUMBER. */
static ffelexHandler
ffestb_decl_starkind_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeNUMBER:
ffestb_local_.decl.kindt = ffelex_token_use (t);
ffestb_local_.decl.kind = NULL;
ffestb_local_.decl.len = NULL;
ffestb_local_.decl.lent = NULL;
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_local_.decl.handler;
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_starlen_ -- "CHARACTER" ASTERISK
return ffestb_decl_starlen_; // to lexer
Handle NUMBER. */
static ffelexHandler
ffestb_decl_starlen_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeNUMBER:
ffestb_local_.decl.kind = NULL;
ffestb_local_.decl.kindt = NULL;
ffestb_local_.decl.len = NULL;
ffestb_local_.decl.lent = ffelex_token_use (t);
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_local_.decl.handler;
case FFELEX_typeOPEN_PAREN:
ffestb_local_.decl.kind = NULL;
ffestb_local_.decl.kindt = NULL;
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextCHARACTERSIZE,
(ffeexprCallback) ffestb_decl_starlen_1_);
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_starlen_1_ -- "CHARACTER" ASTERISK OPEN_PAREN expr
(ffestb_decl_starlen_1_) // to expression handler
Handle CLOSE_PAREN. */
static ffelexHandler
ffestb_decl_starlen_1_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
if (expr == NULL)
break;
ffestb_local_.decl.len = expr;
ffestb_local_.decl.lent = ffelex_token_use (ft);
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_local_.decl.handler;
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_typeparams_ -- "CHARACTER" OPEN_PAREN
return ffestb_decl_typeparams_; // to lexer
Handle "[KIND=]expr)". */
static ffelexHandler
ffestb_decl_typeparams_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeNAME:
ffesta_tokens[1] = ffelex_token_use (t);
return (ffelexHandler) ffestb_decl_typeparams_1_;
default:
if (ffestb_local_.decl.lent == NULL)
return (ffelexHandler) (*((ffelexHandler)
ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextCHARACTERSIZE,
(ffeexprCallback) ffestb_decl_typeparams_2_)))
(t);
if (ffestb_local_.decl.kindt != NULL)
break;
return (ffelexHandler) (*((ffelexHandler)
ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextKINDTYPE,
(ffeexprCallback) ffestb_decl_typeparams_3_)))
(t);
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
if (ffestb_local_.decl.kindt != NULL)
ffelex_token_kill (ffestb_local_.decl.kindt);
if (ffestb_local_.decl.lent != NULL)
ffelex_token_kill (ffestb_local_.decl.lent);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_typeparams_1_ -- "CHARACTER" OPEN_PAREN NAME
return ffestb_decl_typeparams_1_; // to lexer
Handle "[KIND=]expr)". */
static ffelexHandler
ffestb_decl_typeparams_1_ (ffelexToken t)
{
ffelexHandler next;
ffelexToken nt;
switch (ffelex_token_type (t))
{
case FFELEX_typeEQUALS:
ffesta_confirmed ();
switch (ffestr_other (ffesta_tokens[1]))
{
case FFESTR_otherLEN:
if (ffestb_local_.decl.lent != NULL)
break;
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextCHARACTERSIZE,
(ffeexprCallback) ffestb_decl_typeparams_2_);
case FFESTR_otherKIND:
if (ffestb_local_.decl.kindt != NULL)
break;
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextKINDTYPE,
(ffeexprCallback) ffestb_decl_typeparams_3_);
default:
break;
}
break;
default:
nt = ffesta_tokens[1];
if (ffestb_local_.decl.lent == NULL)
next = (ffelexHandler) (*((ffelexHandler)
ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextCHARACTERSIZE,
(ffeexprCallback) ffestb_decl_typeparams_2_)))
(nt);
else if (ffestb_local_.decl.kindt == NULL)
next = (ffelexHandler) (*((ffelexHandler)
ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextKINDTYPE,
(ffeexprCallback) ffestb_decl_typeparams_3_)))
(nt);
else
{
ffesta_tokens[1] = nt;
break;
}
ffelex_token_kill (nt);
return (ffelexHandler) (*next) (t);
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
if (ffestb_local_.decl.kindt != NULL)
ffelex_token_kill (ffestb_local_.decl.kindt);
if (ffestb_local_.decl.lent != NULL)
ffelex_token_kill (ffestb_local_.decl.lent);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
ffesta_tokens[1]);
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_typeparams_2_ -- "CHARACTER" OPEN_PAREN ["LEN="] expr
(ffestb_decl_typeparams_2_) // to expression handler
Handle "[LEN=]expr)". */
static ffelexHandler
ffestb_decl_typeparams_2_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
ffestb_local_.decl.len = expr;
ffestb_local_.decl.lent = ffelex_token_use (ft);
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_local_.decl.handler;
case FFELEX_typeCOMMA:
ffestb_local_.decl.len = expr;
ffestb_local_.decl.lent = ffelex_token_use (ft);
return (ffelexHandler) ffestb_decl_typeparams_;
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
if (ffestb_local_.decl.kindt != NULL)
ffelex_token_kill (ffestb_local_.decl.kindt);
if (ffestb_local_.decl.lent != NULL)
ffelex_token_kill (ffestb_local_.decl.lent);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_typeparams_3_ -- "CHARACTER" OPEN_PAREN ["KIND="] expr
(ffestb_decl_typeparams_3_) // to expression handler
Handle "[KIND=]expr)". */
static ffelexHandler
ffestb_decl_typeparams_3_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
ffestb_local_.decl.kind = expr;
ffestb_local_.decl.kindt = ffelex_token_use (ft);
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_local_.decl.handler;
case FFELEX_typeCOMMA:
ffestb_local_.decl.kind = expr;
ffestb_local_.decl.kindt = ffelex_token_use (ft);
return (ffelexHandler) ffestb_decl_typeparams_;
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
if (ffestb_local_.decl.kindt != NULL)
ffelex_token_kill (ffestb_local_.decl.kindt);
if (ffestb_local_.decl.lent != NULL)
ffelex_token_kill (ffestb_local_.decl.lent);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_typetype1_ -- "TYPE" OPEN_PAREN
return ffestb_decl_typetype1_; // to lexer
Handle NAME. */
#if FFESTR_F90
static ffelexHandler
ffestb_decl_typetype1_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeNAME:
ffestb_local_.decl.kindt = ffelex_token_use (t);
return (ffelexHandler) ffestb_decl_typetype2_;
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_decl_typetype2_ -- "TYPE" OPEN_PAREN NAME
return ffestb_decl_typetype2_; // to lexer
Handle CLOSE_PAREN. */
static ffelexHandler
ffestb_decl_typetype2_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
ffestb_local_.decl.type = FFESTP_typeTYPE;
ffestb_local_.decl.kind = NULL;
ffestb_local_.decl.len = NULL;
ffestb_local_.decl.lent = NULL;
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_local_.decl.handler;
default:
break;
}
if (ffestb_local_.decl.recursive != NULL)
ffelex_token_kill (ffestb_local_.decl.recursive);
ffelex_token_kill (ffestb_local_.decl.kindt);
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM,
ffestb_local_.decl.badname,
t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
#endif
/* ffestb_subr_label_list_ -- Collect a tokenlist of labels and close-paren
return ffestb_subr_label_list_; // to lexer after seeing OPEN_PAREN
First token must be a NUMBER. Must be followed by zero or more COMMA
NUMBER pairs. Must then be followed by a CLOSE_PAREN. If all ok, put
the NUMBER tokens in a token list and return via the handler for the
token after CLOSE_PAREN. Else return via
same handler, but with the ok return value set FALSE. */
static ffelexHandler
ffestb_subr_label_list_ (ffelexToken t)
{
if (ffelex_token_type (t) == FFELEX_typeNUMBER)
{
ffestt_tokenlist_append (ffestb_subrargs_.label_list.labels,
ffelex_token_use (t));
return (ffelexHandler) ffestb_subr_label_list_1_;
}
ffestb_subrargs_.label_list.ok = FALSE;
return (ffelexHandler) (*ffestb_subrargs_.label_list.handler) (t);
}
/* ffestb_subr_label_list_1_ -- NUMBER
return ffestb_subr_label_list_1_; // to lexer after seeing NUMBER
The next token must be COMMA, in which case go back to
ffestb_subr_label_list_, or CLOSE_PAREN, in which case set ok to TRUE
and go to the handler. */
static ffelexHandler
ffestb_subr_label_list_1_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
return (ffelexHandler) ffestb_subr_label_list_;
case FFELEX_typeCLOSE_PAREN:
ffestb_subrargs_.label_list.ok = TRUE;
return (ffelexHandler) ffestb_subrargs_.label_list.handler;
default:
ffestb_subrargs_.label_list.ok = FALSE;
return (ffelexHandler) (*ffestb_subrargs_.label_list.handler) (t);
}
}
/* ffestb_do -- Parse the DO statement
return ffestb_do; // to lexer
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
ffelexHandler
ffestb_do (ffelexToken t)
{
ffeTokenLength i;
unsigned const char *p;
ffelexHandler next;
ffelexToken nt;
ffestrSecond kw;
switch (ffelex_token_type (ffesta_tokens[0]))
{
case FFELEX_typeNAME:
if (ffesta_first_kw != FFESTR_firstDO)
goto bad_0; /* :::::::::::::::::::: */
switch (ffelex_token_type (t))
{
case FFELEX_typeNUMBER:
ffesta_confirmed ();
ffesta_tokens[1] = ffelex_token_use (t);
return (ffelexHandler) ffestb_do1_;
case FFELEX_typeCOMMA:
ffesta_confirmed ();
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_do2_;
case FFELEX_typeNAME:
ffesta_confirmed ();
ffesta_tokens[1] = NULL;
ffesta_tokens[2] = ffelex_token_use (t);
return (ffelexHandler) ffestb_do3_;
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_do1_ (t);
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
}
case FFELEX_typeNAMES:
if (ffesta_first_kw != FFESTR_firstDO)
goto bad_0; /* :::::::::::::::::::: */
p = ffelex_token_text (ffesta_tokens[0]) + (i = FFESTR_firstlDO);
switch (ffelex_token_type (t))
{
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeOPEN_PAREN: /* Must be "DO" label "WHILE". */
if (! ISDIGIT (*p))
goto bad_i; /* :::::::::::::::::::: */
ffesta_tokens[1] = ffelex_token_number_from_names (ffesta_tokens[0],
i);
p += ffelex_token_length (ffesta_tokens[1]);
i += ffelex_token_length (ffesta_tokens[1]);
if (((*p) != 'W') && ((*p) != 'w'))
goto bad_i1; /* :::::::::::::::::::: */
nt = ffelex_token_name_from_names (ffesta_tokens[0], i, 0);
kw = ffestr_second (nt);
ffelex_token_kill (nt);
if (kw != FFESTR_secondWHILE)
goto bad_i1; /* :::::::::::::::::::: */
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextDOWHILE, (ffeexprCallback) ffestb_do4_);
case FFELEX_typeCOMMA:
ffesta_confirmed ();
if (*p == '\0')
{
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_do2_;
}
if (! ISDIGIT (*p))
goto bad_i; /* :::::::::::::::::::: */
ffesta_tokens[1] = ffelex_token_number_from_names (ffesta_tokens[0],
i);
p += ffelex_token_length (ffesta_tokens[1]);
i += ffelex_token_length (ffesta_tokens[1]);
if (*p != '\0')
goto bad_i1; /* :::::::::::::::::::: */
return (ffelexHandler) ffestb_do2_;
case FFELEX_typeEQUALS:
if (ISDIGIT (*p))
{
ffesta_tokens[1]
= ffelex_token_number_from_names (ffesta_tokens[0], i);
p += ffelex_token_length (ffesta_tokens[1]);
i += ffelex_token_length (ffesta_tokens[1]);
}
else
ffesta_tokens[1] = NULL;
if (!ffesrc_is_name_init (*p))
goto bad_i1; /* :::::::::::::::::::: */
nt = ffelex_token_name_from_names (ffesta_tokens[0], i, 0);
next = (ffelexHandler) (*((ffelexHandler) ffeexpr_lhs
(ffesta_output_pool, FFEEXPR_contextDO,
(ffeexprCallback) ffestb_do6_)))
(nt);
ffelex_token_kill (nt); /* Will get it back in _6_... */
return (ffelexHandler) (*next) (t);
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
if (ISDIGIT (*p))
{
ffesta_tokens[1]
= ffelex_token_number_from_names (ffesta_tokens[0], i);
p += ffelex_token_length (ffesta_tokens[1]);
i += ffelex_token_length (ffesta_tokens[1]);
}
else
ffesta_tokens[1] = NULL;
if (*p != '\0')
goto bad_i1; /* :::::::::::::::::::: */
return (ffelexHandler) ffestb_do1_ (t);
}
default:
goto bad_0; /* :::::::::::::::::::: */
}
bad_0: /* :::::::::::::::::::: */
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", ffesta_tokens[0]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
bad_1: /* :::::::::::::::::::: */
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero); /* Invalid second token. */
bad_i1: /* :::::::::::::::::::: */
if (ffesta_tokens[1])
ffelex_token_kill (ffesta_tokens[1]);
bad_i: /* :::::::::::::::::::: */
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1sp (FFEBAD_INVALID_STMT_FORM, "DO", ffesta_tokens[0], i, t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_dowhile -- Parse the DOWHILE statement
return ffestb_dowhile; // to lexer
Make sure the statement has a valid form for the DOWHILE statement. If it
does, implement the statement. */
ffelexHandler
ffestb_dowhile (ffelexToken t)
{
ffeTokenLength i;
const char *p;
ffelexHandler next;
ffelexToken nt;
switch (ffelex_token_type (ffesta_tokens[0]))
{
case FFELEX_typeNAMES:
if (ffesta_first_kw != FFESTR_firstDOWHILE)
goto bad_0; /* :::::::::::::::::::: */
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeOPEN_PAREN:
p = ffelex_token_text (ffesta_tokens[0]) + (i = FFESTR_firstlDOWHILE);
if (*p != '\0')
goto bad_i; /* :::::::::::::::::::: */
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextDOWHILE, (ffeexprCallback) ffestb_do4_);
case FFELEX_typeEQUALS:/* Not really DOWHILE, but DOWHILExyz=.... */
ffesta_tokens[1] = NULL;
nt = ffelex_token_name_from_names (ffesta_tokens[0], FFESTR_firstlDO,
0);
next = (ffelexHandler) (*((ffelexHandler) ffeexpr_lhs
(ffesta_output_pool, FFEEXPR_contextDO,
(ffeexprCallback) ffestb_do6_)))
(nt);
ffelex_token_kill (nt); /* Will get it back in _6_... */
return (ffelexHandler) (*next) (t);
}
default:
goto bad_0; /* :::::::::::::::::::: */
}
bad_0: /* :::::::::::::::::::: */
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", ffesta_tokens[0]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
bad_1: /* :::::::::::::::::::: */
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero); /* Invalid second token. */
bad_i: /* :::::::::::::::::::: */
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1sp (FFEBAD_INVALID_STMT_FORM, "DO", ffesta_tokens[0], i, t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do1_ -- "DO" [label]
return ffestb_do1_; // to lexer
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do1_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
ffesta_confirmed ();
return (ffelexHandler) ffestb_do2_;
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
if (!ffesta_is_inhibited ())
{
if (ffesta_tokens[1] != NULL)
ffestc_R819B (ffesta_construct_name, ffesta_tokens[1], NULL,
NULL);
else
ffestc_R820B (ffesta_construct_name, NULL, NULL);
}
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
return (ffelexHandler) ffesta_zero (t);
case FFELEX_typeNAME:
return (ffelexHandler) ffestb_do2_ (t);
default:
break;
}
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do2_ -- "DO" [label] [,]
return ffestb_do2_; // to lexer
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do2_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeNAME:
ffesta_tokens[2] = ffelex_token_use (t);
return (ffelexHandler) ffestb_do3_;
default:
break;
}
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do3_ -- "DO" [label] [,] NAME
return ffestb_do3_; // to lexer
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do3_ (ffelexToken t)
{
ffelexHandler next;
switch (ffelex_token_type (t))
{
case FFELEX_typeEQUALS:
next = (ffelexHandler) (*((ffelexHandler) ffeexpr_lhs (ffesta_output_pool,
FFEEXPR_contextDO, (ffeexprCallback) ffestb_do6_)))
(ffesta_tokens[2]);
ffelex_token_kill (ffesta_tokens[2]); /* Will get it back in _6_... */
return (ffelexHandler) (*next) (t);
case FFELEX_typeOPEN_PAREN:
if (ffestr_second (ffesta_tokens[2]) != FFESTR_secondWHILE)
{
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", ffesta_tokens[2]);
ffelex_token_kill (ffesta_tokens[2]);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero); /* Invalid token. */
}
ffelex_token_kill (ffesta_tokens[2]);
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextDOWHILE, (ffeexprCallback) ffestb_do4_);
default:
break;
}
ffelex_token_kill (ffesta_tokens[2]);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do4_ -- "DO" [label] [,] "WHILE" OPEN_PAREN expr
(ffestb_do4_) // to expression handler
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do4_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
if (expr == NULL)
break;
ffesta_tokens[2] = ffelex_token_use (ft);
ffestb_local_.dowhile.expr = expr;
return (ffelexHandler) ffestb_do5_;
default:
break;
}
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do5_ -- "DO" [label] [,] "WHILE" OPEN_PAREN expr CLOSE_PAREN
return ffestb_do5_; // to lexer
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do5_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
if (!ffesta_is_inhibited ())
{
if (ffesta_tokens[1] != NULL)
ffestc_R819B (ffesta_construct_name, ffesta_tokens[1],
ffestb_local_.dowhile.expr, ffesta_tokens[2]);
else
ffestc_R820B (ffesta_construct_name, ffestb_local_.dowhile.expr,
ffesta_tokens[2]);
}
ffelex_token_kill (ffesta_tokens[2]);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
return (ffelexHandler) ffesta_zero (t);
default:
break;
}
ffelex_token_kill (ffesta_tokens[2]);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do6_ -- "DO" [label] [,] var-expr
(ffestb_do6_) // to expression handler
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do6_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
/* _3_ already ensured that this would be an EQUALS token. If not, it is a
bug in the FFE. */
assert (ffelex_token_type (t) == FFELEX_typeEQUALS);
ffesta_tokens[2] = ffelex_token_use (ft);
ffestb_local_.do_stmt.var = expr;
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextDO, (ffeexprCallback) ffestb_do7_);
}
/* ffestb_do7_ -- "DO" [label] [,] var-expr EQUALS expr
(ffestb_do7_) // to expression handler
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do7_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
ffesta_confirmed ();
if (expr == NULL)
break;
ffesta_tokens[3] = ffelex_token_use (ft);
ffestb_local_.do_stmt.start = expr;
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextDO, (ffeexprCallback) ffestb_do8_);
default:
break;
}
ffelex_token_kill (ffesta_tokens[2]);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do8_ -- "DO" [label] [,] var-expr EQUALS expr COMMA expr
(ffestb_do8_) // to expression handler
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do8_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
if (expr == NULL)
break;
ffesta_tokens[4] = ffelex_token_use (ft);
ffestb_local_.do_stmt.end = expr;
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextDO, (ffeexprCallback) ffestb_do9_);
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
if (expr == NULL)
break;
ffesta_tokens[4] = ffelex_token_use (ft);
ffestb_local_.do_stmt.end = expr;
return (ffelexHandler) ffestb_do9_ (NULL, NULL, t);
default:
break;
}
ffelex_token_kill (ffesta_tokens[3]);
ffelex_token_kill (ffesta_tokens[2]);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_do9_ -- "DO" [label] [,] var-expr EQUALS expr COMMA expr
[COMMA expr]
(ffestb_do9_) // to expression handler
Make sure the statement has a valid form for the DO statement. If it
does, implement the statement. */
static ffelexHandler
ffestb_do9_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
if ((expr == NULL) && (ft != NULL))
break;
if (!ffesta_is_inhibited ())
{
if (ffesta_tokens[1] != NULL)
ffestc_R819A (ffesta_construct_name, ffesta_tokens[1],
ffestb_local_.do_stmt.var, ffesta_tokens[2],
ffestb_local_.do_stmt.start, ffesta_tokens[3],
ffestb_local_.do_stmt.end, ffesta_tokens[4], expr, ft);
else
ffestc_R820A (ffesta_construct_name, ffestb_local_.do_stmt.var,
ffesta_tokens[2], ffestb_local_.do_stmt.start,
ffesta_tokens[3], ffestb_local_.do_stmt.end,
ffesta_tokens[4], expr, ft);
}
ffelex_token_kill (ffesta_tokens[4]);
ffelex_token_kill (ffesta_tokens[3]);
ffelex_token_kill (ffesta_tokens[2]);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
return (ffelexHandler) ffesta_zero (t);
default:
break;
}
ffelex_token_kill (ffesta_tokens[4]);
ffelex_token_kill (ffesta_tokens[3]);
ffelex_token_kill (ffesta_tokens[2]);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_construct_name != NULL)
{
ffelex_token_kill (ffesta_construct_name);
ffesta_construct_name = NULL;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "DO", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_else -- Parse the ELSE statement
return ffestb_else; // to lexer
Make sure the statement has a valid form for the ELSE statement. If it
does, implement the statement. */
ffelexHandler
ffestb_else (ffelexToken t)
{
ffeTokenLength i;
unsigned const char *p;
switch (ffelex_token_type (ffesta_tokens[0]))
{
case FFELEX_typeNAME:
if (ffesta_first_kw != FFESTR_firstELSE)
goto bad_0; /* :::::::::::::::::::: */
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
ffesta_tokens[1] = NULL;
ffestb_args.elsexyz.second = FFESTR_secondNone;
return (ffelexHandler) ffestb_else1_ (t);
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeNAME:
break;
}
ffesta_confirmed ();
ffestb_args.elsexyz.second = ffesta_second_kw;
ffesta_tokens[1] = ffelex_token_use (t);
return (ffelexHandler) ffestb_else1_;
case FFELEX_typeNAMES:
if (ffesta_first_kw != FFESTR_firstELSE)
goto bad_0; /* :::::::::::::::::::: */
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
break;
}
ffesta_confirmed ();
if (ffelex_token_length (ffesta_tokens[0]) != FFESTR_firstlELSE)
{
p = ffelex_token_text (ffesta_tokens[0]) + (i = FFESTR_firstlELSE);
if (!ffesrc_is_name_init (*p))
goto bad_i; /* :::::::::::::::::::: */
ffesta_tokens[1]
= ffelex_token_name_from_names (ffesta_tokens[0], i, 0);
}
else
ffesta_tokens[1] = NULL;
ffestb_args.elsexyz.second = FFESTR_secondNone;
return (ffelexHandler) ffestb_else1_ (t);
default:
goto bad_0; /* :::::::::::::::::::: */
}
bad_0: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE", ffesta_tokens[0]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
bad_1: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE", t);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero); /* Invalid second token. */
bad_i: /* :::::::::::::::::::: */
ffesta_ffebad_1sp (FFEBAD_INVALID_STMT_FORM, "ELSE", ffesta_tokens[0], i, t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_elsexyz -- Parse an ELSEIF/ELSEWHERE statement
return ffestb_elsexyz; // to lexer
Expects len and second to be set in ffestb_args.elsexyz to the length
of the ELSExyz keyword involved and the corresponding ffestrSecond value. */
ffelexHandler
ffestb_elsexyz (ffelexToken t)
{
ffeTokenLength i;
const char *p;
switch (ffelex_token_type (ffesta_tokens[0]))
{
case FFELEX_typeNAME:
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
if (ffesta_first_kw == FFESTR_firstELSEIF)
goto bad_0; /* :::::::::::::::::::: */
ffesta_confirmed ();
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_else1_ (t);
case FFELEX_typeNAME:
ffesta_confirmed ();
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeOPEN_PAREN:
if (ffesta_first_kw != FFESTR_firstELSEIF)
goto bad_0; /* :::::::::::::::::::: */
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_else1_ (t);
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
}
case FFELEX_typeNAMES:
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeOPEN_PAREN:
if (ffesta_first_kw != FFESTR_firstELSEIF)
goto bad_1; /* :::::::::::::::::::: */
if (ffelex_token_length (ffesta_tokens[0]) != FFESTR_firstlELSEIF)
{
i = FFESTR_firstlELSEIF;
goto bad_i; /* :::::::::::::::::::: */
}
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_else1_ (t);
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
break;
}
ffesta_confirmed ();
p = ffelex_token_text (ffesta_tokens[0]) + (i = FFESTR_firstlELSE);
ffesta_tokens[1]
= ffelex_token_name_from_names (ffesta_tokens[0], i, 0);
#if FFESTR_F90
if ((ffestb_args.elsexyz.second == FFESTR_secondWHERE)
&& (ffelex_token_length (ffesta_tokens[1]) != FFESTR_secondlWHERE))
ffestb_args.elsexyz.second = FFESTR_secondNone;
#endif
return (ffelexHandler) ffestb_else1_ (t);
default:
goto bad_0; /* :::::::::::::::::::: */
}
bad_0: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE", ffesta_tokens[0]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
bad_1: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE", t);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero); /* Invalid second token. */
bad_i: /* :::::::::::::::::::: */
ffesta_ffebad_1sp (FFEBAD_INVALID_STMT_FORM, "ELSE IF", ffesta_tokens[0], i, t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_else1_ -- "ELSE" (NAME)
return ffestb_else1_; // to lexer
If EOS/SEMICOLON, implement the appropriate statement (keep in mind that
"ELSE WHERE" is ambiguous at the syntactic level). If OPEN_PAREN, start
expression analysis with callback at _2_. */
static ffelexHandler
ffestb_else1_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeOPEN_PAREN:
if (ffestb_args.elsexyz.second == FFESTR_secondIF)
{
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffeexpr_rhs (ffesta_output_pool,
FFEEXPR_contextIF, (ffeexprCallback) ffestb_else2_);
}
/* Fall through. */
default:
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE", t);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero);
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
break;
}
switch (ffestb_args.elsexyz.second)
{
#if FFESTR_F90
case FFESTR_secondWHERE:
if (!ffesta_is_inhibited ())
if ((ffesta_first_kw == FFESTR_firstELSEWHERE)
&& (ffelex_token_type (ffesta_tokens[0]) == FFELEX_typeNAME))
ffestc_R744 ();
else
ffestc_elsewhere (ffesta_tokens[1]); /* R744 or R805. */
break;
#endif
default:
if (!ffesta_is_inhibited ())
ffestc_R805 (ffesta_tokens[1]);
break;
}
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffesta_zero (t);
}
/* ffestb_else2_ -- "ELSE" "IF" OPEN_PAREN expr
(ffestb_else2_) // to expression handler
Make sure the next token is CLOSE_PAREN. */
static ffelexHandler
ffestb_else2_ (ffelexToken ft, ffebld expr, ffelexToken t)
{
ffestb_local_.else_stmt.expr = expr;
switch (ffelex_token_type (t))
{
case FFELEX_typeCLOSE_PAREN:
if (expr == NULL)
break;
ffesta_tokens[1] = ffelex_token_use (ft);
ffelex_set_names (TRUE);
return (ffelexHandler) ffestb_else3_;
default:
break;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE IF", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_else3_ -- "ELSE" "IF" OPEN_PAREN expr CLOSE_PAREN
return ffestb_else3_; // to lexer
Make sure the next token is "THEN". */
static ffelexHandler
ffestb_else3_ (ffelexToken t)
{
ffeTokenLength i;
unsigned const char *p;
ffelex_set_names (FALSE);
switch (ffelex_token_type (t))
{
case FFELEX_typeNAME:
ffesta_confirmed ();
if (ffestr_first (t) == FFESTR_firstTHEN)
return (ffelexHandler) ffestb_else4_;
break;
case FFELEX_typeNAMES:
ffesta_confirmed ();
if (ffestr_first (t) != FFESTR_firstTHEN)
break;
if (ffelex_token_length (t) == FFESTR_firstlTHEN)
return (ffelexHandler) ffestb_else4_;
p = ffelex_token_text (t) + (i = FFESTR_firstlTHEN);
if (!ffesrc_is_name_init (*p))
goto bad_i; /* :::::::::::::::::::: */
ffesta_tokens[2] = ffelex_token_name_from_names (t, i, 0);
return (ffelexHandler) ffestb_else5_;
default:
break;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE IF", t);
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
bad_i: /* :::::::::::::::::::: */
ffesta_ffebad_1sp (FFEBAD_INVALID_STMT_FORM, "ELSE IF", t, i, NULL);
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_else4_ -- "ELSE" "IF" OPEN_PAREN expr CLOSE_PAREN "THEN"
return ffestb_else4_; // to lexer
Handle a NAME or EOS/SEMICOLON, then go to state _5_. */
static ffelexHandler
ffestb_else4_ (ffelexToken t)
{
ffelex_set_names (FALSE);
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_tokens[2] = NULL;
return (ffelexHandler) ffestb_else5_ (t);
case FFELEX_typeNAME:
ffesta_tokens[2] = ffelex_token_use (t);
return (ffelexHandler) ffestb_else5_;
default:
break;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE IF", t);
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_else5_ -- "ELSE" "IF" OPEN_PAREN expr CLOSE_PAREN "THEN"
return ffestb_else5_; // to lexer
Make sure the next token is EOS or SEMICOLON; implement R804. */
static ffelexHandler
ffestb_else5_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
if (!ffesta_is_inhibited ())
ffestc_R804 (ffestb_local_.else_stmt.expr, ffesta_tokens[1],
ffesta_tokens[2]);
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_tokens[2] != NULL)
ffelex_token_kill (ffesta_tokens[2]);
return (ffelexHandler) ffesta_zero (t);
default:
break;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "ELSE IF", t);
ffelex_token_kill (ffesta_tokens[1]);
if (ffesta_tokens[2] != NULL)
ffelex_token_kill (ffesta_tokens[2]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_end -- Parse the END statement
return ffestb_end; // to lexer
Make sure the statement has a valid form for the END statement. If it
does, implement the statement. */
ffelexHandler
ffestb_end (ffelexToken t)
{
ffeTokenLength i;
switch (ffelex_token_type (ffesta_tokens[0]))
{
case FFELEX_typeNAME:
if (ffesta_first_kw != FFESTR_firstEND)
goto bad_0; /* :::::::::::::::::::: */
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_tokens[1] = NULL;
ffestb_args.endxyz.second = FFESTR_secondNone;
return (ffelexHandler) ffestb_end3_ (t);
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeNAME:
break;
}
ffesta_confirmed ();
ffestb_args.endxyz.second = ffesta_second_kw;
switch (ffesta_second_kw)
{
case FFESTR_secondFILE:
ffestb_args.beru.badname = "ENDFILE";
return (ffelexHandler) ffestb_beru;
case FFESTR_secondBLOCK:
return (ffelexHandler) ffestb_end1_;
#if FFESTR_F90
case FFESTR_secondINTERFACE:
#endif
#if FFESTR_VXT
case FFESTR_secondMAP:
case FFESTR_secondSTRUCTURE:
case FFESTR_secondUNION:
#endif
#if FFESTR_F90
case FFESTR_secondWHERE:
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_end3_;
#endif
case FFESTR_secondNone:
goto bad_1; /* :::::::::::::::::::: */
default:
return (ffelexHandler) ffestb_end2_;
}
case FFELEX_typeNAMES:
if (ffesta_first_kw != FFESTR_firstEND)
goto bad_0; /* :::::::::::::::::::: */
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
break;
}
ffesta_confirmed ();
if (ffelex_token_length (ffesta_tokens[0]) != FFESTR_firstlEND)
{
i = FFESTR_firstlEND;
goto bad_i; /* :::::::::::::::::::: */
}
ffesta_tokens[1] = NULL;
ffestb_args.endxyz.second = FFESTR_secondNone;
return (ffelexHandler) ffestb_end3_ (t);
default:
goto bad_0; /* :::::::::::::::::::: */
}
bad_0: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "END", ffesta_tokens[0]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
bad_1: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "END", t);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero); /* Invalid second token. */
bad_i: /* :::::::::::::::::::: */
ffesta_ffebad_1sp (FFEBAD_INVALID_STMT_FORM, "END", ffesta_tokens[0], i, t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_endxyz -- Parse an ENDxyz statement
return ffestb_endxyz; // to lexer
Expects len and second to be set in ffestb_args.endxyz to the length
of the ENDxyz keyword involved and the corresponding ffestrSecond value. */
ffelexHandler
ffestb_endxyz (ffelexToken t)
{
ffeTokenLength i;
unsigned const char *p;
switch (ffelex_token_type (ffesta_tokens[0]))
{
case FFELEX_typeNAME:
switch (ffelex_token_type (t))
{
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_end3_ (t);
case FFELEX_typeNAME:
ffesta_confirmed ();
switch (ffestb_args.endxyz.second)
{
#if FFESTR_F90
case FFESTR_secondINTERFACE:
#endif
#if FFESTR_VXT
case FFESTR_secondMAP:
case FFESTR_secondSTRUCTURE:
case FFESTR_secondUNION:
#endif
#if FFESTR_F90
case FFESTR_secondWHERE:
goto bad_1; /* :::::::::::::::::::: */
#endif
case FFESTR_secondBLOCK:
if (ffesta_second_kw != FFESTR_secondDATA)
goto bad_1; /* :::::::::::::::::::: */
return (ffelexHandler) ffestb_end2_;
default:
return (ffelexHandler) ffestb_end2_ (t);
}
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
}
case FFELEX_typeNAMES:
switch (ffelex_token_type (t))
{
case FFELEX_typeCOMMA:
case FFELEX_typeCOLONCOLON:
ffesta_confirmed (); /* Error, but clearly intended. */
goto bad_1; /* :::::::::::::::::::: */
default:
goto bad_1; /* :::::::::::::::::::: */
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
break;
}
ffesta_confirmed ();
if (ffestb_args.endxyz.second == FFESTR_secondBLOCK)
{
i = FFESTR_firstlEND;
goto bad_i; /* :::::::::::::::::::: */
}
if (ffelex_token_length (ffesta_tokens[0]) != ffestb_args.endxyz.len)
{
p = ffelex_token_text (ffesta_tokens[0])
+ (i = ffestb_args.endxyz.len);
switch (ffestb_args.endxyz.second)
{
#if FFESTR_F90
case FFESTR_secondINTERFACE:
#endif
#if FFESTR_VXT
case FFESTR_secondMAP:
case FFESTR_secondSTRUCTURE:
case FFESTR_secondUNION:
#endif
#if FFESTR_F90
case FFESTR_secondWHERE:
goto bad_i; /* :::::::::::::::::::: */
#endif
default:
break;
}
if (!ffesrc_is_name_init (*p))
goto bad_i; /* :::::::::::::::::::: */
ffesta_tokens[1]
= ffelex_token_name_from_names (ffesta_tokens[0], i, 0);
return (ffelexHandler) ffestb_end3_ (t);
}
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_end3_ (t);
default:
goto bad_0; /* :::::::::::::::::::: */
}
bad_0: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "END", ffesta_tokens[0]);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
bad_1: /* :::::::::::::::::::: */
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "END", t);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero); /* Invalid second token. */
bad_i: /* :::::::::::::::::::: */
ffesta_ffebad_1sp (FFEBAD_INVALID_STMT_FORM, "END", ffesta_tokens[0], i, t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_end1_ -- "END" "BLOCK"
return ffestb_end1_; // to lexer
Make sure the next token is "DATA". */
static ffelexHandler
ffestb_end1_ (ffelexToken t)
{
if ((ffelex_token_type (t) == FFELEX_typeNAME)
&& (ffesrc_strcmp_2c (ffe_case_match (), ffelex_token_text (t), "DATA",
"data", "Data")
== 0))
{
return (ffelexHandler) ffestb_end2_;
}
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "END", t);
return (ffelexHandler) ffelex_swallow_tokens (t, (ffelexHandler) ffesta_zero);
}
/* ffestb_end2_ -- "END" <unit-kind>
return ffestb_end2_; // to lexer
Make sure the next token is a NAME or EOS. */
static ffelexHandler
ffestb_end2_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
case FFELEX_typeNAME:
ffesta_tokens[1] = ffelex_token_use (t);
return (ffelexHandler) ffestb_end3_;
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_tokens[1] = NULL;
return (ffelexHandler) ffestb_end3_ (t);
default:
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "END", t);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero);
}
}
/* ffestb_end3_ -- "END" <unit-kind> (NAME)
return ffestb_end3_; // to lexer
Make sure the next token is an EOS, then implement the statement. */
static ffelexHandler
ffestb_end3_ (ffelexToken t)
{
switch (ffelex_token_type (t))
{
default:
ffesta_ffebad_1st (FFEBAD_INVALID_STMT_FORM, "END", t);
if (ffesta_tokens[1] != NULL)
ffelex_token_kill (ffesta_tokens[1]);
return (ffelexHandler) ffelex_swallow_tokens (t,
(ffelexHandler) ffesta_zero);
case FFELEX_typeEOS:
case FFELEX_typeSEMICOLON:
ffesta_confirmed ();
if (ffestb_args.endxyz.second == FFESTR_secondNone)
{
if (!ffesta_is_inhibited ())
ffestc_end ();
return (ffelexHandler) ffesta_zero (t);
}
break;
}
switch (ffestb_args.endxyz.second)
{
#if FFESTR_F90
case FFESTR_secondTYPE:
if (!ffesta_is_inhibited ())
ffestc_R425 (ffesta_tokens[1]);
break;
#endif
#if FFESTR_F90
case FFESTR_secondWHERE:
if (!ffesta_is_inhibited ())
ffestc_R745 ();
break;
#endif
case FFESTR_secondIF:
if (!ffesta_is_inhibited ())
ffestc_R806 (ffesta_tokens[1]);
break;