337 lines
10 KiB

  1. /* A Bison parser, made by GNU Bison 2.7.12-4996. */
  2. /* Skeleton interface for Bison LALR(1) parsers in C++
  3. Copyright (C) 2002-2013 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. /**
  26. ** \file generated/easymesh-parser.h
  27. ** Define the lol::parser class.
  28. */
  29. /* C++ LALR(1) parser skeleton written by Akim Demaille. */
  30. #ifndef YY_LOL_GENERATED_EASYMESH_PARSER_H_INCLUDED
  31. # define YY_LOL_GENERATED_EASYMESH_PARSER_H_INCLUDED
  32. #include <string>
  33. #include <iostream>
  34. #include "stack.hh"
  35. #include "location.hh"
  36. /* Enabling traces. */
  37. #ifndef YYDEBUG
  38. # define YYDEBUG 1
  39. #endif
  40. namespace lol {
  41. /* Line 33 of lalr1.cc */
  42. #line 59 "generated/easymesh-parser.h"
  43. /// A Bison parser.
  44. class EasyMeshParser
  45. {
  46. public:
  47. /// Symbol semantic values.
  48. #ifndef YYSTYPE
  49. union semantic_type
  50. {
  51. /* Line 33 of lalr1.cc */
  52. #line 35 "easymesh/easymesh-parser.y"
  53. float fval;
  54. /* Can't use uin32_t here for some reason */
  55. unsigned u32val;
  56. struct { float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; } args;
  57. /* Line 33 of lalr1.cc */
  58. #line 79 "generated/easymesh-parser.h"
  59. };
  60. #else
  61. typedef YYSTYPE semantic_type;
  62. #endif
  63. /// Symbol locations.
  64. typedef location location_type;
  65. /// Tokens.
  66. struct token
  67. {
  68. /* Tokens. */
  69. enum yytokentype {
  70. T_END = 0,
  71. T_COLOR = 258,
  72. T_BGCOLOR = 259,
  73. T_TRANSLATEX = 260,
  74. T_ROTATEX = 261,
  75. T_TAPERX = 262,
  76. T_TWISTX = 263,
  77. T_SHEARX = 264,
  78. T_STRETCHX = 265,
  79. T_BENDXY = 266,
  80. T_BENDXZ = 267,
  81. T_SCALEX = 268,
  82. T_MIRRORX = 269,
  83. T_TRANSLATEY = 270,
  84. T_ROTATEY = 271,
  85. T_TAPERY = 272,
  86. T_TWISTY = 273,
  87. T_SHEARY = 274,
  88. T_STRETCHY = 275,
  89. T_BENDYX = 276,
  90. T_BENDYZ = 277,
  91. T_SCALEY = 278,
  92. T_MIRRORY = 279,
  93. T_TRANSLATEZ = 280,
  94. T_ROTATEZ = 281,
  95. T_TAPERZ = 282,
  96. T_TWISTZ = 283,
  97. T_SHEARZ = 284,
  98. T_STRETCHZ = 285,
  99. T_BENDZX = 286,
  100. T_BENDZY = 287,
  101. T_SCALEZ = 288,
  102. T_MIRRORZ = 289,
  103. T_TRANSLATE = 290,
  104. T_SCALE = 291,
  105. T_TOGGLESCALEWINDING = 292,
  106. T_RADIALJITTER = 293,
  107. T_SPLITTRIANGLE = 294,
  108. T_SMOOTHMESH = 295,
  109. T_CSGUNION = 296,
  110. T_CSGSUBSTRACT = 297,
  111. T_CSGSUBSTRACTLOSS = 298,
  112. T_CSGAND = 299,
  113. T_CSGXOR = 300,
  114. T_CHAMFER = 301,
  115. T_CYLINDER = 302,
  116. T_BOX = 303,
  117. T_SMOOTHCHAMFBOX = 304,
  118. T_FLATCHAMFBOX = 305,
  119. T_SPHERE = 306,
  120. T_CAPSULE = 307,
  121. T_STAR = 308,
  122. T_EXPANDEDSTAR = 309,
  123. T_DISC = 310,
  124. T_TRIANGLE = 311,
  125. T_QUAD = 312,
  126. T_COG = 313,
  127. T_TORUS = 314,
  128. T_ERROR = 315,
  129. NUMBER = 316,
  130. COLOR = 317
  131. };
  132. };
  133. /// Token type.
  134. typedef token::yytokentype token_type;
  135. /// Build a parser object.
  136. EasyMeshParser (class EasyMeshCompiler& mc_yyarg);
  137. virtual ~EasyMeshParser ();
  138. /// Parse.
  139. /// \returns 0 iff parsing succeeded.
  140. virtual int parse ();
  141. #if YYDEBUG
  142. /// The current debugging stream.
  143. std::ostream& debug_stream () const;
  144. /// Set the current debugging stream.
  145. void set_debug_stream (std::ostream &);
  146. /// Type for debugging levels.
  147. typedef int debug_level_type;
  148. /// The current debugging level.
  149. debug_level_type debug_level () const;
  150. /// Set the current debugging level.
  151. void set_debug_level (debug_level_type l);
  152. #endif
  153. private:
  154. /// This class is not copyable.
  155. EasyMeshParser (const EasyMeshParser&);
  156. EasyMeshParser& operator= (const EasyMeshParser&);
  157. /// Report a syntax error.
  158. /// \param loc where the syntax error is found.
  159. /// \param msg a description of the syntax error.
  160. virtual void error (const location_type& loc, const std::string& msg);
  161. /// Generate an error message.
  162. /// \param state the state where the error occurred.
  163. /// \param tok the lookahead token.
  164. virtual std::string yysyntax_error_ (int yystate, int tok);
  165. #if YYDEBUG
  166. /// \brief Report a symbol value on the debug stream.
  167. /// \param yytype The token type.
  168. /// \param yyvaluep Its semantic value.
  169. /// \param yylocationp Its location.
  170. virtual void yy_symbol_value_print_ (int yytype,
  171. const semantic_type* yyvaluep,
  172. const location_type* yylocationp);
  173. /// \brief Report a symbol on the debug stream.
  174. /// \param yytype The token type.
  175. /// \param yyvaluep Its semantic value.
  176. /// \param yylocationp Its location.
  177. virtual void yy_symbol_print_ (int yytype,
  178. const semantic_type* yyvaluep,
  179. const location_type* yylocationp);
  180. #endif
  181. /// State numbers.
  182. typedef int state_type;
  183. /// State stack type.
  184. typedef stack<state_type> state_stack_type;
  185. /// Semantic value stack type.
  186. typedef stack<semantic_type> semantic_stack_type;
  187. /// location stack type.
  188. typedef stack<location_type> location_stack_type;
  189. /// The state stack.
  190. state_stack_type yystate_stack_;
  191. /// The semantic value stack.
  192. semantic_stack_type yysemantic_stack_;
  193. /// The location stack.
  194. location_stack_type yylocation_stack_;
  195. /// Whether the given \c yypact_ value indicates a defaulted state.
  196. /// \param yyvalue the value to check
  197. static bool yy_pact_value_is_default_ (int yyvalue);
  198. /// Whether the given \c yytable_ value indicates a syntax error.
  199. /// \param yyvalue the value to check
  200. static bool yy_table_value_is_error_ (int yyvalue);
  201. /// Internal symbol numbers.
  202. typedef unsigned char token_number_type;
  203. /* Tables. */
  204. /// For a state, the index in \a yytable_ of its portion.
  205. static const signed char yypact_[];
  206. static const signed char yypact_ninf_;
  207. /// For a state, default reduction number.
  208. /// Unless\a yytable_ specifies something else to do.
  209. /// Zero means the default is an error.
  210. static const unsigned char yydefact_[];
  211. static const short int yypgoto_[];
  212. static const short int yydefgoto_[];
  213. /// What to do in a state.
  214. /// \a yytable_[yypact_[s]]: what to do in state \a s.
  215. /// - if positive, shift that token.
  216. /// - if negative, reduce the rule which number is the opposite.
  217. /// - if zero, do what YYDEFACT says.
  218. static const unsigned char yytable_[];
  219. static const signed char yytable_ninf_;
  220. static const short int yycheck_[];
  221. /// For a state, its accessing symbol.
  222. static const unsigned char yystos_[];
  223. /// For a rule, its LHS.
  224. static const unsigned char yyr1_[];
  225. /// For a rule, its RHS length.
  226. static const unsigned char yyr2_[];
  227. /// Convert the symbol name \a n to a form suitable for a diagnostic.
  228. static std::string yytnamerr_ (const char *n);
  229. /// For a symbol, its name in clear.
  230. static const char* const yytname_[];
  231. #if YYDEBUG
  232. /// A type to store symbol numbers and -1.
  233. typedef signed char rhs_number_type;
  234. /// A `-1'-separated list of the rules' RHS.
  235. static const rhs_number_type yyrhs_[];
  236. /// For each rule, the index of the first RHS symbol in \a yyrhs_.
  237. static const unsigned char yyprhs_[];
  238. /// For each rule, its source line number.
  239. static const unsigned char yyrline_[];
  240. /// For each scanner token number, its symbol number.
  241. static const unsigned short int yytoken_number_[];
  242. /// Report on the debug stream that the rule \a r is going to be reduced.
  243. virtual void yy_reduce_print_ (int r);
  244. /// Print the state stack on the debug stream.
  245. virtual void yystack_print_ ();
  246. /* Debugging. */
  247. int yydebug_;
  248. std::ostream* yycdebug_;
  249. #endif
  250. /// Convert a scanner token number \a t to a symbol number.
  251. token_number_type yytranslate_ (int t);
  252. /// \brief Reclaim the memory associated to a symbol.
  253. /// \param yymsg Why this token is reclaimed.
  254. /// If null, do not display the symbol, just free it.
  255. /// \param yytype The symbol type.
  256. /// \param yyvaluep Its semantic value.
  257. /// \param yylocationp Its location.
  258. inline void yydestruct_ (const char* yymsg,
  259. int yytype,
  260. semantic_type* yyvaluep,
  261. location_type* yylocationp);
  262. /// Pop \a n symbols the three stacks.
  263. inline void yypop_ (unsigned int n = 1);
  264. /* Constants. */
  265. static const int yyeof_;
  266. /* LAST_ -- Last index in TABLE_. */
  267. static const int yylast_;
  268. static const int yynnts_;
  269. static const int yyempty_;
  270. static const int yyfinal_;
  271. static const int yyterror_;
  272. static const int yyerrcode_;
  273. static const int yyntokens_;
  274. static const unsigned int yyuser_token_number_max_;
  275. static const token_number_type yyundef_token_;
  276. /* User arguments. */
  277. class EasyMeshCompiler& mc;
  278. };
  279. } // lol
  280. /* Line 33 of lalr1.cc */
  281. #line 333 "generated/easymesh-parser.h"
  282. #endif /* !YY_LOL_GENERATED_EASYMESH_PARSER_H_INCLUDED */