parse.h 2.3 KB

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