OSDN Git Service

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