OSDN Git Service

* arith.c, array.c, decl.c, expr.c, f95-lang.c, gfortran.h,
[pf3gnuchains/gcc-fork.git] / gcc / fortran / parse.h
1 /* Parser header
2    Copyright (C) 2003 Free Software Foundation, Inc.
3    Contributed by Steven Bosscher
4
5 This file is part of GCC.
6
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 2, or (at your option) any later
10 version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.  */
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_IF, COMP_DO,
33   COMP_SELECT, COMP_FORALL, COMP_WHERE, COMP_CONTAINS
34 }
35 gfc_compile_state;
36
37 /* Stack element for the current compilation state.  These structures
38    are allocated as automatic variables.  */
39 typedef struct gfc_state_data
40 {
41   gfc_compile_state state;
42   gfc_symbol *sym;              /* Block name associated with this level */
43   gfc_symtree *do_variable;     /* For DO blocks the iterator variable.  */
44
45   struct gfc_code *head, *tail;
46   struct gfc_state_data *previous;
47
48   /* Block-specific state data.  */
49   union
50   {
51     gfc_st_label *end_do_label;
52   }
53   ext;
54 }
55 gfc_state_data;
56
57 extern gfc_state_data *gfc_state_stack;
58
59 #define gfc_current_block() (gfc_state_stack->sym)
60 #define gfc_current_state() (gfc_state_stack->state)
61
62 int gfc_check_do_variable (gfc_symtree *);
63 try gfc_find_state (gfc_compile_state);
64 gfc_state_data *gfc_enclosing_unit (gfc_compile_state *);
65 const char *gfc_ascii_statement (gfc_statement);
66 const char *gfc_state_name (gfc_compile_state);
67
68 #endif  /* GFC_PARSE_H  */