logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

parse-gram.h (3742B)


  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. /*
  3. * This file is based on parse-gram.y from GNU Bison 3.4.1. It is the
  4. * header for an implementation of a subset of the grammar described
  5. * by parse-gram.y, just enough to provide a bootstrapping path for
  6. * Bison.
  7. *
  8. * Copyright (c) 2020, Giovanni Mascellani <gio@debian.org>
  9. *
  10. * The copyright notice of the original file follows. This file is
  11. * distributed under the same license and with the same conditions.
  12. */
  13. /* Bison Grammar Parser -*- C -*-
  14. Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
  15. This file is part of Bison, the GNU Compiler Compiler.
  16. This program is free software: you can redistribute it and/or modify
  17. it under the terms of the GNU General Public License as published by
  18. the Free Software Foundation, either version 3 of the License, or
  19. (at your option) any later version.
  20. This program is distributed in the hope that it will be useful,
  21. but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. GNU General Public License for more details.
  24. You should have received a copy of the GNU General Public License
  25. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  26. #ifndef PARSE_GRAM_H
  27. #define PARSE_GRAM_H
  28. /* %code requires */
  29. #include "symlist.h"
  30. #include "symtab.h"
  31. typedef enum
  32. {
  33. param_none = 0,
  34. param_lex = 1 << 0,
  35. param_parse = 1 << 1,
  36. param_both = param_lex | param_parse
  37. } param_type;
  38. #include "muscle-tab.h"
  39. typedef struct
  40. {
  41. char const *chars;
  42. muscle_kind kind;
  43. } value_type;
  44. enum gram_tokentype {
  45. GRAM_EOF = 0,
  46. ID = 300,
  47. STRING,
  48. BRACED_CODE,
  49. INT,
  50. PERCENT_DEFINE,
  51. PERCENT_DEFINES,
  52. PERCENT_VERBOSE,
  53. SEMICOLON,
  54. PERCENT_TOKEN,
  55. PERCENT_TYPE,
  56. PERCENT_EMPTY,
  57. COLON,
  58. PERCENT_EXPECT,
  59. PERCENT_PERCENT,
  60. PERCENT_INITIAL_ACTION,
  61. BRACKETED_ID,
  62. PIPE,
  63. EPILOGUE,
  64. TAG,
  65. PERCENT_CODE,
  66. ID_COLON,
  67. PERCENT_NONASSOC,
  68. PERCENT_FLAG,
  69. PERCENT_DEFAULT_PREC,
  70. PERCENT_DESTRUCTOR,
  71. PERCENT_DPREC,
  72. PERCENT_EXPECT_RR,
  73. EQUAL,
  74. TAG_ANY,
  75. CHAR,
  76. BRACED_PREDICATE,
  77. PERCENT_START,
  78. PERCENT_UNION,
  79. PERCENT_ERROR_VERBOSE,
  80. PERCENT_NAME_PREFIX,
  81. PERCENT_PURE_PARSER,
  82. PERCENT_RIGHT,
  83. PERCENT_PREC,
  84. PERCENT_FILE_PREFIX,
  85. PERCENT_YACC,
  86. PERCENT_GLR_PARSER,
  87. PERCENT_LANGUAGE,
  88. PERCENT_LEFT,
  89. PERCENT_PARAM,
  90. PERCENT_MERGE,
  91. PERCENT_NO_DEFAULT_PREC,
  92. PERCENT_NO_LINES,
  93. PERCENT_NONDETERMINISTIC_PARSER,
  94. PERCENT_NTERM,
  95. PERCENT_OUTPUT,
  96. PERCENT_PRECEDENCE,
  97. PRECENT_PRINTER,
  98. PERCENT_REQUIRE,
  99. PERCENT_SKELETON,
  100. PERCENT_TOKEN_TABLE,
  101. TAG_NONE,
  102. PROLOGUE,
  103. PERCENT_PRINTER,
  104. };
  105. union GRAM_STYPE {
  106. value_type value;
  107. uniqstr ID;
  108. char *STRING;
  109. symbol *symbol;
  110. named_ref *named_ref_opt;
  111. uniqstr tag_opt;
  112. char *BRACED_CODE;
  113. char *EPILOGUE;
  114. symbol *id_colon;
  115. uniqstr ID_COLON;
  116. int int_opt;
  117. int INT;
  118. symbol *string_as_id;
  119. symbol *string_as_id_opt;
  120. symbol *token_decl;
  121. symbol_list *token_decl_1;
  122. symbol_list *token_decls;
  123. symbol_list *symbol_decls;
  124. symbol_list *symbol_decl_1;
  125. uniqstr BRACKETED_ID;
  126. symbol *id;
  127. uniqstr TAG;
  128. uniqstr PERCENT_FLAG;
  129. uniqstr PERCENT_FILE_PREFIX;
  130. uniqstr PERCENT_NAME_PREFIX;
  131. uniqstr PERCENT_YACC;
  132. param_type PERCENT_PARAM;
  133. uniqstr PERCENT_PURE_PARSER;
  134. uniqstr PERCENT_ERROR_VERBOSE;
  135. unsigned char CHAR;
  136. char *BRACED_PREDICATE;
  137. char *PROLOGUE;
  138. };
  139. typedef union GRAM_STYPE GRAM_STYPE;
  140. int gram_parse (void);
  141. #endif