source: OGRE/trunk/ogrenew/RenderSystems/GL/src/nvparse/_ps1.0_parser.cpp @ 692

Revision 692, 40.3 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

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