2015-05-22 Pascal Obry <obry@adacore.com>
[official-gcc.git] / gcc / fortran / parse.h
blob8a1613f5322146caaf5de5a332d7fc33ad0cf560
1 /* Parser header
2 Copyright (C) 2003-2015 Free Software Foundation, Inc.
3 Contributed by Steven Bosscher
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
22 #ifndef GFC_PARSE_H
23 #define GFC_PARSE_H
25 /* Enum for what the compiler is currently doing. */
26 typedef enum
28 COMP_NONE, COMP_PROGRAM, COMP_MODULE, COMP_SUBROUTINE, COMP_FUNCTION,
29 COMP_BLOCK_DATA, COMP_INTERFACE, COMP_DERIVED, COMP_DERIVED_CONTAINS,
30 COMP_BLOCK, COMP_ASSOCIATE, COMP_IF,
31 COMP_DO, COMP_SELECT, COMP_FORALL, COMP_WHERE, COMP_CONTAINS, COMP_ENUM,
32 COMP_SELECT_TYPE, COMP_OMP_STRUCTURED_BLOCK, COMP_CRITICAL, COMP_DO_CONCURRENT
34 gfc_compile_state;
36 /* Stack element for the current compilation state. These structures
37 are allocated as automatic variables. */
38 typedef struct gfc_state_data
40 gfc_compile_state state;
41 gfc_symbol *sym; /* Block name associated with this level */
42 gfc_symtree *do_variable; /* For DO blocks the iterator variable. */
44 struct gfc_code *construct;
45 struct gfc_code *head, *tail;
46 struct gfc_state_data *previous;
48 /* Block-specific state data. */
49 union
51 gfc_st_label *end_do_label;
52 gfc_omp_clauses *oacc_declare_clauses;
54 ext;
56 gfc_state_data;
58 extern gfc_state_data *gfc_state_stack;
60 #define gfc_current_block() (gfc_state_stack->sym)
61 #define gfc_current_state() (gfc_state_stack->state)
63 int gfc_check_do_variable (gfc_symtree *);
64 bool gfc_find_state (gfc_compile_state);
65 gfc_state_data *gfc_enclosing_unit (gfc_compile_state *);
66 const char *gfc_ascii_statement (gfc_statement);
67 match gfc_match_enum (void);
68 match gfc_match_enumerator_def (void);
69 void gfc_free_enum_history (void);
70 extern bool gfc_matching_function;
71 match gfc_match_prefix (gfc_typespec *);
72 bool is_oacc (gfc_state_data *);
73 #endif /* GFC_PARSE_H */