1 /* lex.h -- Public #include File (module.h template V1.0)
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
5 This file is part of GNU Fortran.
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
27 Change for new ffewhere interface.
30 /* Allow multiple inclusion to work. */
35 /* Simple definitions and enumerations. */
50 FFELEX_typeAPOSTROPHE
,
51 FFELEX_typeOPEN_PAREN
,
52 FFELEX_typeCLOSE_PAREN
,
58 FFELEX_typeNUMBER
, /* Grep: [0-9][0-9]*. */
59 FFELEX_typeOPEN_ANGLE
,
61 FFELEX_typeCLOSE_ANGLE
,
62 FFELEX_typeNAME
, /* Grep: [A-Za-z][A-Za-z0-9_]*. */
64 FFELEX_typePOWER
, /* "**". */
65 FFELEX_typeCONCAT
, /* "//". */
67 FFELEX_typeNAMES
, /* Same as FFELEX_typeNAME in initial
69 FFELEX_typeHOLLERITH
, /* <text> part of <nn>H<text>. */
70 FFELEX_typeCHARACTER
, /* <text> part of '<text>' or "<text>". */
73 FFELEX_typeUNDERSCORE
,
75 FFELEX_typeOPEN_ARRAY
, /* "(/". */
76 FFELEX_typeCLOSE_ARRAY
, /* "/)". */
77 FFELEX_typeCOLONCOLON
, /* "::". */
78 FFELEX_typeREL_LE
, /* "<=". */
79 FFELEX_typeREL_NE
, /* "<>". */
80 FFELEX_typeREL_EQ
, /* "==". */
81 FFELEX_typePOINTS
, /* "=>". */
82 FFELEX_typeREL_GE
, /* ">=". */
88 typedef struct _lextoken_
*ffelexToken
;
89 typedef void *lex_sigh_
;
90 typedef lex_sigh_ (*lex_sigh__
) (ffelexToken
);
91 typedef lex_sigh__ (*ffelexHandler
) (ffelexToken
);
93 /* Include files needed by this one. */
98 /* Structure definitions. */
102 long int id_
; /* DEBUG ONLY. */
104 ffeTokenLength length
;
108 ffewhereLine where_line
;
109 ffewhereColumn where_col
;
110 ffewhereLine currentnames_line
; /* For tracking NAMES tokens. */
111 ffewhereColumn currentnames_col
; /* For tracking NAMES tokens. */
112 ffewhereTrack wheretrack
; /* For tracking NAMES tokens. */
115 /* Global objects accessed by users of this module. */
118 /* Declare functions with prototypes. */
120 void ffelex_display_token (ffelexToken t
);
121 bool ffelex_expecting_character (void);
122 ffelexHandler
ffelex_file_fixed (ffewhereFile wf
, FILE *f
);
123 ffelexHandler
ffelex_file_free (ffewhereFile wf
, FILE *f
);
124 void ffelex_hash_kludge (FILE *f
);
125 void ffelex_init_1 (void);
126 bool ffelex_is_names_expected (void);
127 char *ffelex_line (void);
128 ffewhereColumnNumber
ffelex_line_length (void);
129 ffewhereLineNumber
ffelex_line_number (void);
130 void ffelex_set_expecting_hollerith (long length
, char which
,
132 ffewhereColumn column
);
133 void ffelex_set_handler (ffelexHandler first
);
134 void ffelex_set_hexnum (bool on
);
135 void ffelex_set_include (ffewhereFile wf
, bool free_form
, FILE *fi
);
136 void ffelex_set_names (bool on
);
137 void ffelex_set_names_pure (bool on
);
138 ffelexHandler
ffelex_splice_tokens (ffelexHandler first
, ffelexToken master
,
139 ffeTokenLength start
);
140 ffelexHandler
ffelex_swallow_tokens (ffelexToken t
, ffelexHandler handler
);
141 ffelexToken
ffelex_token_dollar_from_names (ffelexToken t
,
142 ffeTokenLength start
);
143 void ffelex_token_kill (ffelexToken t
);
144 ffelexToken
ffelex_token_name_from_names (ffelexToken t
,
145 ffeTokenLength start
,
147 ffelexToken
ffelex_token_names_from_names (ffelexToken t
,
148 ffeTokenLength start
,
150 ffelexToken
ffelex_token_new (void);
151 ffelexToken
ffelex_token_new_character (const char *s
, ffewhereLine l
,
153 ffelexToken
ffelex_token_new_eof (void);
154 ffelexToken
ffelex_token_new_name (const char *s
, ffewhereLine l
,
156 ffelexToken
ffelex_token_new_names (const char *s
, ffewhereLine l
,
158 ffelexToken
ffelex_token_new_number (const char *s
, ffewhereLine l
,
160 ffelexToken
ffelex_token_new_simple_ (ffelexType type
, ffewhereLine l
,
162 ffelexToken
ffelex_token_number_from_names (ffelexToken t
,
163 ffeTokenLength start
);
164 ffelexToken
ffelex_token_uscore_from_names (ffelexToken t
,
165 ffeTokenLength start
);
166 ffelexToken
ffelex_token_use (ffelexToken t
);
170 #define ffelex_init_0()
171 #define ffelex_init_2()
172 #define ffelex_init_3()
173 #define ffelex_init_4()
174 #define ffelex_is_firstnamechar(c) ISIDST (c)
175 #define ffelex_terminate_0()
176 #define ffelex_terminate_1()
177 #define ffelex_terminate_2()
178 #define ffelex_terminate_3()
179 #define ffelex_terminate_4()
180 #define ffelex_token_length(t) ((t)->length)
181 #define ffelex_token_new_eos(l,c) \
182 ffelex_token_new_simple_ (FFELEX_typeEOS, (l), (c))
183 #define ffelex_token_new_period(l,c) \
184 ffelex_token_new_simple_ (FFELEX_typePERIOD, (l), (c))
185 #define ffelex_token_strcmp(t1,t2) strcmp ((t1)->text, (t2)->text)
186 #define ffelex_token_text(t) ((t)->text)
187 #define ffelex_token_type(t) ((t)->type)
188 #define ffelex_token_where_column(t) ((t)->where_col)
189 #define ffelex_token_where_filename(t) \
190 ffewhere_line_filename ((t)->where_line)
191 #define ffelex_token_where_filelinenum(t) \
192 ffewhere_line_filelinenum((t)->where_line)
193 #define ffelex_token_where_line(t) ((t)->where_line)
194 #define ffelex_token_where_line_number(t) \
195 ffewhere_line_number ((t)->where_line)
196 #define ffelex_token_wheretrack(t) ((t)->wheretrack)
198 /* End of #include file. */
200 #endif /* ! GCC_F_LEX_H */