Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

331 wiersze
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_CUSTOMCMD = 263,
  114. T_ERROR = 264,
  115. F_NUMBER = 265,
  116. I_NUMBER = 266,
  117. STRING = 267,
  118. STRING_VAR = 268,
  119. BOOLEAN = 269,
  120. COLOR = 270
  121. };
  122. };
  123. /// Token type.
  124. typedef token::yytokentype token_type;
  125. /// Build a parser object.
  126. SceneSetupParser (class SceneSetupCompiler& uc_yyarg);
  127. virtual ~SceneSetupParser ();
  128. /// Parse.
  129. /// \returns 0 iff parsing succeeded.
  130. virtual int parse ();
  131. #if YYDEBUG
  132. /// The current debugging stream.
  133. std::ostream& debug_stream () const;
  134. /// Set the current debugging stream.
  135. void set_debug_stream (std::ostream &);
  136. /// Type for debugging levels.
  137. typedef int debug_level_type;
  138. /// The current debugging level.
  139. debug_level_type debug_level () const;
  140. /// Set the current debugging level.
  141. void set_debug_level (debug_level_type l);
  142. #endif
  143. private:
  144. /// Report a syntax error.
  145. /// \param loc where the syntax error is found.
  146. /// \param msg a description of the syntax error.
  147. virtual void error (const location_type& loc, const std::string& msg);
  148. /// Generate an error message.
  149. /// \param state the state where the error occurred.
  150. /// \param tok the lookahead token.
  151. virtual std::string yysyntax_error_ (int yystate, int tok);
  152. #if YYDEBUG
  153. /// \brief Report a symbol value on the debug stream.
  154. /// \param yytype The token type.
  155. /// \param yyvaluep Its semantic value.
  156. /// \param yylocationp Its location.
  157. virtual void yy_symbol_value_print_ (int yytype,
  158. const semantic_type* yyvaluep,
  159. const location_type* yylocationp);
  160. /// \brief Report a symbol on the debug stream.
  161. /// \param yytype The token type.
  162. /// \param yyvaluep Its semantic value.
  163. /// \param yylocationp Its location.
  164. virtual void yy_symbol_print_ (int yytype,
  165. const semantic_type* yyvaluep,
  166. const location_type* yylocationp);
  167. #endif
  168. /// State numbers.
  169. typedef int state_type;
  170. /// State stack type.
  171. typedef stack<state_type> state_stack_type;
  172. /// Semantic value stack type.
  173. typedef stack<semantic_type> semantic_stack_type;
  174. /// location stack type.
  175. typedef stack<location_type> location_stack_type;
  176. /// The state stack.
  177. state_stack_type yystate_stack_;
  178. /// The semantic value stack.
  179. semantic_stack_type yysemantic_stack_;
  180. /// The location stack.
  181. location_stack_type yylocation_stack_;
  182. /// Internal symbol numbers.
  183. typedef unsigned char token_number_type;
  184. /* Tables. */
  185. /// For a state, the index in \a yytable_ of its portion.
  186. static const signed char yypact_[];
  187. static const signed char yypact_ninf_;
  188. /// For a state, default rule to reduce.
  189. /// Unless\a yytable_ specifies something else to do.
  190. /// Zero means the default is an error.
  191. static const unsigned char yydefact_[];
  192. static const signed char yypgoto_[];
  193. static const signed char yydefgoto_[];
  194. /// What to do in a state.
  195. /// \a yytable_[yypact_[s]]: what to do in state \a s.
  196. /// - if positive, shift that token.
  197. /// - if negative, reduce the rule which number is the opposite.
  198. /// - if zero, do what YYDEFACT says.
  199. static const unsigned char yytable_[];
  200. static const signed char yytable_ninf_;
  201. static const unsigned char yycheck_[];
  202. /// For a state, its accessing symbol.
  203. static const unsigned char yystos_[];
  204. /// For a rule, its LHS.
  205. static const unsigned char yyr1_[];
  206. /// For a rule, its RHS length.
  207. static const unsigned char yyr2_[];
  208. #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  209. /// For a symbol, its name in clear.
  210. static const char* const yytname_[];
  211. #endif
  212. #if YYERROR_VERBOSE
  213. /// Convert the symbol name \a n to a form suitable for a diagnostic.
  214. virtual std::string yytnamerr_ (const char *n);
  215. #endif
  216. #if YYDEBUG
  217. /// A type to store symbol numbers and -1.
  218. typedef signed char rhs_number_type;
  219. /// A `-1'-separated list of the rules' RHS.
  220. static const rhs_number_type yyrhs_[];
  221. /// For each rule, the index of the first RHS symbol in \a yyrhs_.
  222. static const unsigned char yyprhs_[];
  223. /// For each rule, its source line number.
  224. static const unsigned char yyrline_[];
  225. /// For each scanner token number, its symbol number.
  226. static const unsigned short int yytoken_number_[];
  227. /// Report on the debug stream that the rule \a r is going to be reduced.
  228. virtual void yy_reduce_print_ (int r);
  229. /// Print the state stack on the debug stream.
  230. virtual void yystack_print_ ();
  231. /* Debugging. */
  232. int yydebug_;
  233. std::ostream* yycdebug_;
  234. #endif
  235. /// Convert a scanner token number \a t to a symbol number.
  236. token_number_type yytranslate_ (int t);
  237. /// \brief Reclaim the memory associated to a symbol.
  238. /// \param yymsg Why this token is reclaimed.
  239. /// \param yytype The symbol type.
  240. /// \param yyvaluep Its semantic value.
  241. /// \param yylocationp Its location.
  242. inline void yydestruct_ (const char* yymsg,
  243. int yytype,
  244. semantic_type* yyvaluep,
  245. location_type* yylocationp);
  246. /// Pop \a n symbols the three stacks.
  247. inline void yypop_ (unsigned int n = 1);
  248. /* Constants. */
  249. static const int yyeof_;
  250. /* LAST_ -- Last index in TABLE_. */
  251. static const int yylast_;
  252. static const int yynnts_;
  253. static const int yyempty_;
  254. static const int yyfinal_;
  255. static const int yyterror_;
  256. static const int yyerrcode_;
  257. static const int yyntokens_;
  258. static const unsigned int yyuser_token_number_max_;
  259. static const token_number_type yyundef_token_;
  260. /* User arguments. */
  261. class SceneSetupCompiler& uc;
  262. };
  263. } // lol
  264. /* Line 34 of lalr1.cc */
  265. #line 327 "generated/scenesetup-parser.h"
  266. #endif /* ! defined PARSER_HEADER_H */