Borderbasix

parser.hpp
Go to the documentation of this file.
1 #ifndef __PARSER_TAB_C
2 #define __PARSER_TAB_C
3 
4 #pragma clang diagnostic ignored "-Wdeprecated-register"
5 
6 /* A Bison parser, made by GNU Bison 3.0. */
7 
8 /* Bison implementation for Yacc-like parsers in C
9 
10  Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
11 
12  This program is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 
25 /* As a special exception, you may create a larger work that contains
26  part or all of the Bison parser skeleton and distribute that work
27  under terms of your choice, so long as that work isn't itself a
28  parser generator using the skeleton or a modified version thereof
29  as a parser skeleton. Alternatively, if you modify or redistribute
30  the parser skeleton itself, you may (at your option) remove this
31  special exception, which will cause the skeleton and the resulting
32  Bison output files to be licensed under the GNU General Public
33  License without this special exception.
34 
35  This special exception was added by the Free Software Foundation in
36  version 2.2 of Bison. */
37 
38 /* C LALR(1) parser skeleton written by Richard Stallman, by
39  simplifying the original so-called "semantic" parser. */
40 
41 /* All symbols defined below should begin with yy or YY, to avoid
42  infringing on user name space. This should be done even for local
43  variables, as they might otherwise be expanded by user macros.
44  There are some unavoidable exceptions within include files to
45  define necessary library symbols; they are noted "INFRINGES ON
46  USER NAME SPACE" below. */
47 
48 /* Identify Bison output. */
49 #define YYBISON 1
50 
51 /* Bison version. */
52 #define YYBISON_VERSION "3.0"
53 
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56 
57 /* Pure parsers. */
58 #define YYPURE 0
59 
60 /* Push parsers. */
61 #define YYPUSH 0
62 
63 /* Pull parsers. */
64 #define YYPULL 1
65 
66 
67 
68 /* Copy the first part of user declarations. */
69 
70 
71 #include <cstdlib>
72 #include <cstdio>
73 #include <iostream>
74 #include <string>
75 #include <vector>
76 #include <complex>
77 #include <limits>
78 
79  template<bool> struct bool2type { };
80 
81  // numeric
82  template<typename T>
83  T* from_string_impl(std::string& s, bool2type<true>) {
84  if(s[0]=='(')
85  s.erase(s.begin());
86  T* res = (T*)malloc(sizeof(T));
87  if(std::numeric_limits<T>::is_integer)
88  *res=(T)atoi(s.c_str());
89  else
90  *res=(T)atof(s.c_str());
91  return res;
92  }
93 
94  // not numeric
95  template<typename T>
96  T* from_string_impl(std::string& s, bool2type<false>) {
97  return (new T(s.c_str()));
98  }
99 
100  template<class T>
101  T* from_string(std::string s) {
102  return from_string_impl<T>(s,bool2type<std::numeric_limits<T>::is_specialized>());
103  }
104 
105  template<>
106  std::complex<double>* from_string(std::string s) {
107  std::complex<double>* res = new std::complex<double>();
108  std::istringstream ss(s);
109  ss >> *res;
110  return res;
111  }
112 
113  template<>
114  std::complex<long double>* from_string(std::string s) {
115  std::complex<long double>* res = new std::complex<long double>();
116  std::istringstream ss(s);
117  ss >> *res;
118  return res;
119  }
120 
121 #ifdef _SCL_MPF_H_
122 template <>
123 Scl<MPF>* from_string(std::string s) {
124  std::string cpy(s);
125  if(cpy[0]=='(') {
126  std::size_t comma = cpy.find_first_of(",");
127  cpy = cpy.substr(1,comma-1);
128  }
129  return new Scl<MPF>(cpy.c_str());
130 }
131 
132 #endif
133 
134 #include "lex.yy.c"
135 
136 # ifndef YY_NULL
137 # if defined __cplusplus && 201103L <= __cplusplus
138 # define YY_NULL nullptr
139 # else
140 # define YY_NULL 0
141 # endif
142 # endif
143 
144 /* Enabling verbose error messages. */
145 #ifdef YYERROR_VERBOSE
146 # undef YYERROR_VERBOSE
147 # define YYERROR_VERBOSE 1
148 #else
149 # define YYERROR_VERBOSE 0
150 #endif
151 
152 /* In a future release of Bison, this section will be replaced
153  by #include "parser.tab.h". */
154 #ifndef YY_YY_PARSER_TAB_H_INCLUDED
155 # define YY_YY_PARSER_TAB_H_INCLUDED
156 /* Debug traces. */
157 #ifndef YYDEBUG
158 # define YYDEBUG 0
159 #endif
160 #if YYDEBUG
161 extern int yydebug;
162 #endif
163 
164 /* Token type. */
165 #ifndef YYTOKENTYPE
166 # define YYTOKENTYPE
168  {
169  TXVAR = 258,
170  TVALUE = 259,
171  TMUL = 260,
172  TDIV = 261,
173  TPLUS = 262,
174  TMINUS = 263,
175  TLPAREN = 264,
176  TRPAREN = 265,
177  TPOW = 266,
178  TEND = 267,
179  TCOMMA = 268,
180  TEXP = 269,
181  UMINUS = 270,
182  EXP = 271,
183  CPLX = 272
184  };
185 #endif
186 
187 #endif /* !YY_YY_PARSER_TAB_H_INCLUDED */
188 
189 
190 
191 #ifdef short
192 # undef short
193 #endif
194 
195 #ifdef YYTYPE_UINT8
196 typedef YYTYPE_UINT8 yytype_uint8;
197 #else
198 typedef unsigned char yytype_uint8;
199 #endif
200 
201 #ifdef YYTYPE_INT8
202 typedef YYTYPE_INT8 yytype_int8;
203 #else
204 typedef signed char yytype_int8;
205 #endif
206 
207 #ifdef YYTYPE_UINT16
208 typedef YYTYPE_UINT16 yytype_uint16;
209 #else
210 typedef unsigned short int yytype_uint16;
211 #endif
212 
213 #ifdef YYTYPE_INT16
214 typedef YYTYPE_INT16 yytype_int16;
215 #else
216 typedef short int yytype_int16;
217 #endif
218 
219 #ifndef YYSIZE_T
220 # ifdef __SIZE_TYPE__
221 # define YYSIZE_T __SIZE_TYPE__
222 # elif defined size_t
223 # define YYSIZE_T size_t
224 # elif ! defined YYSIZE_T
225 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
226 # define YYSIZE_T size_t
227 # else
228 # define YYSIZE_T unsigned int
229 # endif
230 #endif
231 
232 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
233 
234 #ifndef YY_
235 # if defined YYENABLE_NLS && YYENABLE_NLS
236 # if ENABLE_NLS
237 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
238 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
239 # endif
240 # endif
241 # ifndef YY_
242 # define YY_(Msgid) Msgid
243 # endif
244 #endif
245 
246 #ifndef __attribute__
247 /* This feature is available in gcc versions 2.5 and later. */
248 # if (! defined __GNUC__ || __GNUC__ < 2 \
249  || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
250 # define __attribute__(Spec) /* empty */
251 # endif
252 #endif
253 
254 /* Suppress unused-variable warnings by "using" E. */
255 #if ! defined lint || defined __GNUC__
256 # define YYUSE(E) ((void) (E))
257 #else
258 # define YYUSE(E) /* empty */
259 #endif
260 
261 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
262 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
263 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
264  _Pragma ("GCC diagnostic push") \
265  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
266  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
267 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
268  _Pragma ("GCC diagnostic pop")
269 #else
270 # define YY_INITIAL_VALUE(Value) Value
271 #endif
272 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
273 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
274 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
275 #endif
276 #ifndef YY_INITIAL_VALUE
277 # define YY_INITIAL_VALUE(Value) /* Nothing. */
278 #endif
279 
280 
281 #if ! defined yyoverflow || YYERROR_VERBOSE
282 
283 /* The parser invokes alloca or malloc; define the necessary symbols. */
284 
285 # ifdef YYSTACK_USE_ALLOCA
286 # if YYSTACK_USE_ALLOCA
287 # ifdef __GNUC__
288 # define YYSTACK_ALLOC __builtin_alloca
289 # elif defined __BUILTIN_VA_ARG_INCR
290 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
291 # elif defined _AIX
292 # define YYSTACK_ALLOC __alloca
293 # elif defined _MSC_VER
294 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
295 # define alloca _alloca
296 # else
297 # define YYSTACK_ALLOC alloca
298 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
299 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
300  /* Use EXIT_SUCCESS as a witness for stdlib.h. */
301 # ifndef EXIT_SUCCESS
302 # define EXIT_SUCCESS 0
303 # endif
304 # endif
305 # endif
306 # endif
307 # endif
308 
309 # ifdef YYSTACK_ALLOC
310  /* Pacify GCC's 'empty if-body' warning. */
311 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
312 # ifndef YYSTACK_ALLOC_MAXIMUM
313  /* The OS might guarantee only one guard page at the bottom of the stack,
314  and a page size can be as small as 4096 bytes. So we cannot safely
315  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
316  to allow for a few compiler-allocated temporary stack slots. */
317 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
318 # endif
319 # else
320 # define YYSTACK_ALLOC YYMALLOC
321 # define YYSTACK_FREE YYFREE
322 # ifndef YYSTACK_ALLOC_MAXIMUM
323 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
324 # endif
325 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
326  && ! ((defined YYMALLOC || defined malloc) \
327  && (defined YYFREE || defined free)))
328 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
329 # ifndef EXIT_SUCCESS
330 # define EXIT_SUCCESS 0
331 # endif
332 # endif
333 # ifndef YYMALLOC
334 # define YYMALLOC malloc
335 # if ! defined malloc && ! defined EXIT_SUCCESS
336 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
337 # endif
338 # endif
339 # ifndef YYFREE
340 # define YYFREE free
341 # if ! defined free && ! defined EXIT_SUCCESS
342 void free (void *); /* INFRINGES ON USER NAME SPACE */
343 # endif
344 # endif
345 # endif
346 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
347 
348 
349 #if (! defined yyoverflow \
350  && (! defined __cplusplus \
351  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
352 
353 /* A type that is properly aligned for any stack member. */
354 union yyalloc
355 {
356  yytype_int16 yyss_alloc;
357  YYSTYPE yyvs_alloc;
358 };
359 
360 /* The size of the maximum gap between one aligned stack and the next. */
361 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
362 
363 /* The size of an array large to enough to hold all stacks, each with
364  N elements. */
365 # define YYSTACK_BYTES(N) \
366  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
367  + YYSTACK_GAP_MAXIMUM)
368 
369 # define YYCOPY_NEEDED 1
370 
371 /* Relocate STACK from its old location to the new one. The
372  local variables YYSIZE and YYSTACKSIZE give the old and new number of
373  elements in the stack, and YYPTR gives the new location of the
374  stack. Advance YYPTR to a properly aligned location for the next
375  stack. */
376 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
377  do \
378  { \
379  YYSIZE_T yynewbytes; \
380  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
381  Stack = &yyptr->Stack_alloc; \
382  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
383  yyptr += yynewbytes / sizeof (*yyptr); \
384  } \
385  while (0)
386 
387 #endif
388 
389 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
390 /* Copy COUNT objects from SRC to DST. The source and destination do
391  not overlap. */
392 # ifndef YYCOPY
393 # if defined __GNUC__ && 1 < __GNUC__
394 # define YYCOPY(Dst, Src, Count) \
395  __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
396 # else
397 # define YYCOPY(Dst, Src, Count) \
398  do \
399  { \
400  YYSIZE_T yyi; \
401  for (yyi = 0; yyi < (Count); yyi++) \
402  (Dst)[yyi] = (Src)[yyi]; \
403  } \
404  while (0)
405 # endif
406 # endif
407 #endif /* !YYCOPY_NEEDED */
408 
409 /* YYFINAL -- State number of the termination state. */
410 #define YYFINAL 12
411 /* YYLAST -- Last index in YYTABLE. */
412 #define YYLAST 27
413 
414 /* YYNTOKENS -- Number of terminals. */
415 #define YYNTOKENS 18
416 /* YYNNTS -- Number of nonterminals. */
417 #define YYNNTS 6
418 /* YYNRULES -- Number of rules. */
419 #define YYNRULES 13
420 /* YYNSTATES -- Number of states. */
421 #define YYNSTATES 23
422 
423 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
424  by yylex, with out-of-bounds checking. */
425 #define YYUNDEFTOK 2
426 #define YYMAXUTOK 272
427 
428 #define YYTRANSLATE(YYX) \
429  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
430 
431 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
432  as returned by yylex, without out-of-bounds checking. */
433 static const yytype_uint8 yytranslate[] =
434 {
435  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
461  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
462  15, 16, 17
463 };
464 
465 #if YYDEBUG
466  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
467 static const yytype_uint8 yyrline[] =
468 {
469  0, 110, 110, 114, 115, 116, 117, 118, 119, 120,
470  123, 124, 127, 130
471 };
472 #endif
473 
474 #if YYDEBUG || YYERROR_VERBOSE || 0
475 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
476  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
477 static const char *const yytname[] =
478 {
479  "$end", "error", "$undefined", "TXVAR", "TVALUE", "TMUL", "TDIV",
480  "TPLUS", "TMINUS", "TLPAREN", "TRPAREN", "TPOW", "TEND", "TCOMMA",
481  "TEXP", "UMINUS", "EXP", "CPLX", "$accept", "end_polynomial",
482  "polynomial", "monomial", "value", "xvar", YY_NULL
483 };
484 #endif
485 
486 # ifdef YYPRINT
487 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
488  (internal) symbol number NUM (which must be that of a token). */
489 static const yytype_uint16 yytoknum[] =
490 {
491  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
492  265, 266, 267, 268, 269, 270, 271, 272
493 };
494 # endif
495 
496 #define YYPACT_NINF -8
497 
498 #define yypact_value_is_default(Yystate) \
499  (!!((Yystate) == (-8)))
500 
501 #define YYTABLE_NINF -1
502 
503 #define yytable_value_is_error(Yytable_value) \
504  0
505 
506  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
507  STATE-NUM. */
508 static const yytype_int8 yypact[] =
509 {
510  14, -8, -8, 14, 14, 2, 8, -8, -8, -8,
511  -7, -2, -8, 14, 14, 14, 3, -8, -8, -7,
512  16, 16, -8
513 };
514 
515  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
516  Performed when YYTABLE does not specify something else to do. Zero
517  means the default is an error. */
518 static const yytype_uint8 yydefact[] =
519 {
520  0, 13, 12, 0, 0, 0, 0, 3, 10, 11,
521  8, 0, 1, 0, 0, 0, 0, 2, 9, 6,
522  4, 5, 7
523 };
524 
525  /* YYPGOTO[NTERM-NUM]. */
526 static const yytype_int8 yypgoto[] =
527 {
528  -8, -8, -3, -8, -8, -8
529 };
530 
531  /* YYDEFGOTO[NTERM-NUM]. */
532 static const yytype_int8 yydefgoto[] =
533 {
534  -1, 5, 6, 7, 8, 9
535 };
536 
537  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
538  positive, shift that token. If negative, reduce the rule whose
539  number is the opposite. If YYTABLE_NINF, syntax error. */
540 static const yytype_uint8 yytable[] =
541 {
542  10, 11, 12, 13, 16, 14, 15, 22, 18, 16,
543  19, 20, 21, 13, 0, 14, 15, 1, 2, 16,
544  17, 13, 3, 4, 0, 0, 0, 16
545 };
546 
547 static const yytype_int8 yycheck[] =
548 {
549  3, 4, 0, 5, 11, 7, 8, 4, 10, 11,
550  13, 14, 15, 5, -1, 7, 8, 3, 4, 11,
551  12, 5, 8, 9, -1, -1, -1, 11
552 };
553 
554  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
555  symbol of state STATE-NUM. */
556 static const yytype_uint8 yystos[] =
557 {
558  0, 3, 4, 8, 9, 19, 20, 21, 22, 23,
559  20, 20, 0, 5, 7, 8, 11, 12, 10, 20,
560  20, 20, 4
561 };
562 
563  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
564 static const yytype_uint8 yyr1[] =
565 {
566  0, 18, 19, 20, 20, 20, 20, 20, 20, 20,
567  21, 21, 22, 23
568 };
569 
570  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
571 static const yytype_uint8 yyr2[] =
572 {
573  0, 2, 2, 1, 3, 3, 3, 3, 2, 3,
574  1, 1, 1, 1
575 };
576 
577 
578 #define yyerrok (yyerrstatus = 0)
579 #define yyclearin (yychar = YYEMPTY)
580 #define YYEMPTY (-2)
581 #define YYEOF 0
582 
583 #define YYACCEPT goto yyacceptlab
584 #define YYABORT goto yyabortlab
585 #define YYERROR goto yyerrorlab
586 
587 
588 #define YYRECOVERING() (!!yyerrstatus)
589 
590 #define YYBACKUP(Token, Value) \
591 do \
592  if (yychar == YYEMPTY) \
593  { \
594  yychar = (Token); \
595  yylval = (Value); \
596  YYPOPSTACK (yylen); \
597  yystate = *yyssp; \
598  goto yybackup; \
599  } \
600  else \
601  { \
602  yyerror (YY_("syntax error: cannot back up")); \
603  YYERROR; \
604  } \
605 while (0)
606 
607 /* Error token number */
608 #define YYTERROR 1
609 #define YYERRCODE 256
610 
611 # define YYDPRINTF(Args)
612 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
613 # define YY_STACK_PRINT(Bottom, Top)
614 # define YY_REDUCE_PRINT(Rule)
615 
616 /* YYINITDEPTH -- initial size of the parser's stacks. */
617 #ifndef YYINITDEPTH
618 # define YYINITDEPTH 200
619 #endif
620 
621 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
622  if the built-in stack extension method is used).
623 
624  Do not make this value too large; the results are undefined if
625  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
626  evaluated with infinite-precision integer arithmetic. */
627 
628 #ifndef YYMAXDEPTH
629 # define YYMAXDEPTH 10000
630 #endif
631 
632 
641 template<class VALUE, class MONOM, class MPOLY>
642  struct parser {
643 
644  MPOLY* yypol;
645 
646  parser() : yypol(0) {};
647 
648  void yyerror(const char *s) { printf("ERROR: %s\n", s); }
649 
650 /* Value type. */
651 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
652 struct YYSTYPE
653 {
654 
655 
656  std::string* sval_t;
657  VALUE* value_t;
658  MONOM* monom_t;
659  MPOLY* mpol_t;
660 
661 
662 };
663 # define YYSTYPE_IS_TRIVIAL 1
664 # define YYSTYPE_IS_DECLARED 1
665 #endif
666 
667 /*-----------------------------------------------.
668 | Release the memory associated to this symbol. |
669 `-----------------------------------------------*/
670 
671 static void
672 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
673 {
674  YYUSE (yyvaluep);
675  if (!yymsg)
676  yymsg = "Deleting";
677  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
678 
680  YYUSE (yytype);
682 }
683 
684 
685 
686 
687 /* The lookahead symbol. */
688 int yychar;
689 
690 /* The semantic value of the lookahead symbol. */
692 /* Number of syntax errors so far. */
694 
695 
696 /*----------.
697 | yyparse. |
698 `----------*/
699 
700 int
701 yyparse (void)
702 {
703  int yystate;
704  /* Number of tokens to shift before error messages enabled. */
705  int yyerrstatus;
706 
707  /* The stacks and their tools:
708  'yyss': related to states.
709  'yyvs': related to semantic values.
710 
711  Refer to the stacks through separate pointers, to allow yyoverflow
712  to reallocate them elsewhere. */
713 
714  /* The state stack. */
715  yytype_int16 yyssa[YYINITDEPTH];
716  yytype_int16 *yyss;
717  yytype_int16 *yyssp;
718 
719  /* The semantic value stack. */
720  YYSTYPE yyvsa[YYINITDEPTH];
721  YYSTYPE *yyvs;
722  YYSTYPE *yyvsp;
723 
724  YYSIZE_T yystacksize;
725 
726  int yyn;
727  int yyresult;
728  /* Lookahead token as an internal (translated) token number. */
729  int yytoken = 0;
730  /* The variables used to return semantic value and location from the
731  action routines. */
732  YYSTYPE yyval;
733 
734 #if YYERROR_VERBOSE
735  /* Buffer for error messages, and its allocated size. */
736  char yymsgbuf[128];
737  char *yymsg = yymsgbuf;
738  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
739 #endif
740 
741 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
742 
743  /* The number of symbols on the RHS of the reduced rule.
744  Keep to zero when no symbol should be popped. */
745  int yylen = 0;
746 
747  yyssp = yyss = yyssa;
748  yyvsp = yyvs = yyvsa;
749  yystacksize = YYINITDEPTH;
750 
751  YYDPRINTF ((stderr, "Starting parse\n"));
752 
753  yystate = 0;
754  yyerrstatus = 0;
755  yynerrs = 0;
756  yychar = YYEMPTY; /* Cause a token to be read. */
757  goto yysetstate;
758 
759 /*------------------------------------------------------------.
760 | yynewstate -- Push a new state, which is found in yystate. |
761 `------------------------------------------------------------*/
762  yynewstate:
763  /* In all cases, when you get here, the value and location stacks
764  have just been pushed. So pushing a state here evens the stacks. */
765  yyssp++;
766 
767  yysetstate:
768  *yyssp = yystate;
769 
770  if (yyss + yystacksize - 1 <= yyssp)
771  {
772  /* Get the current used size of the three stacks, in elements. */
773  YYSIZE_T yysize = yyssp - yyss + 1;
774 
775 #ifdef yyoverflow
776  {
777  /* Give user a chance to reallocate the stack. Use copies of
778  these so that the &'s don't force the real ones into
779  memory. */
780  YYSTYPE *yyvs1 = yyvs;
781  yytype_int16 *yyss1 = yyss;
782 
783  /* Each stack pointer address is followed by the size of the
784  data in use in that stack, in bytes. This used to be a
785  conditional around just the two extra args, but that might
786  be undefined if yyoverflow is a macro. */
787  yyoverflow (YY_("memory exhausted"),
788  &yyss1, yysize * sizeof (*yyssp),
789  &yyvs1, yysize * sizeof (*yyvsp),
790  &yystacksize);
791 
792  yyss = yyss1;
793  yyvs = yyvs1;
794  }
795 #else /* no yyoverflow */
796 # ifndef YYSTACK_RELOCATE
797  goto yyexhaustedlab;
798 # else
799  /* Extend the stack our own way. */
800  if (YYMAXDEPTH <= yystacksize)
801  goto yyexhaustedlab;
802  yystacksize *= 2;
803  if (YYMAXDEPTH < yystacksize)
804  yystacksize = YYMAXDEPTH;
805 
806  {
807  yytype_int16 *yyss1 = yyss;
808  union yyalloc *yyptr =
809  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
810  if (! yyptr)
811  goto yyexhaustedlab;
814 # undef YYSTACK_RELOCATE
815  if (yyss1 != yyssa)
816  YYSTACK_FREE (yyss1);
817  }
818 # endif
819 #endif /* no yyoverflow */
820 
821  yyssp = yyss + yysize - 1;
822  yyvsp = yyvs + yysize - 1;
823 
824  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
825  (unsigned long int) yystacksize));
826 
827  if (yyss + yystacksize - 1 <= yyssp)
828  YYABORT;
829  }
830 
831  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
832 
833  if (yystate == YYFINAL)
834  YYACCEPT;
835 
836  goto yybackup;
837 
838 /*-----------.
839 | yybackup. |
840 `-----------*/
841 yybackup:
842 
843  /* Do appropriate processing given the current state. Read a
844  lookahead token if we need one and don't already have one. */
845 
846  /* First try to decide what to do without reference to lookahead token. */
847  yyn = yypact[yystate];
848  if (yypact_value_is_default (yyn))
849  goto yydefault;
850 
851  /* Not known => get a lookahead token if don't already have one. */
852 
853  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
854  if (yychar == YYEMPTY)
855  {
856  YYDPRINTF ((stderr, "Reading a token: "));
857  yychar = yylex ();
858  }
859 
860  if (yychar <= YYEOF)
861  {
862  yychar = yytoken = YYEOF;
863  YYDPRINTF ((stderr, "Now at end of input.\n"));
864  }
865  else
866  {
867  yytoken = YYTRANSLATE (yychar);
868  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
869  }
870 
871  /* If the proper action on seeing token YYTOKEN is to reduce or to
872  detect an error, take that action. */
873  yyn += yytoken;
874  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
875  goto yydefault;
876  yyn = yytable[yyn];
877  if (yyn <= 0)
878  {
879  if (yytable_value_is_error (yyn))
880  goto yyerrlab;
881  yyn = -yyn;
882  goto yyreduce;
883  }
884 
885  /* Count tokens shifted since error; after three, turn off error
886  status. */
887  if (yyerrstatus)
888  yyerrstatus--;
889 
890  /* Shift the lookahead token. */
891  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
892 
893  /* Discard the shifted token. */
894  yychar = YYEMPTY;
895 
896  yystate = yyn;
898  *++yyvsp = yylval;
900 
901  goto yynewstate;
902 
903 
904 /*-----------------------------------------------------------.
905 | yydefault -- do the default action for the current state. |
906 `-----------------------------------------------------------*/
907 yydefault:
908  yyn = yydefact[yystate];
909  if (yyn == 0)
910  goto yyerrlab;
911  goto yyreduce;
912 
913 
914 /*-----------------------------.
915 | yyreduce -- Do a reduction. |
916 `-----------------------------*/
917 yyreduce:
918  /* yyn is the number of a rule to reduce with. */
919  yylen = yyr2[yyn];
920 
921  /* If YYLEN is nonzero, implement the default value of the action:
922  '$$ = $1'.
923 
924  Otherwise, the following line sets YYVAL to garbage.
925  This behavior is undocumented and Bison
926  users should not rely upon it. Assigning to YYVAL
927  unconditionally makes the parser a bit smaller, and it avoids a
928  GCC warning that YYVAL may be used uninitialized. */
929  yyval = yyvsp[1-yylen];
930 
931 
932  YY_REDUCE_PRINT (yyn);
933  switch (yyn)
934  {
935  case 2:
936 
937  {yypol = new MPOLY(*(yyvsp[-1].mpol_t)); delete (yyvsp[-1].mpol_t);}
938 
939  break;
940 
941  case 3:
942 
943  {(yyval.mpol_t) = new MPOLY(*(yyvsp[0].monom_t)); delete (yyvsp[0].monom_t);}
944 
945  break;
946 
947  case 4:
948 
949  {(yyval.mpol_t) = new MPOLY(*(yyvsp[-2].mpol_t) + *(yyvsp[0].mpol_t)); delete (yyvsp[-2].mpol_t); delete (yyvsp[0].mpol_t);}
950 
951  break;
952 
953  case 5:
954 
955  {(yyval.mpol_t) = new MPOLY(*(yyvsp[-2].mpol_t) - *(yyvsp[0].mpol_t)); delete (yyvsp[-2].mpol_t); delete (yyvsp[0].mpol_t);}
956 
957  break;
958 
959  case 6:
960 
961  {(yyval.mpol_t) = new MPOLY(*(yyvsp[-2].mpol_t) * *(yyvsp[0].mpol_t)); delete (yyvsp[-2].mpol_t); delete (yyvsp[0].mpol_t);}
962 
963  break;
964 
965  case 7:
966 
967  {(yyval.mpol_t) = new MPOLY(pow(*(yyvsp[-2].mpol_t),*(from_string<int>(*(yyvsp[0].sval_t))))); delete (yyvsp[-2].mpol_t); delete (yyvsp[0].sval_t);}
968 
969  break;
970 
971  case 8:
972 
973  {(yyval.mpol_t) = new MPOLY(MPOLY(VALUE(-1)) * *(yyvsp[0].mpol_t));delete (yyvsp[0].mpol_t);}
974 
975  break;
976 
977  case 9:
978 
979  {(yyval.mpol_t) = (yyvsp[-1].mpol_t);}
980 
981  break;
982 
983  case 10:
984 
985  {(yyval.monom_t)=new MONOM(*(yyvsp[0].value_t)); delete (yyvsp[0].value_t);}
986 
987  break;
988 
989  case 11:
990 
991  {(yyval.monom_t) = (yyvsp[0].monom_t);}
992 
993  break;
994 
995  case 12:
996 
997  {(yyval.value_t) = from_string<VALUE>(*(yyvsp[0].sval_t)); delete (yyvsp[0].sval_t);}
998 
999  break;
1000 
1001  case 13:
1002 
1003  {(yyval.monom_t) = new MONOM(*(from_string<int>(*(yyvsp[0].sval_t))),1); delete (yyvsp[0].sval_t);}
1004 
1005  break;
1006 
1007 
1008 
1009  default: break;
1010  }
1011  /* User semantic actions sometimes alter yychar, and that requires
1012  that yytoken be updated with the new translation. We take the
1013  approach of translating immediately before every use of yytoken.
1014  One alternative is translating here after every semantic action,
1015  but that translation would be missed if the semantic action invokes
1016  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1017  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1018  incorrect destructor might then be invoked immediately. In the
1019  case of YYERROR or YYBACKUP, subsequent parser actions might lead
1020  to an incorrect destructor call or verbose syntax error message
1021  before the lookahead is translated. */
1022  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1023 
1024  YYPOPSTACK (yylen);
1025  yylen = 0;
1026  YY_STACK_PRINT (yyss, yyssp);
1027 
1028  *++yyvsp = yyval;
1029 
1030  /* Now 'shift' the result of the reduction. Determine what state
1031  that goes to, based on the state we popped back to and the rule
1032  number reduced by. */
1033 
1034  yyn = yyr1[yyn];
1035 
1036  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1037  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1038  yystate = yytable[yystate];
1039  else
1040  yystate = yydefgoto[yyn - YYNTOKENS];
1041 
1042  goto yynewstate;
1043 
1044 
1045 /*--------------------------------------.
1046 | yyerrlab -- here on detecting error. |
1047 `--------------------------------------*/
1048 yyerrlab:
1049  /* Make sure we have latest lookahead translation. See comments at
1050  user semantic actions for why this is necessary. */
1051  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1052 
1053  /* If not already recovering from an error, report this error. */
1054  if (!yyerrstatus)
1055  {
1056  ++yynerrs;
1057 #if ! YYERROR_VERBOSE
1058  yyerror (YY_("syntax error"));
1059 #else
1060 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1061  yyssp, yytoken)
1062  {
1063  char const *yymsgp = YY_("syntax error");
1064  int yysyntax_error_status;
1065  yysyntax_error_status = YYSYNTAX_ERROR;
1066  if (yysyntax_error_status == 0)
1067  yymsgp = yymsg;
1068  else if (yysyntax_error_status == 1)
1069  {
1070  if (yymsg != yymsgbuf)
1071  YYSTACK_FREE (yymsg);
1072  yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1073  if (!yymsg)
1074  {
1075  yymsg = yymsgbuf;
1076  yymsg_alloc = sizeof yymsgbuf;
1077  yysyntax_error_status = 2;
1078  }
1079  else
1080  {
1081  yysyntax_error_status = YYSYNTAX_ERROR;
1082  yymsgp = yymsg;
1083  }
1084  }
1085  yyerror (yymsgp);
1086  if (yysyntax_error_status == 2)
1087  goto yyexhaustedlab;
1088  }
1089 # undef YYSYNTAX_ERROR
1090 #endif
1091  }
1092 
1093 
1094 
1095  if (yyerrstatus == 3)
1096  {
1097  /* If just tried and failed to reuse lookahead token after an
1098  error, discard it. */
1099 
1100  if (yychar <= YYEOF)
1101  {
1102  /* Return failure if at end of input. */
1103  if (yychar == YYEOF)
1104  YYABORT;
1105  }
1106  else
1107  {
1108  yydestruct ("Error: discarding",
1109  yytoken, &yylval);
1110  yychar = YYEMPTY;
1111  }
1112  }
1113 
1114  /* Else will try to reuse lookahead token after shifting the error
1115  token. */
1116  goto yyerrlab1;
1117 
1118 
1119 /*---------------------------------------------------.
1120 | yyerrorlab -- error raised explicitly by YYERROR. |
1121 `---------------------------------------------------*/
1122 yyerrorlab:
1123 
1124  /* Pacify compilers like GCC when the user code never invokes
1125  YYERROR and the label yyerrorlab therefore never appears in user
1126  code. */
1127  if (/*CONSTCOND*/ 0)
1128  goto yyerrorlab;
1129 
1130  /* Do not reclaim the symbols of the rule whose action triggered
1131  this YYERROR. */
1132  YYPOPSTACK (yylen);
1133  yylen = 0;
1134  YY_STACK_PRINT (yyss, yyssp);
1135  yystate = *yyssp;
1136  goto yyerrlab1;
1137 
1138 
1139 /*-------------------------------------------------------------.
1140 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1141 `-------------------------------------------------------------*/
1142 yyerrlab1:
1143  yyerrstatus = 3; /* Each real token shifted decrements this. */
1144 
1145  for (;;)
1146  {
1147  yyn = yypact[yystate];
1148  if (!yypact_value_is_default (yyn))
1149  {
1150  yyn += YYTERROR;
1151  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1152  {
1153  yyn = yytable[yyn];
1154  if (0 < yyn)
1155  break;
1156  }
1157  }
1158 
1159  /* Pop the current state because it cannot handle the error token. */
1160  if (yyssp == yyss)
1161  YYABORT;
1162 
1163 
1164  yydestruct ("Error: popping",
1165  yystos[yystate], yyvsp);
1166  YYPOPSTACK (1);
1167  yystate = *yyssp;
1168  YY_STACK_PRINT (yyss, yyssp);
1169  }
1170 
1172  *++yyvsp = yylval;
1174 
1175 
1176  /* Shift the error token. */
1177  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1178 
1179  yystate = yyn;
1180  goto yynewstate;
1181 
1182 
1183 /*-------------------------------------.
1184 | yyacceptlab -- YYACCEPT comes here. |
1185 `-------------------------------------*/
1186 yyacceptlab:
1187  yyresult = 0;
1188  goto yyreturn;
1189 
1190 /*-----------------------------------.
1191 | yyabortlab -- YYABORT comes here. |
1192 `-----------------------------------*/
1193 yyabortlab:
1194  yyresult = 1;
1195  goto yyreturn;
1196 
1197 #if !defined yyoverflow || YYERROR_VERBOSE
1198 /*-------------------------------------------------.
1199 | yyexhaustedlab -- memory exhaustion comes here. |
1200 `-------------------------------------------------*/
1201 yyexhaustedlab:
1202  yyerror (YY_("memory exhausted"));
1203  yyresult = 2;
1204  /* Fall through. */
1205 #endif
1206 
1207 yyreturn:
1208  if (yychar != YYEMPTY)
1209  {
1210  /* Make sure we have latest lookahead translation. See comments at
1211  user semantic actions for why this is necessary. */
1212  yytoken = YYTRANSLATE (yychar);
1213  yydestruct ("Cleanup: discarding lookahead",
1214  yytoken, &yylval);
1215  }
1216  /* Do not reclaim the symbols of the rule whose action triggered
1217  this YYABORT or YYACCEPT. */
1218  YYPOPSTACK (yylen);
1219  YY_STACK_PRINT (yyss, yyssp);
1220  while (yyssp != yyss)
1221  {
1222  yydestruct ("Cleanup: popping",
1223  yystos[*yyssp], yyvsp);
1224  YYPOPSTACK (1);
1225  }
1226 #ifndef yyoverflow
1227  if (yyss != yyssa)
1228  YYSTACK_FREE (yyss);
1229 #endif
1230 #if YYERROR_VERBOSE
1231  if (yymsg != yymsgbuf)
1232  YYSTACK_FREE (yymsg);
1233 #endif
1234  return yyresult;
1235 }
1236 
1239 YY_DECL
1241  register yy_state_type yy_current_state;
1242  register char *yy_cp, *yy_bp;
1243  register int yy_act;
1244 
1245  if ( !(yy_init) )
1246  {
1247  (yy_init) = 1;
1248 
1249 #ifdef YY_USER_INIT
1250  YY_USER_INIT;
1251 #endif
1252 
1253  if ( ! (yy_start) )
1254  (yy_start) = 1; /* first start state */
1255 
1256  if ( ! yyin )
1257  yyin = stdin;
1258 
1259  if ( ! yyout )
1260  yyout = stdout;
1261 
1262  if ( ! YY_CURRENT_BUFFER ) {
1263  yyensure_buffer_stack ();
1266  }
1267 
1269  }
1270 
1271  while ( 1 ) /* loops until end-of-file is reached */
1272  {
1273  yy_cp = (yy_c_buf_p);
1274 
1275  /* Support of yytext. */
1276  *yy_cp = (yy_hold_char);
1277 
1278  /* yy_bp points to the position in yy_ch_buf of the start of
1279  * the current run.
1280  */
1281  yy_bp = yy_cp;
1282 
1283  yy_current_state = (yy_start);
1284 yy_match:
1285  do
1286  {
1287  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1288  if ( yy_accept[yy_current_state] )
1289  {
1290  (yy_last_accepting_state) = yy_current_state;
1291  (yy_last_accepting_cpos) = yy_cp;
1292  }
1293  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1294  {
1295  yy_current_state = (int) yy_def[yy_current_state];
1296  if ( yy_current_state >= 51 )
1297  yy_c = yy_meta[(unsigned int) yy_c];
1298  }
1299  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1300  ++yy_cp;
1301  }
1302  while ( yy_base[yy_current_state] != 87 );
1303 
1304 yy_find_action:
1305  yy_act = yy_accept[yy_current_state];
1306  if ( yy_act == 0 )
1307  { /* have to back up */
1308  yy_cp = (yy_last_accepting_cpos);
1309  yy_current_state = (yy_last_accepting_state);
1310  yy_act = yy_accept[yy_current_state];
1311  }
1312 
1314 
1315 do_action: /* This label is used only to access EOF actions. */
1316 
1317  switch ( yy_act )
1318  { /* beginning of action switch */
1319  case 0: /* must back up */
1320  /* undo the effects of YY_DO_BEFORE_ACTION */
1321  *yy_cp = (yy_hold_char);
1322  yy_cp = (yy_last_accepting_cpos);
1323  yy_current_state = (yy_last_accepting_state);
1324  goto yy_find_action;
1325 
1326 case 1:
1327 /* rule 1 can match eol */
1329 {}
1330  YY_BREAK
1331 case 2:
1333 {yylval.sval_t = new std::string(yytext);
1334  return TVALUE;}
1335  YY_BREAK
1336 case 3:
1338 {yylval.sval_t = new std::string(yytext);
1339  return TVALUE;}
1340  YY_BREAK
1341 case 4:
1343 {yylval.sval_t = new std::string(&yytext[1]);
1344  return TXVAR;}
1345  YY_BREAK
1346 case 5:
1348 {yylval.sval_t = new std::string(yytext);
1349  return TVALUE;}
1350  YY_BREAK
1351 case 6:
1353 {return TLPAREN;}
1354  YY_BREAK
1355 case 7:
1357 {return TRPAREN;}
1358  YY_BREAK
1359 case 8:
1361 {return TPLUS;}
1362  YY_BREAK
1363 case 9:
1365 {return TMINUS;}
1366  YY_BREAK
1367 case 10:
1369 {return TMUL;}
1370  YY_BREAK
1371 case 11:
1373 {return TPOW;}
1374  YY_BREAK
1375 case 12:
1377 {return TCOMMA;}
1378  YY_BREAK
1379 case YY_STATE_EOF(INITIAL):
1380 {yyterminate();}
1381  YY_BREAK
1382 case 13:
1384 {return TEND;}
1385  YY_BREAK
1386 case 14:
1388 {printf("Unknown token!\n"); yyterminate();}
1389  YY_BREAK
1390 case 15:
1392 ECHO;
1393  YY_BREAK
1394 
1395  case YY_END_OF_BUFFER:
1396  {
1397  /* Amount of text matched not including the EOB char. */
1398  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1399 
1400  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1401  *yy_cp = (yy_hold_char);
1403 
1404  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1405  {
1406  /* We're scanning a new file or input source. It's
1407  * possible that this happened because the user
1408  * just pointed yyin at a new source and called
1409  * yylex(). If so, then we have to assure
1410  * consistency between YY_CURRENT_BUFFER and our
1411  * globals. Here is the right place to do so, because
1412  * this is the first action (other than possibly a
1413  * back-up) that will match for the new input source.
1414  */
1415  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1416  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1417  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1418  }
1419 
1420  /* Note that here we test for yy_c_buf_p "<=" to the position
1421  * of the first EOB in the buffer, since yy_c_buf_p will
1422  * already have been incremented past the NUL character
1423  * (since all states make transitions on EOB to the
1424  * end-of-buffer state). Contrast this with the test
1425  * in input().
1426  */
1427  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1428  { /* This was really a NUL. */
1429  yy_state_type yy_next_state;
1430 
1431  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1432 
1433  yy_current_state = yy_get_previous_state( );
1434 
1435  /* Okay, we're now positioned to make the NUL
1436  * transition. We couldn't have
1437  * yy_get_previous_state() go ahead and do it
1438  * for us because it doesn't know how to deal
1439  * with the possibility of jamming (and we don't
1440  * want to build jamming into it because then it
1441  * will run more slowly).
1442  */
1443 
1444  yy_next_state = yy_try_NUL_trans( yy_current_state );
1445 
1446  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1447 
1448  if ( yy_next_state )
1449  {
1450  /* Consume the NUL. */
1451  yy_cp = ++(yy_c_buf_p);
1452  yy_current_state = yy_next_state;
1453  goto yy_match;
1454  }
1455 
1456  else
1457  {
1458  yy_cp = (yy_c_buf_p);
1459  goto yy_find_action;
1460  }
1461  }
1462 
1463  else switch ( yy_get_next_buffer( ) )
1464  {
1465  case EOB_ACT_END_OF_FILE:
1466  {
1467  (yy_did_buffer_switch_on_eof) = 0;
1468 
1469  if ( yywrap( ) )
1470  {
1471  /* Note: because we've taken care in
1472  * yy_get_next_buffer() to have set up
1473  * yytext, we can now set up
1474  * yy_c_buf_p so that if some total
1475  * hoser (like flex itself) wants to
1476  * call the scanner after we return the
1477  * YY_NULL, it'll still work - another
1478  * YY_NULL will get returned.
1479  */
1480  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1481 
1482  yy_act = YY_STATE_EOF(YY_START);
1483  goto do_action;
1484  }
1485 
1486  else
1487  {
1488  if ( ! (yy_did_buffer_switch_on_eof) )
1489  YY_NEW_FILE;
1490  }
1491  break;
1492  }
1493 
1494  case EOB_ACT_CONTINUE_SCAN:
1495  (yy_c_buf_p) =
1496  (yytext_ptr) + yy_amount_of_matched_text;
1497 
1498  yy_current_state = yy_get_previous_state( );
1499 
1500  yy_cp = (yy_c_buf_p);
1501  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1502  goto yy_match;
1503 
1504  case EOB_ACT_LAST_MATCH:
1505  (yy_c_buf_p) =
1506  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1507 
1508  yy_current_state = yy_get_previous_state( );
1509 
1510  yy_cp = (yy_c_buf_p);
1511  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1512  goto yy_find_action;
1513  }
1514  break;
1515  }
1516 
1517  default:
1519  "fatal flex scanner internal error--no action found" );
1520  } /* end of action switch */
1521  } /* end of scanning one token */
1522 } /* end of yylex */
1523 
1524 };
1525 
1526 #endif // __PARSER_TAB_C
1527 
#define YYEOF
Definition: parser.hpp:581
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition: parser.hpp:376
#define YYPOPSTACK(N)
#define YY_CURRENT_BUFFER
Definition: lex.mpoly.c:290
#define YY_END_OF_BUFFER
Definition: lex.mpoly.c:391
register char * yy_bp
Definition: parser.hpp:1242
#define YYABORT
Definition: parser.hpp:584
void yyerror(const char *s)
Definition: parser.hpp:648
int yynerrs
Definition: parser.hpp:693
MONOM * monom_t
Definition: parser.hpp:658
MPOLY * yypol
Definition: parser.hpp:644
#define YY_RESTORE_YY_MORE_OFFSET
Definition: lex.mpoly.c:485
int yychar
Definition: parser.hpp:688
#define YY_MORE_ADJ
Definition: lex.mpoly.c:484
#define YYTRANSLATE(YYX)
Definition: parser.hpp:428
Definition: parser.hpp:170
void free(void *)
#define YYFINAL
Definition: parser.hpp:410
#define YY_RULE_SETUP
Definition: lex.mpoly.c:673
#define YY_BUF_SIZE
Definition: lex.mpoly.c:170
std::string * sval_t
Definition: parser.hpp:656
Definition: parser.hpp:174
parser()
Definition: parser.hpp:646
#define YYSTACK_FREE
Definition: parser.hpp:321
#define YYSTACK_ALLOC
Definition: parser.hpp:320
int yyparse(void)
Definition: parser.hpp:701
Definition: parser.hpp:171
#define YY_FATAL_ERROR(msg)
Definition: lex.mpoly.c:645
FILE * yyin
Definition: lex.yy.c:339
#define INITIAL
Definition: lex.mpoly.c:499
MPOLY * mpol_t
Definition: parser.hpp:659
Definition: parser.hpp:79
#define YY_DO_BEFORE_ACTION
Definition: lex.mpoly.c:383
#define YYNTOKENS
Definition: parser.hpp:415
T * from_string_impl(std::string &s, bool2type< true >)
Definition: parser.hpp:83
unsigned short int yytype_uint16
Definition: parser.hpp:210
Definition: parser.hpp:169
#define YY_BUFFER_NEW
Definition: lex.mpoly.c:262
YYSTYPE yylval
Definition: parser.hpp:691
#define YY_START
Definition: lex.mpoly.c:150
void * malloc(YYSIZE_T)
#define YY_BREAK
Definition: lex.mpoly.c:670
Definition: parser.hpp:652
Definition: parser.hpp:178
Scl< T > & pow(const Scl< T > &base, unsigned long exp)
Definition: BC.hpp:1075
#define yyterminate()
Definition: lex.mpoly.c:635
int yy_state_type
Definition: lex.mpoly.c:366
unsigned char YY_CHAR
Definition: lex.mpoly.c:362
register char * yy_cp
Definition: parser.hpp:1242
#define yytable_value_is_error(Yytable_value)
Definition: parser.hpp:503
Definition: parser.hpp:181
#define YY_STACK_PRINT(Bottom, Top)
Definition: parser.hpp:613
yytype_int16 yyss_alloc
Definition: parser.hpp:356
yytokentype
Definition: parser.hpp:167
static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Definition: parser.hpp:672
#define YYDPRINTF(Args)
Definition: parser.hpp:611
#define YY_SC_TO_UI(c)
Definition: lex.mpoly.c:138
#define yypact_value_is_default(Yystate)
Definition: parser.hpp:498
YYSTYPE yyvs_alloc
Definition: parser.hpp:357
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Definition: parser.hpp:273
#define YY_(Msgid)
Definition: parser.hpp:242
register int yy_act
Definition: parser.hpp:1243
Definition: Scl.hpp:26
VALUE * value_t
Definition: parser.hpp:657
Definition: parser.hpp:179
#define YYMAXDEPTH
Definition: parser.hpp:629
#define YY_BUFFER_NORMAL
Definition: lex.mpoly.c:263
Definition: parser.hpp:354
#define YY_CURRENT_BUFFER_LVALUE
Definition: lex.mpoly.c:297
int yylex(void)
Definition: parser.hpp:183
#define YY_REDUCE_PRINT(Rule)
Definition: parser.hpp:614
#define EOB_ACT_LAST_MATCH
Definition: lex.mpoly.c:189
FILE * yyout
Definition: lex.yy.c:339
T * from_string(std::string s)
Definition: parser.hpp:101
short int yytype_int16
Definition: parser.hpp:216
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
Definition: parser.hpp:274
Definition: parser.hpp:175
#define YYTERROR
Definition: parser.hpp:608
#define yywrap
Definition: lex.mpoly.c:22
#define YYINITDEPTH
Definition: parser.hpp:618
#define YYLAST
Definition: parser.hpp:412
#define ECHO
Definition: lex.mpoly.c:591
#define yy_load_buffer_state
Definition: lex.mpoly.c:13
#define YY_STATE_EOF(state)
Definition: lex.mpoly.c:154
Definition: parser.hpp:177
char * yytext
Definition: lex.yy.c:484
#define EOB_ACT_END_OF_FILE
Definition: lex.mpoly.c:188
Definition: parser.hpp:182
Parser for polynomials.
Definition: parser.hpp:642
#define YYSIZE_T
Definition: parser.hpp:226
#define EOB_ACT_CONTINUE_SCAN
Definition: lex.mpoly.c:187
YY_BUFFER_STATE yy_create_buffer(FILE *file, int size)
Definition: lex.yy.c:1034
#define yytext_ptr
Definition: lex.mpoly.c:373
unsigned char yytype_uint8
Definition: parser.hpp:198
YY_DECL
Definition: parser.hpp:1240
Definition: parser.hpp:180
#define YYEMPTY
Definition: parser.hpp:580
#define YYUSE(E)
Definition: parser.hpp:256
#define YY_NULL
Definition: lex.mpoly.c:131
Definition: parser.hpp:176
signed char yytype_int8
Definition: parser.hpp:204
#define YYSTACK_BYTES(N)
Definition: parser.hpp:365
Definition: parser.hpp:173
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Definition: parser.hpp:612
#define YYACCEPT
Definition: parser.hpp:583
#define YY_NEW_FILE
Definition: lex.mpoly.c:157
Definition: parser.hpp:172
Home  |  Download & InstallContributions