You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

332 line
9.3 KiB

  1. /* A Bison parser, made by GNU Bison 2.4.2. */
  2. /* Skeleton interface for Bison LALR(1) parsers in C++
  3. Copyright (C) 2002-2010 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. /* As a special exception, you may create a larger work that contains
  15. part or all of the Bison parser skeleton and distribute that work
  16. under terms of your choice, so long as that work isn't itself a
  17. parser generator using the skeleton or a modified version thereof
  18. as a parser skeleton. Alternatively, if you modify or redistribute
  19. the parser skeleton itself, you may (at your option) remove this
  20. special exception, which will cause the skeleton and the resulting
  21. Bison output files to be licensed under the GNU General Public
  22. License without this special exception.
  23. This special exception was added by the Free Software Foundation in
  24. version 2.2 of Bison. */
  25. /* C++ LALR(1) parser skeleton written by Akim Demaille. */
  26. #ifndef PARSER_HEADER_H
  27. # define PARSER_HEADER_H
  28. #include <string>
  29. #include <iostream>
  30. #include "stack.hh"
  31. namespace lol {
  32. /* Line 34 of lalr1.cc */
  33. #line 49 "generated/scenesetup-parser.h"
  34. class position;
  35. class location;
  36. } // lol
  37. /* Line 34 of lalr1.cc */
  38. #line 56 "generated/scenesetup-parser.h"
  39. #include "location.hh"
  40. /* Enabling traces. */
  41. #ifndef YYDEBUG
  42. # define YYDEBUG 1
  43. #endif
  44. /* Enabling verbose error messages. */
  45. #ifdef YYERROR_VERBOSE
  46. # undef YYERROR_VERBOSE
  47. # define YYERROR_VERBOSE 1
  48. #else
  49. # define YYERROR_VERBOSE 1
  50. #endif
  51. /* Enabling the token table. */
  52. #ifndef YYTOKEN_TABLE
  53. # define YYTOKEN_TABLE 0
  54. #endif
  55. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  56. If N is 0, then set CURRENT to the empty location which ends
  57. the previous symbol: RHS[0] (always defined). */
  58. #ifndef YYLLOC_DEFAULT
  59. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  60. do { \
  61. if (N) \
  62. { \
  63. (Current).begin = (Rhs)[1].begin; \
  64. (Current).end = (Rhs)[N].end; \
  65. } \
  66. else \
  67. { \
  68. (Current).begin = (Current).end = (Rhs)[0].end; \
  69. } \
  70. } while (false)
  71. #endif
  72. namespace lol {
  73. /* Line 34 of lalr1.cc */
  74. #line 101 "generated/scenesetup-parser.h"
  75. /// A Bison parser.
  76. class SceneSetupParser
  77. {
  78. public:
  79. /// Symbol semantic values.
  80. #ifndef YYSTYPE
  81. union semantic_type
  82. {
  83. /* Line 34 of lalr1.cc */
  84. #line 33 "scenesetup-parser.y"
  85. float fval;
  86. int ival;
  87. bool bval;
  88. float vval[4];
  89. int ivval[4];
  90. char* sval;
  91. char* svval;
  92. /* Can't use uin32_t here for some reason */
  93. unsigned u32val;
  94. /* Line 34 of lalr1.cc */
  95. #line 128 "generated/scenesetup-parser.h"
  96. };
  97. #else
  98. typedef YYSTYPE semantic_type;
  99. #endif
  100. /// Symbol locations.
  101. typedef location location_type;
  102. /// Tokens.
  103. struct token
  104. {
  105. /* Tokens. */
  106. enum yytokentype {
  107. T_END = 0,
  108. T_COLOR = 258,
  109. T_ADDLIGHT = 259,
  110. T_OBJPOSITION = 260,
  111. T_OBJLOOKAT = 261,
  112. T_OBJCOLOR = 262,
  113. T_CLEARCOLOR = 263,
  114. T_CUSTOMCMD = 264,
  115. T_ERROR = 265,
  116. F_NUMBER = 266,
  117. I_NUMBER = 267,
  118. STRING = 268,
  119. STRING_VAR = 269,
  120. BOOLEAN = 270,
  121. COLOR = 271
  122. };
  123. };
  124. /// Token type.
  125. typedef token::yytokentype token_type;
  126. /// Build a parser object.
  127. SceneSetupParser (class SceneSetupCompiler& uc_yyarg);
  128. virtual ~SceneSetupParser ();
  129. /// Parse.
  130. /// \returns 0 iff parsing succeeded.
  131. virtual int parse ();
  132. #if YYDEBUG
  133. /// The current debugging stream.
  134. std::ostream& debug_stream () const;
  135. /// Set the current debugging stream.
  136. void set_debug_stream (std::ostream &);
  137. /// Type for debugging levels.
  138. typedef int debug_level_type;
  139. /// The current debugging level.
  140. debug_level_type debug_level () const;
  141. /// Set the current debugging level.
  142. void set_debug_level (debug_level_type l);
  143. #endif
  144. private:
  145. /// Report a syntax error.
  146. /// \param loc where the syntax error is found.
  147. /// \param msg a description of the syntax error.
  148. virtual void error (const location_type& loc, const std::string& msg);
  149. /// Generate an error message.
  150. /// \param state the state where the error occurred.
  151. /// \param tok the lookahead token.
  152. virtual std::string yysyntax_error_ (int yystate, int tok);
  153. #if YYDEBUG
  154. /// \brief Report a symbol value on the debug stream.
  155. /// \param yytype The token type.
  156. /// \param yyvaluep Its semantic value.
  157. /// \param yylocationp Its location.
  158. virtual void yy_symbol_value_print_ (int yytype,
  159. const semantic_type* yyvaluep,
  160. const location_type* yylocationp);
  161. /// \brief Report a symbol on the debug stream.
  162. /// \param yytype The token type.
  163. /// \param yyvaluep Its semantic value.
  164. /// \param yylocationp Its location.
  165. virtual void yy_symbol_print_ (int yytype,
  166. const semantic_type* yyvaluep,
  167. const location_type* yylocationp);
  168. #endif
  169. /// State numbers.
  170. typedef int state_type;
  171. /// State stack type.
  172. typedef stack<state_type> state_stack_type;
  173. /// Semantic value stack type.
  174. typedef stack<semantic_type> semantic_stack_type;
  175. /// location stack type.
  176. typedef stack<location_type> location_stack_type;
  177. /// The state stack.
  178. state_stack_type yystate_stack_;
  179. /// The semantic value stack.
  180. semantic_stack_type yysemantic_stack_;
  181. /// The location stack.
  182. location_stack_type yylocation_stack_;
  183. /// Internal symbol numbers.
  184. typedef unsigned char token_number_type;
  185. /* Tables. */
  186. /// For a state, the index in \a yytable_ of its portion.
  187. static const signed char yypact_[];
  188. static const signed char yypact_ninf_;
  189. /// For a state, default rule to reduce.
  190. /// Unless\a yytable_ specifies something else to do.
  191. /// Zero means the default is an error.
  192. static const unsigned char yydefact_[];
  193. static const signed char yypgoto_[];
  194. static const signed char yydefgoto_[];
  195. /// What to do in a state.
  196. /// \a yytable_[yypact_[s]]: what to do in state \a s.
  197. /// - if positive, shift that token.
  198. /// - if negative, reduce the rule which number is the opposite.
  199. /// - if zero, do what YYDEFACT says.
  200. static const unsigned char yytable_[];
  201. static const signed char yytable_ninf_;
  202. static const unsigned char yycheck_[];
  203. /// For a state, its accessing symbol.
  204. static const unsigned char yystos_[];
  205. /// For a rule, its LHS.
  206. static const unsigned char yyr1_[];
  207. /// For a rule, its RHS length.
  208. static const unsigned char yyr2_[];
  209. #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  210. /// For a symbol, its name in clear.
  211. static const char* const yytname_[];
  212. #endif
  213. #if YYERROR_VERBOSE
  214. /// Convert the symbol name \a n to a form suitable for a diagnostic.
  215. virtual std::string yytnamerr_ (const char *n);
  216. #endif
  217. #if YYDEBUG
  218. /// A type to store symbol numbers and -1.
  219. typedef signed char rhs_number_type;
  220. /// A `-1'-separated list of the rules' RHS.
  221. static const rhs_number_type yyrhs_[];
  222. /// For each rule, the index of the first RHS symbol in \a yyrhs_.
  223. static const unsigned char yyprhs_[];
  224. /// For each rule, its source line number.
  225. static const unsigned char yyrline_[];
  226. /// For each scanner token number, its symbol number.
  227. static const unsigned short int yytoken_number_[];
  228. /// Report on the debug stream that the rule \a r is going to be reduced.
  229. virtual void yy_reduce_print_ (int r);
  230. /// Print the state stack on the debug stream.
  231. virtual void yystack_print_ ();
  232. /* Debugging. */
  233. int yydebug_;
  234. std::ostream* yycdebug_;
  235. #endif
  236. /// Convert a scanner token number \a t to a symbol number.
  237. token_number_type yytranslate_ (int t);
  238. /// \brief Reclaim the memory associated to a symbol.
  239. /// \param yymsg Why this token is reclaimed.
  240. /// \param yytype The symbol type.
  241. /// \param yyvaluep Its semantic value.
  242. /// \param yylocationp Its location.
  243. inline void yydestruct_ (const char* yymsg,
  244. int yytype,
  245. semantic_type* yyvaluep,
  246. location_type* yylocationp);
  247. /// Pop \a n symbols the three stacks.
  248. inline void yypop_ (unsigned int n = 1);
  249. /* Constants. */
  250. static const int yyeof_;
  251. /* LAST_ -- Last index in TABLE_. */
  252. static const int yylast_;
  253. static const int yynnts_;
  254. static const int yyempty_;
  255. static const int yyfinal_;
  256. static const int yyterror_;
  257. static const int yyerrcode_;
  258. static const int yyntokens_;
  259. static const unsigned int yyuser_token_number_max_;
  260. static const token_number_type yyundef_token_;
  261. /* User arguments. */
  262. class SceneSetupCompiler& uc;
  263. };
  264. } // lol
  265. /* Line 34 of lalr1.cc */
  266. #line 328 "generated/scenesetup-parser.h"
  267. #endif /* ! defined PARSER_HEADER_H */