OSDN Git Service

Merge tree-ssa-20020619-branch into mainline.
[pf3gnuchains/gcc-fork.git] / gcc / fortran / parse.h
1 /* Parser header
2    Copyright (C) 2003 Free Software Foundaton, Inc.
3    Contributed by Steven Bosscher
4
5 This file is part of GNU G95.
6
7 GNU G95 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)
10 any later version.
11
12 GNU G95 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.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU G95; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 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   struct gfc_code *head, *tail;
44   struct gfc_state_data *previous;
45
46   /* Block-specific state data. */
47   union
48   {
49     gfc_st_label *end_do_label;
50   }
51   ext;
52 }
53 gfc_state_data;
54
55 extern gfc_state_data *gfc_state_stack;
56
57 #define gfc_current_block() (gfc_state_stack->sym)
58 #define gfc_current_state() (gfc_state_stack->state)
59
60 try gfc_find_state (gfc_compile_state);
61 gfc_state_data *gfc_enclosing_unit (gfc_compile_state *);
62 const char *gfc_ascii_statement (gfc_statement);
63 const char *gfc_state_name (gfc_compile_state);
64
65 #endif  /* GFC_PARSE_H  */