Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/src/nvparse/_ps1.0_parser.cpp @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 40.1 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29/* A Bison parser, made by GNU Bison 1.875.  */
30
31/* Skeleton parser for Yacc-like parsing with Bison,
32   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
33
34   This program is free software; you can redistribute it and/or modify
35   it under the terms of the GNU General Public License as published by
36   the Free Software Foundation; either version 2, or (at your option)
37   any later version.
38
39   This program is distributed in the hope that it will be useful,
40   but WITHOUT ANY WARRANTY; without even the implied warranty of
41   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
42   GNU General Public License for more details.
43
44   You should have received a copy of the GNU General Public License
45   along with this program; if not, write to the Free Software
46   Foundation, Inc., 59 Temple Place - Suite 330,
47   Boston, MA 02111-1307, USA.  */
48
49/* As a special exception, when this file is copied by Bison into a
50   Bison output file, you may use that output file without restriction.
51   This special exception was added by the Free Software Foundation
52   in version 1.24 of Bison.  */
53
54/* Written by Richard Stallman by simplifying the original so called
55   ``semantic'' parser.  */
56
57/* All symbols defined below should begin with yy or YY, to avoid
58   infringing on user name space.  This should be done even for local
59   variables, as they might otherwise be expanded by user macros.
60   There are some unavoidable exceptions within include files to
61   define necessary library symbols; they are noted "INFRINGES ON
62   USER NAME SPACE" below.  */
63
64/* Identify Bison output.  */
65#define YYBISON 1
66
67/* Skeleton name.  */
68#define YYSKELETON_NAME "yacc.c"
69
70/* Pure parsers.  */
71#define YYPURE 0
72
73/* Using locations.  */
74#define YYLSP_NEEDED 0
75
76/* If NAME_PREFIX is specified substitute the variables and functions
77   names.  */
78#define yyparse ps10_parse
79#define yylex   ps10_lex
80#define yyerror ps10_error
81#define yylval  ps10_lval
82#define yychar  ps10_char
83#define yydebug ps10_debug
84#define yynerrs ps10_nerrs
85
86
87/* Tokens.  */
88#ifndef YYTOKENTYPE
89# define YYTOKENTYPE
90   /* Put the tokens into the symbol table, so that GDB and other debuggers
91      know about them.  */
92   enum yytokentype {
93     HEADER = 258,
94     NEWLINE = 259,
95     NUMBER = 260,
96     REG = 261,
97     DEF = 262,
98     ADDROP = 263,
99     BLENDOP = 264
100   };
101#endif
102#define HEADER 258
103#define NEWLINE 259
104#define NUMBER 260
105#define REG 261
106#define DEF 262
107#define ADDROP 263
108#define BLENDOP 264
109
110
111
112
113/* Copy the first part of user declarations.  */
114#line 3 "ps1.0_grammar.y"
115
116
117/*
118
119        This is a parser for the DX8 PS1.0 pixel shaders.  I intend
120        to use it to set NV_texture_shader* and NV_register_combiners*
121        state in OpenGL, but the parse tree could be used for any
122        other purpose.
123
124        Cass Everitt
125        7-19-01
126
127*/
128
129void yyerror(char* s);
130int yylex ( void );
131
132#ifdef _WIN32
133# include <windows.h>
134#endif
135
136#include <stdio.h>
137#include <stdlib.h>
138
139#include "ps1.0_program.h"
140#include "nvparse_errors.h"
141#include "nvparse_externs.h"
142
143#include <list>
144#include <vector>
145
146using namespace std;
147using namespace ps10;
148
149//#define DBG_MESG(msg, line)   errors.set(msg, line)
150#define DBG_MESG(msg, line)
151
152
153
154
155/* Enabling traces.  */
156#ifndef YYDEBUG
157# define YYDEBUG 0
158#endif
159
160/* Enabling verbose error messages.  */
161#ifdef YYERROR_VERBOSE
162# undef YYERROR_VERBOSE
163# define YYERROR_VERBOSE 1
164#else
165# define YYERROR_VERBOSE 0
166#endif
167
168#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
169#line 43 "ps1.0_grammar.y"
170typedef union YYSTYPE {
171        int ival;
172        float fval;
173       
174        string * sval;
175        constdef * cdef;
176        vector<constdef> * consts;
177        vector<string> * line;
178        list<vector<string> > * lines;
179} YYSTYPE;
180/* Line 191 of yacc.c.  */
181#line 153 "_ps1.0_parser.c"
182# define yystype YYSTYPE /* obsolescent; will be withdrawn */
183# define YYSTYPE_IS_DECLARED 1
184# define YYSTYPE_IS_TRIVIAL 1
185#endif
186
187
188
189/* Copy the second part of user declarations.  */
190
191
192/* Line 214 of yacc.c.  */
193#line 165 "_ps1.0_parser.c"
194
195#if ! defined (yyoverflow) || YYERROR_VERBOSE
196
197/* The parser invokes alloca or malloc; define the necessary symbols.  */
198
199# if YYSTACK_USE_ALLOCA
200#  define YYSTACK_ALLOC alloca
201# else
202#  ifndef YYSTACK_USE_ALLOCA
203#   if defined (alloca) || defined (_ALLOCA_H)
204#    define YYSTACK_ALLOC alloca
205#   else
206#    ifdef __GNUC__
207#     define YYSTACK_ALLOC __builtin_alloca
208#    endif
209#   endif
210#  endif
211# endif
212
213# ifdef YYSTACK_ALLOC
214   /* Pacify GCC's `empty if-body' warning. */
215#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
216# else
217#  if defined (__STDC__) || defined (__cplusplus)
218#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
219#   define YYSIZE_T size_t
220#  endif
221#  define YYSTACK_ALLOC malloc
222#  define YYSTACK_FREE free
223# endif
224#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
225
226
227#if (! defined (yyoverflow) \
228     && (! defined (__cplusplus) \
229         || (YYSTYPE_IS_TRIVIAL)))
230
231/* A type that is properly aligned for any stack member.  */
232union yyalloc
233{
234  short yyss;
235  YYSTYPE yyvs;
236  };
237
238/* The size of the maximum gap between one aligned stack and the next.  */
239# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
240
241/* The size of an array large to enough to hold all stacks, each with
242   N elements.  */
243# define YYSTACK_BYTES(N) \
244     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
245      + YYSTACK_GAP_MAXIMUM)
246
247/* Copy COUNT objects from FROM to TO.  The source and destination do
248   not overlap.  */
249# ifndef YYCOPY
250#  if 1 < __GNUC__
251#   define YYCOPY(To, From, Count) \
252      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
253#  else
254#   define YYCOPY(To, From, Count)              \
255      do                                        \
256        {                                       \
257          register YYSIZE_T yyi;                \
258          for (yyi = 0; yyi < (Count); yyi++)   \
259            (To)[yyi] = (From)[yyi];            \
260        }                                       \
261      while (0)
262#  endif
263# endif
264
265/* Relocate STACK from its old location to the new one.  The
266   local variables YYSIZE and YYSTACKSIZE give the old and new number of
267   elements in the stack, and YYPTR gives the new location of the
268   stack.  Advance YYPTR to a properly aligned location for the next
269   stack.  */
270# define YYSTACK_RELOCATE(Stack)                                        \
271    do                                                                  \
272      {                                                                 \
273        YYSIZE_T yynewbytes;                                            \
274        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
275        Stack = &yyptr->Stack;                                          \
276        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
277        yyptr += yynewbytes / sizeof (*yyptr);                          \
278      }                                                                 \
279    while (0)
280
281#endif
282
283#if defined (__STDC__) || defined (__cplusplus)
284   typedef signed char yysigned_char;
285#else
286   typedef short yysigned_char;
287#endif
288
289/* YYFINAL -- State number of the termination state. */
290#define YYFINAL  6
291/* YYLAST -- Last index in YYTABLE.  */
292#define YYLAST   80
293
294/* YYNTOKENS -- Number of terminals. */
295#define YYNTOKENS  12
296/* YYNNTS -- Number of nonterminals. */
297#define YYNNTS  10
298/* YYNRULES -- Number of rules. */
299#define YYNRULES  26
300/* YYNRULES -- Number of states. */
301#define YYNSTATES  63
302
303/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
304#define YYUNDEFTOK  2
305#define YYMAXUTOK   264
306
307#define YYTRANSLATE(YYX)                                                \
308  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
309
310/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
311static const unsigned char yytranslate[] =
312{
313       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
314       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
315       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
316       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
317       2,     2,     2,    11,    10,     2,     2,     2,     2,     2,
318       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
319       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
320       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
321       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
322       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
323       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
324       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
325       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
326       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
327       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
328       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
329       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
330       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
331       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
332       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
333       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
334       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
335       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
336       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
337       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
338       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
339       5,     6,     7,     8,     9
340};
341
342#if YYDEBUG
343/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
344   YYRHS.  */
345static const unsigned char yyprhs[] =
346{
347       0,     0,     3,     9,    16,    21,    27,    32,    38,    42,
348      47,    49,    52,    64,    66,    69,    73,    79,    87,    89,
349      92,    99,   108,   119,   120,   122,   124
350};
351
352/* YYRHS -- A `-1'-separated list of the rules' RHS. */
353static const yysigned_char yyrhs[] =
354{
355      13,     0,    -1,     3,    21,    14,    16,    18,    -1,    21,
356       3,    21,    14,    16,    18,    -1,     3,    21,    16,    18,
357      -1,    21,     3,    21,    16,    18,    -1,     3,    21,    14,
358      18,    -1,    21,     3,    21,    14,    18,    -1,     3,    21,
359      18,    -1,    21,     3,    21,    18,    -1,    15,    -1,    14,
360      15,    -1,     7,     6,    10,     5,    10,     5,    10,     5,
361      10,     5,    21,    -1,    17,    -1,    16,    17,    -1,     8,
362       6,    21,    -1,     8,     6,    10,     6,    21,    -1,     8,
363       6,    10,     6,    10,     6,    21,    -1,    19,    -1,    18,
364      19,    -1,    20,     9,     6,    10,     6,    21,    -1,    20,
365       9,     6,    10,     6,    10,     6,    21,    -1,    20,     9,
366       6,    10,     6,    10,     6,    10,     6,    21,    -1,    -1,
367      11,    -1,     4,    -1,    21,     4,    -1
368};
369
370/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
371static const unsigned short yyrline[] =
372{
373       0,    72,    72,    79,    86,    93,   100,   107,   114,   121,
374     131,   139,   151,   165,   173,   184,   194,   206,   223,   231,
375     243,   257,   273,   293,   295,   301,   305
376};
377#endif
378
379#if YYDEBUG || YYERROR_VERBOSE
380/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
381   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
382static const char *const yytname[] =
383{
384  "$end", "error", "$undefined", "HEADER", "NEWLINE", "NUMBER", "REG", 
385  "DEF", "ADDROP", "BLENDOP", "','", "'+'", "$accept", "WholeEnchilada", 
386  "Defs", "Def", "AddrOps", "AddrOp", "BlendOps", "BlendOp", "MaybePlus", 
387  "Newlines", 0
388};
389#endif
390
391# ifdef YYPRINT
392/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
393   token YYLEX-NUM.  */
394static const unsigned short yytoknum[] =
395{
396       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
397      44,    43
398};
399# endif
400
401/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
402static const unsigned char yyr1[] =
403{
404       0,    12,    13,    13,    13,    13,    13,    13,    13,    13,
405      14,    14,    15,    16,    16,    17,    17,    17,    18,    18,
406      19,    19,    19,    20,    20,    21,    21
407};
408
409/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
410static const unsigned char yyr2[] =
411{
412       0,     2,     5,     6,     4,     5,     4,     5,     3,     4,
413       1,     2,    11,     1,     2,     3,     5,     7,     1,     2,
414       6,     8,    10,     0,     1,     1,     2
415};
416
417/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
418   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
419   means the default is an error.  */
420static const unsigned char yydefact[] =
421{
422       0,     0,    25,     0,     0,    23,     1,     0,    26,     0,
423       0,    24,    23,    10,    23,    13,     8,    18,     0,    23,
424       0,     0,    11,    23,     6,    14,     4,    19,     0,    23,
425      23,     9,     0,     0,    15,     2,     0,    23,     7,     5,
426       0,     0,     0,     3,     0,     0,    16,     0,     0,     0,
427       0,    20,     0,    17,     0,     0,     0,    21,     0,     0,
428       0,    22,    12
429};
430
431/* YYDEFGOTO[NTERM-NUM]. */
432static const yysigned_char yydefgoto[] =
433{
434      -1,     3,    12,    13,    14,    15,    16,    17,    18,     4
435};
436
437/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
438   STATE-NUM.  */
439#define YYPACT_NINF -15
440static const yysigned_char yypact[] =
441{
442      10,     1,   -15,    47,    52,     0,   -15,     1,   -15,    37,
443      51,   -15,    43,   -15,    41,   -15,    -8,   -15,    53,     0,
444      50,    26,   -15,    41,    -8,   -15,    -8,   -15,    55,    43,
445      41,    -8,    58,    59,    60,    -8,    56,    41,    -8,    -8,
446      57,    27,    62,    -8,    64,    65,    60,    34,    63,     1,
447      66,    60,    69,    60,    35,    67,    70,    60,    73,     1,
448       1,    60,    60
449};
450
451/* YYPGOTO[NTERM-NUM].  */
452static const yysigned_char yypgoto[] =
453{
454     -15,   -15,    61,    -3,     3,     5,     4,   -14,   -15,    -1
455};
456
457/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
458   positive, shift that token.  If negative, reduce the rule which
459   number is the opposite.  If zero, do what YYDEFACT says.
460   If YYTABLE_NINF, syntax error.  */
461#define YYTABLE_NINF -24
462static const yysigned_char yytable[] =
463{
464       5,   -23,    27,    11,     8,     2,    19,     9,    10,    22,
465      27,    11,    27,     1,     2,    23,    24,    27,    26,    25,
466      34,    27,    30,    31,    27,    27,    22,    35,    25,    27,
467       2,     2,    37,    38,    39,    25,    33,    45,     2,     2,
468      46,    43,    25,    20,    50,    56,    51,     6,    53,    10,
469       9,    10,    11,    57,    11,     7,     8,    21,    61,    62,
470      32,    36,    28,    40,     8,    41,    42,    44,    47,    48,
471       0,    49,    54,    52,    55,     0,    59,    58,    60,     0,
472      29
473};
474
475static const yysigned_char yycheck[] =
476{
477       1,     9,    16,    11,     4,     4,     7,     7,     8,    12,
478      24,    11,    26,     3,     4,    12,    12,    31,    14,    14,
479      21,    35,    19,    19,    38,    39,    29,    23,    23,    43,
480       4,     4,    29,    29,    30,    30,    10,    10,     4,     4,
481      41,    37,    37,     6,    10,    10,    47,     0,    49,     8,
482       7,     8,    11,    54,    11,     3,     4,     6,    59,    60,
483      10,     6,     9,     5,     4,     6,    10,    10,     6,     5,
484      -1,     6,     6,    10,     5,    -1,     6,    10,     5,    -1,
485      19
486};
487
488/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
489   symbol of state STATE-NUM.  */
490static const unsigned char yystos[] =
491{
492       0,     3,     4,    13,    21,    21,     0,     3,     4,     7,
493       8,    11,    14,    15,    16,    17,    18,    19,    20,    21,
494       6,     6,    15,    16,    18,    17,    18,    19,     9,    14,
495      16,    18,    10,    10,    21,    18,     6,    16,    18,    18,
496       5,     6,    10,    18,    10,    10,    21,     6,     5,     6,
497      10,    21,    10,    21,     6,     5,    10,    21,    10,     6,
498       5,    21,    21
499};
500
501#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
502# define YYSIZE_T __SIZE_TYPE__
503#endif
504#if ! defined (YYSIZE_T) && defined (size_t)
505# define YYSIZE_T size_t
506#endif
507#if ! defined (YYSIZE_T)
508# if defined (__STDC__) || defined (__cplusplus)
509#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
510#  define YYSIZE_T size_t
511# endif
512#endif
513#if ! defined (YYSIZE_T)
514# define YYSIZE_T unsigned int
515#endif
516
517#define yyerrok         (yyerrstatus = 0)
518#define yyclearin       (yychar = YYEMPTY)
519#define YYEMPTY         (-2)
520#define YYEOF           0
521
522#define YYACCEPT        goto yyacceptlab
523#define YYABORT         goto yyabortlab
524#define YYERROR         goto yyerrlab1
525
526
527/* Like YYERROR except do call yyerror.  This remains here temporarily
528   to ease the transition to the new meaning of YYERROR, for GCC.
529   Once GCC version 2 has supplanted version 1, this can go.  */
530
531#define YYFAIL          goto yyerrlab
532
533#define YYRECOVERING()  (!!yyerrstatus)
534
535#define YYBACKUP(Token, Value)                                  \
536do                                                              \
537  if (yychar == YYEMPTY && yylen == 1)                          \
538    {                                                           \
539      yychar = (Token);                                         \
540      yylval = (Value);                                         \
541      yytoken = YYTRANSLATE (yychar);                           \
542      YYPOPSTACK;                                               \
543      goto yybackup;                                            \
544    }                                                           \
545  else                                                          \
546    {                                                           \
547      yyerror ("syntax error: cannot back up");\
548      YYERROR;                                                  \
549    }                                                           \
550while (0)
551
552#define YYTERROR        1
553#define YYERRCODE       256
554
555/* YYLLOC_DEFAULT -- Compute the default location (before the actions
556   are run).  */
557
558#ifndef YYLLOC_DEFAULT
559# define YYLLOC_DEFAULT(Current, Rhs, N)         \
560  Current.first_line   = Rhs[1].first_line;      \
561  Current.first_column = Rhs[1].first_column;    \
562  Current.last_line    = Rhs[N].last_line;       \
563  Current.last_column  = Rhs[N].last_column;
564#endif
565
566/* YYLEX -- calling `yylex' with the right arguments.  */
567
568#ifdef YYLEX_PARAM
569# define YYLEX yylex (YYLEX_PARAM)
570#else
571# define YYLEX yylex ()
572#endif
573
574/* Enable debugging if requested.  */
575#if YYDEBUG
576
577# ifndef YYFPRINTF
578#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
579#  define YYFPRINTF fprintf
580# endif
581
582# define YYDPRINTF(Args)                        \
583do {                                            \
584  if (yydebug)                                  \
585    YYFPRINTF Args;                             \
586} while (0)
587
588# define YYDSYMPRINT(Args)                      \
589do {                                            \
590  if (yydebug)                                  \
591    yysymprint Args;                            \
592} while (0)
593
594# define YYDSYMPRINTF(Title, Token, Value, Location)            \
595do {                                                            \
596  if (yydebug)                                                  \
597    {                                                           \
598      YYFPRINTF (stderr, "%s ", Title);                         \
599      yysymprint (stderr,                                       \
600                  Token, Value);        \
601      YYFPRINTF (stderr, "\n");                                 \
602    }                                                           \
603} while (0)
604
605/*------------------------------------------------------------------.
606| yy_stack_print -- Print the state stack from its BOTTOM up to its |
607| TOP (cinluded).                                                   |
608`------------------------------------------------------------------*/
609
610#if defined (__STDC__) || defined (__cplusplus)
611static void
612yy_stack_print (short *bottom, short *top)
613#else
614static void
615yy_stack_print (bottom, top)
616    short *bottom;
617    short *top;
618#endif
619{
620  YYFPRINTF (stderr, "Stack now");
621  for (/* Nothing. */; bottom <= top; ++bottom)
622    YYFPRINTF (stderr, " %d", *bottom);
623  YYFPRINTF (stderr, "\n");
624}
625
626# define YY_STACK_PRINT(Bottom, Top)                            \
627do {                                                            \
628  if (yydebug)                                                  \
629    yy_stack_print ((Bottom), (Top));                           \
630} while (0)
631
632
633/*------------------------------------------------.
634| Report that the YYRULE is going to be reduced.  |
635`------------------------------------------------*/
636
637#if defined (__STDC__) || defined (__cplusplus)
638static void
639yy_reduce_print (int yyrule)
640#else
641static void
642yy_reduce_print (yyrule)
643    int yyrule;
644#endif
645{
646  int yyi;
647  unsigned int yylineno = yyrline[yyrule];
648  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
649             yyrule - 1, yylineno);
650  /* Print the symbols being reduced, and their result.  */
651  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
652    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
653  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
654}
655
656# define YY_REDUCE_PRINT(Rule)          \
657do {                                    \
658  if (yydebug)                          \
659    yy_reduce_print (Rule);             \
660} while (0)
661
662/* Nonzero means print parse trace.  It is left uninitialized so that
663   multiple parsers can coexist.  */
664int yydebug;
665#else /* !YYDEBUG */
666# define YYDPRINTF(Args)
667# define YYDSYMPRINT(Args)
668# define YYDSYMPRINTF(Title, Token, Value, Location)
669# define YY_STACK_PRINT(Bottom, Top)
670# define YY_REDUCE_PRINT(Rule)
671#endif /* !YYDEBUG */
672
673
674/* YYINITDEPTH -- initial size of the parser's stacks.  */
675#ifndef YYINITDEPTH
676# define YYINITDEPTH 200
677#endif
678
679/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
680   if the built-in stack extension method is used).
681
682   Do not make this value too large; the results are undefined if
683   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
684   evaluated with infinite-precision integer arithmetic.  */
685
686#if YYMAXDEPTH == 0
687# undef YYMAXDEPTH
688#endif
689
690#ifndef YYMAXDEPTH
691# define YYMAXDEPTH 10000
692#endif
693
694
695
696#if YYERROR_VERBOSE
697
698# ifndef yystrlen
699#  if defined (__GLIBC__) && defined (_STRING_H)
700#   define yystrlen strlen
701#  else
702/* Return the length of YYSTR.  */
703static YYSIZE_T
704#   if defined (__STDC__) || defined (__cplusplus)
705yystrlen (const char *yystr)
706#   else
707yystrlen (yystr)
708     const char *yystr;
709#   endif
710{
711  register const char *yys = yystr;
712
713  while (*yys++ != '\0')
714    continue;
715
716  return yys - yystr - 1;
717}
718#  endif
719# endif
720
721# ifndef yystpcpy
722#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
723#   define yystpcpy stpcpy
724#  else
725/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
726   YYDEST.  */
727static char *
728#   if defined (__STDC__) || defined (__cplusplus)
729yystpcpy (char *yydest, const char *yysrc)
730#   else
731yystpcpy (yydest, yysrc)
732     char *yydest;
733     const char *yysrc;
734#   endif
735{
736  register char *yyd = yydest;
737  register const char *yys = yysrc;
738
739  while ((*yyd++ = *yys++) != '\0')
740    continue;
741
742  return yyd - 1;
743}
744#  endif
745# endif
746
747#endif /* !YYERROR_VERBOSE */
748
749
750
751#if YYDEBUG
752/*--------------------------------.
753| Print this symbol on YYOUTPUT.  |
754`--------------------------------*/
755
756#if defined (__STDC__) || defined (__cplusplus)
757static void
758yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
759#else
760static void
761yysymprint (yyoutput, yytype, yyvaluep)
762    FILE *yyoutput;
763    int yytype;
764    YYSTYPE *yyvaluep;
765#endif
766{
767  /* Pacify ``unused variable'' warnings.  */
768  (void) yyvaluep;
769
770  if (yytype < YYNTOKENS)
771    {
772      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
773# ifdef YYPRINT
774      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
775# endif
776    }
777  else
778    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
779
780  switch (yytype)
781    {
782      default:
783        break;
784    }
785  YYFPRINTF (yyoutput, ")");
786}
787
788#endif /* ! YYDEBUG */
789/*-----------------------------------------------.
790| Release the memory associated to this symbol.  |
791`-----------------------------------------------*/
792
793#if defined (__STDC__) || defined (__cplusplus)
794static void
795yydestruct (int yytype, YYSTYPE *yyvaluep)
796#else
797static void
798yydestruct (yytype, yyvaluep)
799    int yytype;
800    YYSTYPE *yyvaluep;
801#endif
802{
803  /* Pacify ``unused variable'' warnings.  */
804  (void) yyvaluep;
805
806  switch (yytype)
807    {
808
809      default:
810        break;
811    }
812}
813
814
815/* Prevent warnings from -Wmissing-prototypes.  */
816
817#ifdef YYPARSE_PARAM
818# if defined (__STDC__) || defined (__cplusplus)
819int yyparse (void *YYPARSE_PARAM);
820# else
821int yyparse ();
822# endif
823#else /* ! YYPARSE_PARAM */
824#if defined (__STDC__) || defined (__cplusplus)
825int yyparse (void);
826#else
827int yyparse ();
828#endif
829#endif /* ! YYPARSE_PARAM */
830
831
832
833/* The lookahead symbol.  */
834int yychar;
835
836/* The semantic value of the lookahead symbol.  */
837YYSTYPE yylval;
838
839/* Number of syntax errors so far.  */
840int yynerrs;
841
842
843
844/*----------.
845| yyparse.  |
846`----------*/
847
848#ifdef YYPARSE_PARAM
849# if defined (__STDC__) || defined (__cplusplus)
850int yyparse (void *YYPARSE_PARAM)
851# else
852int yyparse (YYPARSE_PARAM)
853  void *YYPARSE_PARAM;
854# endif
855#else /* ! YYPARSE_PARAM */
856#if defined (__STDC__) || defined (__cplusplus)
857int
858yyparse (void)
859#else
860int
861yyparse ()
862
863#endif
864#endif
865{
866 
867  register int yystate;
868  register int yyn;
869  int yyresult;
870  /* Number of tokens to shift before error messages enabled.  */
871  int yyerrstatus;
872  /* Lookahead token as an internal (translated) token number.  */
873  int yytoken = 0;
874
875  /* Three stacks and their tools:
876     `yyss': related to states,
877     `yyvs': related to semantic values,
878     `yyls': related to locations.
879
880     Refer to the stacks thru separate pointers, to allow yyoverflow
881     to reallocate them elsewhere.  */
882
883  /* The state stack.  */
884  short yyssa[YYINITDEPTH];
885  short *yyss = yyssa;
886  register short *yyssp;
887
888  /* The semantic value stack.  */
889  YYSTYPE yyvsa[YYINITDEPTH];
890  YYSTYPE *yyvs = yyvsa;
891  register YYSTYPE *yyvsp;
892
893
894
895#define YYPOPSTACK   (yyvsp--, yyssp--)
896
897  YYSIZE_T yystacksize = YYINITDEPTH;
898
899  /* The variables used to return semantic value and location from the
900     action routines.  */
901  YYSTYPE yyval;
902
903
904  /* When reducing, the number of symbols on the RHS of the reduced
905     rule.  */
906  int yylen;
907
908  YYDPRINTF ((stderr, "Starting parse\n"));
909
910  yystate = 0;
911  yyerrstatus = 0;
912  yynerrs = 0;
913  yychar = YYEMPTY;             /* Cause a token to be read.  */
914
915  /* Initialize stack pointers.
916     Waste one element of value and location stack
917     so that they stay on the same level as the state stack.
918     The wasted elements are never initialized.  */
919
920  yyssp = yyss;
921  yyvsp = yyvs;
922
923  goto yysetstate;
924
925/*------------------------------------------------------------.
926| yynewstate -- Push a new state, which is found in yystate.  |
927`------------------------------------------------------------*/
928 yynewstate:
929  /* In all cases, when you get here, the value and location stacks
930     have just been pushed. so pushing a state here evens the stacks.
931     */
932  yyssp++;
933
934 yysetstate:
935  *yyssp = yystate;
936
937  if (yyss + yystacksize - 1 <= yyssp)
938    {
939      /* Get the current used size of the three stacks, in elements.  */
940      YYSIZE_T yysize = yyssp - yyss + 1;
941
942#ifdef yyoverflow
943      {
944        /* Give user a chance to reallocate the stack. Use copies of
945           these so that the &'s don't force the real ones into
946           memory.  */
947        YYSTYPE *yyvs1 = yyvs;
948        short *yyss1 = yyss;
949
950
951        /* Each stack pointer address is followed by the size of the
952           data in use in that stack, in bytes.  This used to be a
953           conditional around just the two extra args, but that might
954           be undefined if yyoverflow is a macro.  */
955        yyoverflow ("parser stack overflow",
956                    &yyss1, yysize * sizeof (*yyssp),
957                    &yyvs1, yysize * sizeof (*yyvsp),
958
959                    &yystacksize);
960
961        yyss = yyss1;
962        yyvs = yyvs1;
963      }
964#else /* no yyoverflow */
965# ifndef YYSTACK_RELOCATE
966      goto yyoverflowlab;
967# else
968      /* Extend the stack our own way.  */
969      if (YYMAXDEPTH <= yystacksize)
970        goto yyoverflowlab;
971      yystacksize *= 2;
972      if (YYMAXDEPTH < yystacksize)
973        yystacksize = YYMAXDEPTH;
974
975      {
976        short *yyss1 = yyss;
977        union yyalloc *yyptr =
978          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
979        if (! yyptr)
980          goto yyoverflowlab;
981        YYSTACK_RELOCATE (yyss);
982        YYSTACK_RELOCATE (yyvs);
983
984#  undef YYSTACK_RELOCATE
985        if (yyss1 != yyssa)
986          YYSTACK_FREE (yyss1);
987      }
988# endif
989#endif /* no yyoverflow */
990
991      yyssp = yyss + yysize - 1;
992      yyvsp = yyvs + yysize - 1;
993
994
995      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
996                  (unsigned long int) yystacksize));
997
998      if (yyss + yystacksize - 1 <= yyssp)
999        YYABORT;
1000    }
1001
1002  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1003
1004  goto yybackup;
1005
1006/*-----------.
1007| yybackup.  |
1008`-----------*/
1009yybackup:
1010
1011/* Do appropriate processing given the current state.  */
1012/* Read a lookahead token if we need one and don't already have one.  */
1013/* yyresume: */
1014
1015  /* First try to decide what to do without reference to lookahead token.  */
1016
1017  yyn = yypact[yystate];
1018  if (yyn == YYPACT_NINF)
1019    goto yydefault;
1020
1021  /* Not known => get a lookahead token if don't already have one.  */
1022
1023  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1024  if (yychar == YYEMPTY)
1025    {
1026      YYDPRINTF ((stderr, "Reading a token: "));
1027      yychar = YYLEX;
1028    }
1029
1030  if (yychar <= YYEOF)
1031    {
1032      yychar = yytoken = YYEOF;
1033      YYDPRINTF ((stderr, "Now at end of input.\n"));
1034    }
1035  else
1036    {
1037      yytoken = YYTRANSLATE (yychar);
1038      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1039    }
1040
1041  /* If the proper action on seeing token YYTOKEN is to reduce or to
1042     detect an error, take that action.  */
1043  yyn += yytoken;
1044  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1045    goto yydefault;
1046  yyn = yytable[yyn];
1047  if (yyn <= 0)
1048    {
1049      if (yyn == 0 || yyn == YYTABLE_NINF)
1050        goto yyerrlab;
1051      yyn = -yyn;
1052      goto yyreduce;
1053    }
1054
1055  if (yyn == YYFINAL)
1056    YYACCEPT;
1057
1058  /* Shift the lookahead token.  */
1059  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1060
1061  /* Discard the token being shifted unless it is eof.  */
1062  if (yychar != YYEOF)
1063    yychar = YYEMPTY;
1064
1065  *++yyvsp = yylval;
1066
1067
1068  /* Count tokens shifted since error; after three, turn off error
1069     status.  */
1070  if (yyerrstatus)
1071    yyerrstatus--;
1072
1073  yystate = yyn;
1074  goto yynewstate;
1075
1076
1077/*-----------------------------------------------------------.
1078| yydefault -- do the default action for the current state.  |
1079`-----------------------------------------------------------*/
1080yydefault:
1081  yyn = yydefact[yystate];
1082  if (yyn == 0)
1083    goto yyerrlab;
1084  goto yyreduce;
1085
1086
1087/*-----------------------------.
1088| yyreduce -- Do a reduction.  |
1089`-----------------------------*/
1090yyreduce:
1091  /* yyn is the number of a rule to reduce with.  */
1092  yylen = yyr2[yyn];
1093
1094  /* If YYLEN is nonzero, implement the default value of the action:
1095     `$$ = $1'.
1096
1097     Otherwise, the following line sets YYVAL to garbage.
1098     This behavior is undocumented and Bison
1099     users should not rely upon it.  Assigning to YYVAL
1100     unconditionally makes the parser a bit smaller, and it avoids a
1101     GCC warning that YYVAL may be used uninitialized.  */
1102  yyval = yyvsp[1-yylen];
1103
1104
1105  YY_REDUCE_PRINT (yyn);
1106  switch (yyn)
1107    {
1108        case 2:
1109#line 73 "ps1.0_grammar.y"
1110    {
1111                DBG_MESG("dbg: WholeEnchilada", line_number);           
1112                ps10::invoke(yyvsp[-2].consts, yyvsp[-1].lines, yyvsp[0].lines);
1113        ;}
1114    break;
1115
1116  case 3:
1117#line 80 "ps1.0_grammar.y"
1118    {
1119                DBG_MESG("dbg: WholeEnchilada", line_number);           
1120                ps10::invoke(yyvsp[-2].consts, yyvsp[-1].lines, yyvsp[0].lines);
1121        ;}
1122    break;
1123
1124  case 4:
1125#line 87 "ps1.0_grammar.y"
1126    {
1127                DBG_MESG("dbg: WholeEnchilada", line_number);           
1128                ps10::invoke( 0, yyvsp[-1].lines, yyvsp[0].lines);
1129        ;}
1130    break;
1131
1132  case 5:
1133#line 94 "ps1.0_grammar.y"
1134    {
1135                DBG_MESG("dbg: WholeEnchilada", line_number);           
1136                ps10::invoke( 0, yyvsp[-1].lines, yyvsp[0].lines);
1137        ;}
1138    break;
1139
1140  case 6:
1141#line 101 "ps1.0_grammar.y"
1142    {
1143                DBG_MESG("dbg: WholeEnchilada", line_number);           
1144                ps10::invoke(yyvsp[-1].consts, 0, yyvsp[0].lines);
1145        ;}
1146    break;
1147
1148  case 7:
1149#line 108 "ps1.0_grammar.y"
1150    {
1151                DBG_MESG("dbg: WholeEnchilada", line_number);           
1152                ps10::invoke(yyvsp[-1].consts, 0, yyvsp[0].lines);
1153        ;}
1154    break;
1155
1156  case 8:
1157#line 115 "ps1.0_grammar.y"
1158    {
1159                DBG_MESG("dbg: WholeEnchilada", line_number);           
1160                ps10::invoke( 0, 0, yyvsp[0].lines);
1161        ;}
1162    break;
1163
1164  case 9:
1165#line 122 "ps1.0_grammar.y"
1166    {
1167                DBG_MESG("dbg: WholeEnchilada", line_number);           
1168                ps10::invoke( 0, 0, yyvsp[0].lines);
1169        ;}
1170    break;
1171
1172  case 10:
1173#line 132 "ps1.0_grammar.y"
1174    {
1175                yyval.consts = new vector<constdef>;
1176                yyval.consts->push_back(* yyvsp[0].cdef);
1177                delete yyvsp[0].cdef;
1178        ;}
1179    break;
1180
1181  case 11:
1182#line 140 "ps1.0_grammar.y"
1183    {
1184                yyval.consts = yyvsp[-1].consts;
1185                yyval.consts->push_back(* yyvsp[0].cdef);
1186                delete yyvsp[0].cdef;
1187        ;}
1188    break;
1189
1190  case 12:
1191#line 152 "ps1.0_grammar.y"
1192    {
1193                yyval.cdef = new constdef;
1194                yyval.cdef->reg = * yyvsp[-9].sval;
1195                yyval.cdef->r = yyvsp[-7].fval;
1196                yyval.cdef->g = yyvsp[-5].fval;
1197                yyval.cdef->b = yyvsp[-3].fval;
1198                yyval.cdef->a = yyvsp[-1].fval;
1199                delete yyvsp[-9].sval;
1200        ;}
1201    break;
1202
1203  case 13:
1204#line 166 "ps1.0_grammar.y"
1205    {
1206                yyval.lines = new list<vector<string> >;
1207                yyval.lines->push_back(* yyvsp[0].line);
1208                delete yyvsp[0].line;
1209        ;}
1210    break;
1211
1212  case 14:
1213#line 174 "ps1.0_grammar.y"
1214    {
1215                yyval.lines = yyvsp[-1].lines;
1216                yyval.lines->push_back(* yyvsp[0].line);
1217                delete yyvsp[0].line;
1218        ;}
1219    break;
1220
1221  case 15:
1222#line 185 "ps1.0_grammar.y"
1223    {
1224                yyval.line = new vector<string>;
1225                yyval.line->push_back(* yyvsp[-2].sval);
1226                yyval.line->push_back(* yyvsp[-1].sval);
1227                delete yyvsp[-2].sval;
1228                delete yyvsp[-1].sval;
1229        ;}
1230    break;
1231
1232  case 16:
1233#line 195 "ps1.0_grammar.y"
1234    {
1235                yyval.line = new vector<string>;
1236                yyval.line->push_back(* yyvsp[-4].sval);
1237                yyval.line->push_back(* yyvsp[-3].sval);
1238                yyval.line->push_back(* yyvsp[-1].sval);
1239                delete yyvsp[-4].sval;
1240                delete yyvsp[-3].sval;
1241                delete yyvsp[-1].sval;
1242        ;}
1243    break;
1244
1245  case 17:
1246#line 207 "ps1.0_grammar.y"
1247    {
1248                yyval.line = new vector<string>;
1249                yyval.line->push_back(* yyvsp[-6].sval);
1250                yyval.line->push_back(* yyvsp[-5].sval);
1251                yyval.line->push_back(* yyvsp[-3].sval);
1252                yyval.line->push_back(* yyvsp[-1].sval);
1253                delete yyvsp[-6].sval;
1254                delete yyvsp[-5].sval;
1255                delete yyvsp[-3].sval;
1256                delete yyvsp[-1].sval;
1257        ;}
1258    break;
1259
1260  case 18:
1261#line 224 "ps1.0_grammar.y"
1262    {
1263                yyval.lines = new list<vector<string> >;
1264                yyval.lines->push_back(* yyvsp[0].line);
1265                delete yyvsp[0].line;
1266        ;}
1267    break;
1268
1269  case 19:
1270#line 232 "ps1.0_grammar.y"
1271    {
1272                yyval.lines = yyvsp[-1].lines;
1273                yyval.lines->push_back(* yyvsp[0].line);
1274                delete yyvsp[0].line;
1275        ;}
1276    break;
1277
1278  case 20:
1279#line 244 "ps1.0_grammar.y"
1280    {
1281                yyval.line = new vector<string>;
1282        if ( yyvsp[-5].ival )
1283          yyval.line->push_back("+");
1284                yyval.line->push_back(* yyvsp[-4].sval);
1285                yyval.line->push_back(* yyvsp[-3].sval);
1286                yyval.line->push_back(* yyvsp[-1].sval);
1287                delete yyvsp[-4].sval;
1288                delete yyvsp[-3].sval;
1289                delete yyvsp[-1].sval;
1290        ;}
1291    break;
1292
1293  case 21:
1294#line 258 "ps1.0_grammar.y"
1295    {
1296                yyval.line = new vector<string>;
1297        if ( yyvsp[-7].ival )
1298          yyval.line->push_back("+");
1299                yyval.line->push_back(* yyvsp[-6].sval);
1300                yyval.line->push_back(* yyvsp[-5].sval);
1301                yyval.line->push_back(* yyvsp[-3].sval);
1302                yyval.line->push_back(* yyvsp[-1].sval);
1303                delete yyvsp[-6].sval;
1304                delete yyvsp[-5].sval;
1305                delete yyvsp[-3].sval;
1306                delete yyvsp[-1].sval;
1307        ;}
1308    break;
1309
1310  case 22:
1311#line 274 "ps1.0_grammar.y"
1312    {
1313                yyval.line = new vector<string>;
1314        if ( yyvsp[-9].ival )
1315          yyval.line->push_back("+");
1316                yyval.line->push_back(* yyvsp[-8].sval);
1317                yyval.line->push_back(* yyvsp[-7].sval);
1318                yyval.line->push_back(* yyvsp[-5].sval);
1319                yyval.line->push_back(* yyvsp[-3].sval);
1320                yyval.line->push_back(* yyvsp[-1].sval);
1321                delete yyvsp[-8].sval;
1322                delete yyvsp[-7].sval;
1323                delete yyvsp[-5].sval;
1324                delete yyvsp[-3].sval;
1325                delete yyvsp[-1].sval;
1326        ;}
1327    break;
1328
1329  case 23:
1330#line 293 "ps1.0_grammar.y"
1331    { yyval.ival=0; ;}
1332    break;
1333
1334  case 24:
1335#line 296 "ps1.0_grammar.y"
1336    { yyval.ival=1; ;}
1337    break;
1338
1339  case 25:
1340#line 302 "ps1.0_grammar.y"
1341    {;}
1342    break;
1343
1344  case 26:
1345#line 306 "ps1.0_grammar.y"
1346    {;}
1347    break;
1348
1349
1350    }
1351
1352/* Line 999 of yacc.c.  */
1353#line 1325 "_ps1.0_parser.c"
1354
1355  yyvsp -= yylen;
1356  yyssp -= yylen;
1357
1358
1359  YY_STACK_PRINT (yyss, yyssp);
1360
1361  *++yyvsp = yyval;
1362
1363
1364  /* Now `shift' the result of the reduction.  Determine what state
1365     that goes to, based on the state we popped back to and the rule
1366     number reduced by.  */
1367
1368  yyn = yyr1[yyn];
1369
1370  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1371  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1372    yystate = yytable[yystate];
1373  else
1374    yystate = yydefgoto[yyn - YYNTOKENS];
1375
1376  goto yynewstate;
1377
1378
1379/*------------------------------------.
1380| yyerrlab -- here on detecting error |
1381`------------------------------------*/
1382yyerrlab:
1383  /* If not already recovering from an error, report this error.  */
1384  if (!yyerrstatus)
1385    {
1386      ++yynerrs;
1387#if YYERROR_VERBOSE
1388      yyn = yypact[yystate];
1389
1390      if (YYPACT_NINF < yyn && yyn < YYLAST)
1391        {
1392          YYSIZE_T yysize = 0;
1393          int yytype = YYTRANSLATE (yychar);
1394          char *yymsg;
1395          int yyx, yycount;
1396
1397          yycount = 0;
1398          /* Start YYX at -YYN if negative to avoid negative indexes in
1399             YYCHECK.  */
1400          for (yyx = yyn < 0 ? -yyn : 0;
1401               yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1402            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1403              yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1404          yysize += yystrlen ("syntax error, unexpected ") + 1;
1405          yysize += yystrlen (yytname[yytype]);
1406          yymsg = (char *) YYSTACK_ALLOC (yysize);
1407          if (yymsg != 0)
1408            {
1409              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1410              yyp = yystpcpy (yyp, yytname[yytype]);
1411
1412              if (yycount < 5)
1413                {
1414                  yycount = 0;
1415                  for (yyx = yyn < 0 ? -yyn : 0;
1416                       yyx < (int) (sizeof (yytname) / sizeof (char *));
1417                       yyx++)
1418                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1419                      {
1420                        const char *yyq = ! yycount ? ", expecting " : " or ";
1421                        yyp = yystpcpy (yyp, yyq);
1422                        yyp = yystpcpy (yyp, yytname[yyx]);
1423                        yycount++;
1424                      }
1425                }
1426              yyerror (yymsg);
1427              YYSTACK_FREE (yymsg);
1428            }
1429          else
1430            yyerror ("syntax error; also virtual memory exhausted");
1431        }
1432      else
1433#endif /* YYERROR_VERBOSE */
1434        yyerror ("syntax error");
1435    }
1436
1437
1438
1439  if (yyerrstatus == 3)
1440    {
1441      /* If just tried and failed to reuse lookahead token after an
1442         error, discard it.  */
1443
1444      /* Return failure if at end of input.  */
1445      if (yychar == YYEOF)
1446        {
1447          /* Pop the error token.  */
1448          YYPOPSTACK;
1449          /* Pop the rest of the stack.  */
1450          while (yyss < yyssp)
1451            {
1452              YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1453              yydestruct (yystos[*yyssp], yyvsp);
1454              YYPOPSTACK;
1455            }
1456          YYABORT;
1457        }
1458
1459      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1460      yydestruct (yytoken, &yylval);
1461      yychar = YYEMPTY;
1462
1463    }
1464
1465  /* Else will try to reuse lookahead token after shifting the error
1466     token.  */
1467  goto yyerrlab1;
1468
1469
1470/*----------------------------------------------------.
1471| yyerrlab1 -- error raised explicitly by an action.  |
1472`----------------------------------------------------*/
1473yyerrlab1:
1474  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1475
1476  for (;;)
1477    {
1478      yyn = yypact[yystate];
1479      if (yyn != YYPACT_NINF)
1480        {
1481          yyn += YYTERROR;
1482          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1483            {
1484              yyn = yytable[yyn];
1485              if (0 < yyn)
1486                break;
1487            }
1488        }
1489
1490      /* Pop the current state because it cannot handle the error token.  */
1491      if (yyssp == yyss)
1492        YYABORT;
1493
1494      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1495      yydestruct (yystos[yystate], yyvsp);
1496      yyvsp--;
1497      yystate = *--yyssp;
1498
1499      YY_STACK_PRINT (yyss, yyssp);
1500    }
1501
1502  if (yyn == YYFINAL)
1503    YYACCEPT;
1504
1505  YYDPRINTF ((stderr, "Shifting error token, "));
1506
1507  *++yyvsp = yylval;
1508
1509
1510  yystate = yyn;
1511  goto yynewstate;
1512
1513
1514/*-------------------------------------.
1515| yyacceptlab -- YYACCEPT comes here.  |
1516`-------------------------------------*/
1517yyacceptlab:
1518  yyresult = 0;
1519  goto yyreturn;
1520
1521/*-----------------------------------.
1522| yyabortlab -- YYABORT comes here.  |
1523`-----------------------------------*/
1524yyabortlab:
1525  yyresult = 1;
1526  goto yyreturn;
1527
1528#ifndef yyoverflow
1529/*----------------------------------------------.
1530| yyoverflowlab -- parser overflow comes here.  |
1531`----------------------------------------------*/
1532yyoverflowlab:
1533  yyerror ("parser stack overflow");
1534  yyresult = 2;
1535  /* Fall through.  */
1536#endif
1537
1538yyreturn:
1539#ifndef yyoverflow
1540  if (yyss != yyssa)
1541    YYSTACK_FREE (yyss);
1542#endif
1543  return yyresult;
1544}
1545
1546
1547#line 309 "ps1.0_grammar.y"
1548
1549
1550void yyerror(char* s)
1551{
1552        errors.set("parser: syntax error", line_number);
1553}
1554
Note: See TracBrowser for help on using the repository browser.