1/* All matcher functions.
2 Copyright (C) 2003-2017 Free Software Foundation, Inc.
3 Contributed by Steven Bosscher
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21
22#ifndef GFC_MATCH_H
23#define GFC_MATCH_H
24
25/* gfc_new_block points to the symbol of a newly matched block. */
26extern gfc_symbol *gfc_new_block;
27
28/* Current statement label. Zero means no statement label. Because
29 new_st can get wiped during statement matching, we have to keep it
30 separate. */
31extern gfc_st_label *gfc_statement_label;
32
33extern int gfc_matching_ptr_assignment;
34extern int gfc_matching_procptr_assignment;
35extern bool gfc_matching_prefix;
36
37/* Default access specifier while matching procedure bindings. */
38extern gfc_access gfc_typebound_default_access;
39
40/****************** All gfc_match* routines *****************/
41
42/* match.c. */
43
44/* Generic match subroutines. */
45match gfc_match_special_char (gfc_char_t *);
46match gfc_match_space (void);
47match gfc_match_eos (void);
48match gfc_match_small_literal_int (int *, int *);
49match gfc_match_st_label (gfc_st_label **);
50match gfc_match_label (void);
51match gfc_match_small_int (int *);
52match gfc_match_small_int_expr (int *, gfc_expr **);
53match gfc_match_name (char *);
54match gfc_match_name_C (const char **buffer);
55match gfc_match_symbol (gfc_symbol **, int);
56match gfc_match_sym_tree (gfc_symtree **, int);
57match gfc_match_intrinsic_op (gfc_intrinsic_op *);
58match gfc_match_char (char);
59match gfc_match (const char *, ...);
60match gfc_match_iterator (gfc_iterator *, int);
61match gfc_match_parens (void);
62match gfc_match_type_spec (gfc_typespec *);
63match gfc_match_member_sep(gfc_symbol *);
64
65
66/* Statement matchers. */
67match gfc_match_program (void);
68match gfc_match_pointer_assignment (void);
69match gfc_match_assignment (void);
70match gfc_match_if (gfc_statement *);
71match gfc_match_else (void);
72match gfc_match_elseif (void);
73match gfc_match_event_post (void);
74match gfc_match_event_wait (void);
75match gfc_match_critical (void);
76match gfc_match_fail_image (void);
77match gfc_match_block (void);
78match gfc_match_associate (void);
79match gfc_match_do (void);
80match gfc_match_cycle (void);
81match gfc_match_exit (void);
82match gfc_match_lock (void);
83match gfc_match_pause (void);
84match gfc_match_stop (void);
85match gfc_match_error_stop (void);
86match gfc_match_continue (void);
87match gfc_match_assign (void);
88match gfc_match_goto (void);
89match gfc_match_sync_all (void);
90match gfc_match_sync_images (void);
91match gfc_match_sync_memory (void);
92match gfc_match_unlock (void);
93
94match gfc_match_allocate (void);
95match gfc_match_nullify (void);
96match gfc_match_deallocate (void);
97match gfc_match_return (void);
98match gfc_match_call (void);
99
100/* We want to use this function to check for a common-block-name
101 that can exist in a bind statement, so removed the "static"
102 declaration of the function in match.c.
103
104 TODO: should probably rename this now that it'll be globally seen to
105 gfc_match_common_name. */
106match match_common_name (char *name);
107
108match gfc_match_common (void);
109match gfc_match_block_data (void);
110match gfc_match_namelist (void);
111match gfc_match_module (void);
112match gfc_match_equivalence (void);
113match gfc_match_st_function (void);
114match gfc_match_ptr_fcn_assign (void);
115match gfc_match_case (void);
116match gfc_match_select (void);
117match gfc_match_select_type (void);
118match gfc_match_type_is (void);
119match gfc_match_class_is (void);
120match gfc_match_where (gfc_statement *);
121match gfc_match_elsewhere (void);
122match gfc_match_forall (gfc_statement *);
123
124/* Other functions. */
125
126gfc_common_head *gfc_get_common (const char *, int);
127
128/* openmp.c. */
129
130/* OpenACC directive matchers. */
131match gfc_match_oacc_atomic (void);
132match gfc_match_oacc_cache (void);
133match gfc_match_oacc_wait (void);
134match gfc_match_oacc_update (void);
135match gfc_match_oacc_declare (void);
136match gfc_match_oacc_loop (void);
137match gfc_match_oacc_host_data (void);
138match gfc_match_oacc_data (void);
139match gfc_match_oacc_kernels (void);
140match gfc_match_oacc_kernels_loop (void);
141match gfc_match_oacc_parallel (void);
142match gfc_match_oacc_parallel_loop (void);
143match gfc_match_oacc_enter_data (void);
144match gfc_match_oacc_exit_data (void);
145match gfc_match_oacc_routine (void);
146
147/* OpenMP directive matchers. */
148match gfc_match_omp_eos (void);
149match gfc_match_omp_atomic (void);
150match gfc_match_omp_barrier (void);
151match gfc_match_omp_cancel (void);
152match gfc_match_omp_cancellation_point (void);
153match gfc_match_omp_critical (void);
154match gfc_match_omp_declare_reduction (void);
155match gfc_match_omp_declare_simd (void);
156match gfc_match_omp_declare_target (void);
157match gfc_match_omp_distribute (void);
158match gfc_match_omp_distribute_parallel_do (void);
159match gfc_match_omp_distribute_parallel_do_simd (void);
160match gfc_match_omp_distribute_simd (void);
161match gfc_match_omp_do (void);
162match gfc_match_omp_do_simd (void);
163match gfc_match_omp_flush (void);
164match gfc_match_omp_master (void);
165match gfc_match_omp_ordered (void);
166match gfc_match_omp_ordered_depend (void);
167match gfc_match_omp_parallel (void);
168match gfc_match_omp_parallel_do (void);
169match gfc_match_omp_parallel_do_simd (void);
170match gfc_match_omp_parallel_sections (void);
171match gfc_match_omp_parallel_workshare (void);
172match gfc_match_omp_sections (void);
173match gfc_match_omp_simd (void);
174match gfc_match_omp_single (void);
175match gfc_match_omp_target (void);
176match gfc_match_omp_target_data (void);
177match gfc_match_omp_target_enter_data (void);
178match gfc_match_omp_target_exit_data (void);
179match gfc_match_omp_target_parallel (void);
180match gfc_match_omp_target_parallel_do (void);
181match gfc_match_omp_target_parallel_do_simd (void);
182match gfc_match_omp_target_simd (void);
183match gfc_match_omp_target_teams (void);
184match gfc_match_omp_target_teams_distribute (void);
185match gfc_match_omp_target_teams_distribute_parallel_do (void);
186match gfc_match_omp_target_teams_distribute_parallel_do_simd (void);
187match gfc_match_omp_target_teams_distribute_simd (void);
188match gfc_match_omp_target_update (void);
189match gfc_match_omp_task (void);
190match gfc_match_omp_taskgroup (void);
191match gfc_match_omp_taskloop (void);
192match gfc_match_omp_taskloop_simd (void);
193match gfc_match_omp_taskwait (void);
194match gfc_match_omp_taskyield (void);
195match gfc_match_omp_teams (void);
196match gfc_match_omp_teams_distribute (void);
197match gfc_match_omp_teams_distribute_parallel_do (void);
198match gfc_match_omp_teams_distribute_parallel_do_simd (void);
199match gfc_match_omp_teams_distribute_simd (void);
200match gfc_match_omp_threadprivate (void);
201match gfc_match_omp_workshare (void);
202match gfc_match_omp_end_critical (void);
203match gfc_match_omp_end_nowait (void);
204match gfc_match_omp_end_single (void);
205
206/* decl.c. */
207
208match gfc_match_data (void);
209match gfc_match_null (gfc_expr **);
210match gfc_match_kind_spec (gfc_typespec *, bool);
211match gfc_match_old_kind_spec (gfc_typespec *);
212match gfc_match_decl_type_spec (gfc_typespec *, int);
213
214match gfc_match_end (gfc_statement *);
215match gfc_match_data_decl (void);
216match gfc_match_formal_arglist (gfc_symbol *, int, int, bool = false);
217match gfc_match_procedure (void);
218match gfc_match_generic (void);
219match gfc_match_function_decl (void);
220match gfc_match_entry (void);
221match gfc_match_subroutine (void);
222match gfc_match_submod_proc (void);
223match gfc_match_map (void);
224match gfc_match_union (void);
225match gfc_match_structure_decl (void);
226match gfc_match_derived_decl (void);
227match gfc_match_final_decl (void);
228match gfc_match_type (gfc_statement *);
229
230match gfc_match_implicit_none (void);
231match gfc_match_implicit (void);
232
233void gfc_set_constant_character_len (int, gfc_expr *, int);
234
235/* Matchers for attribute declarations. */
236match gfc_match_allocatable (void);
237match gfc_match_asynchronous (void);
238match gfc_match_automatic (void);
239match gfc_match_codimension (void);
240match gfc_match_contiguous (void);
241match gfc_match_dimension (void);
242match gfc_match_external (void);
243match gfc_match_gcc_attributes (void);
244match gfc_match_import (void);
245match gfc_match_intent (void);
246match gfc_match_intrinsic (void);
247match gfc_match_optional (void);
248match gfc_match_parameter (void);
249match gfc_match_pointer (void);
250match gfc_match_protected (void);
251match gfc_match_private (gfc_statement *);
252match gfc_match_public (gfc_statement *);
253match gfc_match_save (void);
254match gfc_match_static (void);
255match gfc_match_modproc (void);
256match gfc_match_target (void);
257match gfc_match_value (void);
258match gfc_match_volatile (void);
259
260/* decl.c. */
261
262/* Fortran 2003 c interop.
263 TODO: some of these should be moved to another file rather than decl.c */
264void set_com_block_bind_c (gfc_common_head *, int);
265bool set_verify_bind_c_sym (gfc_symbol *, int);
266bool set_verify_bind_c_com_block (gfc_common_head *, int);
267bool get_bind_c_idents (void);
268match gfc_match_bind_c_stmt (void);
269match gfc_match_suffix (gfc_symbol *, gfc_symbol **);
270match gfc_match_bind_c (gfc_symbol *, bool);
271match gfc_get_type_attr_spec (symbol_attribute *, char*);
272
273/* primary.c. */
274match gfc_match_structure_constructor (gfc_symbol *, gfc_expr **);
275match gfc_match_variable (gfc_expr **, int);
276match gfc_match_equiv_variable (gfc_expr **);
277match gfc_match_actual_arglist (int, gfc_actual_arglist **, bool = false);
278match gfc_match_literal_constant (gfc_expr **, int);
279
280/* expr.c -- FIXME: this one should be eliminated by moving the
281 matcher to matchexp.c and a call to a new function in expr.c that
282 only makes sure the init expr. is valid. */
283bool gfc_reduce_init_expr (gfc_expr *expr);
284match gfc_match_init_expr (gfc_expr **);
285
286/* array.c. */
287match gfc_match_array_spec (gfc_array_spec **, bool, bool);
288match gfc_match_array_ref (gfc_array_ref *, gfc_array_spec *, int, int);
289match gfc_match_array_constructor (gfc_expr **);
290
291/* interface.c. */
292match gfc_match_abstract_interface (void);
293match gfc_match_generic_spec (interface_type *, char *, gfc_intrinsic_op *);
294match gfc_match_interface (void);
295match gfc_match_end_interface (void);
296
297/* io.c. */
298match gfc_match_format (void);
299match gfc_match_open (void);
300match gfc_match_close (void);
301match gfc_match_endfile (void);
302match gfc_match_backspace (void);
303match gfc_match_rewind (void);
304match gfc_match_flush (void);
305match gfc_match_inquire (void);
306match gfc_match_read (void);
307match gfc_match_wait (void);
308match gfc_match_write (void);
309match gfc_match_print (void);
310
311/* matchexp.c. */
312match gfc_match_defined_op_name (char *, int);
313match gfc_match_expr (gfc_expr **);
314
315/* module.c. */
316match gfc_match_use (void);
317match gfc_match_submodule (void);
318void gfc_use_modules (void);
319
320#endif /* GFC_MATCH_H */
321
322