cbf_stx.c

Go to the documentation of this file.
00001 
00002 /*  A Bison parser, made from ./src/cbf.stx
00003  by  GNU Bison version 1.25
00004   */
00005 
00006 #define YYBISON 1  /* Identify Bison output.  */
00007 
00008 #define DATA    258
00009 #define LOOP    259
00010 #define ITEM    260
00011 #define CATEGORY        261
00012 #define COLUMN  262
00013 #define STRING  263
00014 #define WORD    264
00015 #define BINARY  265
00016 #define UNKNOWN 266
00017 #define COMMENT 267
00018 #define ERROR   268
00019 
00020 #line 1 "./src/cbf.stx"
00021 
00022 
00023 /**********************************************************************
00024  * cbf.stx -- cbf parser                                              *
00025  *                                                                    *
00026  * Version 0.6 13 January 1999                                        *
00027  *                                                                    *
00028  *            Paul Ellis (ellis@ssrl.slac.stanford.edu) and           *
00029  *         Herbert J. Bernstein (yaya@bernstein-plus-sons.com)        *
00030  **********************************************************************/
00031   
00032 /**********************************************************************
00033  *                               NOTICE                               *
00034  * Creative endeavors depend on the lively exchange of ideas. There   *
00035  * are laws and customs which establish rights and responsibilities   *
00036  * for authors and the users of what authors create.  This notice     *
00037  * is not intended to prevent you from using the software and         *
00038  * documents in this package, but to ensure that there are no         *
00039  * misunderstandings about terms and conditions of such use.          *
00040  *                                                                    *
00041  * Please read the following notice carefully.  If you do not         *
00042  * understand any portion of this notice, please seek appropriate     *
00043  * professional legal advice before making use of the software and    *
00044  * documents included in this software package.  In addition to       *
00045  * whatever other steps you may be obliged to take to respect the     *
00046  * intellectual property rights of the various parties involved, if   *
00047  * you do make use of the software and documents in this package,     *
00048  * please give credit where credit is due by citing this package,     *
00049  * its authors and the URL or other source from which you obtained    *
00050  * it, or equivalent primary references in the literature with the    *
00051  * same authors.                                                      *
00052  *                                                                    *
00053  * Some of the software and documents included within this software   *
00054  * package are the intellectual property of various parties, and      *
00055  * placement in this package does not in any way imply that any       *
00056  * such rights have in any way been waived or diminished.             *
00057  *                                                                    *
00058  * With respect to any software or documents for which a copyright    *
00059  * exists, ALL RIGHTS ARE RESERVED TO THE OWNERS OF SUCH COPYRIGHT.   *
00060  *                                                                    *
00061  * Even though the authors of the various documents and software      *
00062  * found here have made a good faith effort to ensure that the        *
00063  * documents are correct and that the software performs according     *
00064  * to its documentation, and we would greatly appreciate hearing of   *
00065  * any problems you may encounter, the programs and documents any     *
00066  * files created by the programs are provided **AS IS** without any   *
00067  * warranty as to correctness, merchantability or fitness for any     *
00068  * particular or general use.                                         *
00069  *                                                                    *
00070  * THE RESPONSIBILITY FOR ANY ADVERSE CONSEQUENCES FROM THE USE OF    *
00071  * PROGRAMS OR DOCUMENTS OR ANY FILE OR FILES CREATED BY USE OF THE   *
00072  * PROGRAMS OR DOCUMENTS LIES SOLELY WITH THE USERS OF THE PROGRAMS   *
00073  * OR DOCUMENTS OR FILE OR FILES AND NOT WITH AUTHORS OF THE          *
00074  * PROGRAMS OR DOCUMENTS.                                             *
00075  **********************************************************************/
00076  
00077 /**********************************************************************
00078  *                          The IUCr Policy                           *
00079  *                                 on                                 *
00080  *     the Use of the Crystallographic Information File (CIF)         *
00081  *                                                                    *
00082  * The Crystallographic Information File (Hall, Allen & Brown,        *
00083  * 1991) is, as of January 1992, the recommended method for           *
00084  * submitting publications to Acta Crystallographica Section C. The   *
00085  * International Union of Crystallography holds the Copyright on      *
00086  * the CIF, and has applied for Patents on the STAR File syntax       *
00087  * which is the basis for the CIF format.                             *
00088  *                                                                    *
00089  * It is a principal objective of the IUCr to promote the use of      *
00090  * CIF for the exchange and storage of scientific data. The IUCr's    *
00091  * sponsorship of the CIF development was motivated by its            *
00092  * responsibility to its scientific journals, which set the           *
00093  * standards in crystallographic publishing. The IUCr intends that    *
00094  * CIFs will be used increasingly for electronic submission of        *
00095  * manuscripts to these journals in future. The IUCr recognises       *
00096  * that, if the CIF and the STAR File are to be adopted as a means    *
00097  * for universal data exchange, the syntax of these files must be     *
00098  * strictly and uniformly adhered to. Even small deviations from      *
00099  * the syntax would ultimately cause the demise of the universal      *
00100  * file concept. Through its Copyrights and Patents the IUCr has      *
00101  * taken the steps needed to ensure strict conformance with this      *
00102  * syntax.                                                            *
00103  *                                                                    *
00104  * The IUCr policy on the use of the CIF and STAR File processes is   *
00105  * as follows:                                                        *
00106  * _________________________________________________________________  *
00107  *                                                                    *
00108  *  * 1 CIFs and STAR Files may be generated, stored or transmitted,  *
00109  *    without permission or charge, provided their purpose is not     *
00110  *    specifically for profit or commercial gain, and provided that   *
00111  *    the published syntax is strictly adhered to.                    *
00112  *  * 2 Computer software may be developed for use with CIFs or STAR  *
00113  *    files, without permission or charge, provided it is distributed *
00114  *    in the public domain. This condition also applies to software   *
00115  *    for which a charge is made, provided that its primary function  *
00116  *    is for use with files that satisfy condition 1 and that it is   *
00117  *    distributed as a minor component of a larger package of         *
00118  *    software.                                                       *
00119  *  * 3 Permission will be granted for the use of CIFs and STAR Files *
00120  *    for specific commercial purposes (such as databases or network  *
00121  *    exchange processes), and for the distribution of commercial     *
00122  *    CIF/STAR software, on written application to the IUCr Executive *
00123  *    Secretary, 2 Abbey Square, Chester CH1 2HU, England. The        *
00124  *    nature, terms and duration of the licences granted will be      *
00125  *    determined by the IUCr Executive and Finance Committees.        *
00126  *                                                                    *
00127  * _________________________________________________________________  *
00128  *                                                                    *
00129  * In summary, the IUCr wishes to promote the use of the STAR File    *
00130  * concepts as a standard universal data file. It will insist on      *
00131  * strict compliance with the published syntax for all                *
00132  * applications. To assist with this compliance, the IUCr provides    *
00133  * public domain software for checking the logical integrity of a     *
00134  * CIF, and for validating the data name definitions contained        *
00135  * within a CIF. Detailed information on this software, and the       *
00136  * associated dictionaries, may be obtained from the IUCr Office at   *
00137  * 5 Abbey Square, Chester CH1 2HU, England.                          *
00138  **********************************************************************/
00139 
00140 #ifdef __cplusplus
00141 
00142 extern "C" {
00143 
00144 #endif
00145 
00146 #include <stdio.h>
00147 #include <stdlib.h>
00148 #include <string.h>
00149 
00150 #include "cbf.h"
00151 #include "cbf_tree.h"
00152 
00153 #define yyparse       cbf_parse
00154 #define yylex         cbf_lex_wrapper
00155 #define yyerror       cbf_syntax_error
00156 #define YYLEX_PARAM   context
00157 #define YYPARSE_PARAM context
00158 
00159 #define alloca(x) (NULL)
00160 
00161 #define YYINITDEPTH 200
00162 #define YYMAXDEPTH  200
00163 
00164 int cbf_lex (void *, void *);
00165 
00166 int cbf_lex_wrapper (void *val, void *context)
00167 {
00168   int token;
00169 
00170   do
00171 
00172     token = cbf_lex (val, ((void **) context) [0]);
00173 
00174   while (token == COMMENT);
00175 
00176   return token;
00177 }
00178 
00179 int cbf_syntax_error (const char *message)
00180 {
00181   return 0;
00182 }
00183 
00184 
00185 #line 166 "./src/cbf.stx"
00186 typedef union
00187 {
00188   int          errorcode;
00189   const char  *text;
00190   cbf_node    *node;
00191 } YYSTYPE;
00192 #include <stdio.h>
00193 
00194 #ifndef __cplusplus
00195 #ifndef __STDC__
00196 #define const
00197 #endif
00198 #endif
00199 
00200 
00201 
00202 #define YYFINAL         34
00203 #define YYFLAG          -32768
00204 #define YYNTBASE        14
00205 
00206 #define YYTRANSLATE(x) ((unsigned)(x) <= 268 ? yytranslate[x] : 31)
00207 
00208 static const char yytranslate[] = {     0,
00209      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00210      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00211      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00212      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00213      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00214      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00215      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00216      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00217      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00218      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00219      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00220      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00221      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00222      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00223      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00224      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00225      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00226      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00227      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00228      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00229      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00230      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00231      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00232      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00233      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00234      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
00235      6,     7,     8,     9,    10,    11,    12,    13
00236 };
00237 
00238 #if YYDEBUG != 0
00239 static const short yyprhs[] = {     0,
00240      0,     2,     3,     5,     8,    10,    12,    14,    17,    20,
00241     23,    26,    29,    32,    35,    38,    41,    44,    47,    50,
00242     52,    54,    56,    58,    60,    62,    64
00243 };
00244 
00245 static const short yyrhs[] = {    17,
00246      0,     0,    15,     0,    14,    26,     0,    16,     0,    20,
00247      0,    24,     0,    17,    27,     0,    18,    28,     0,    17,
00248     29,     0,    19,    30,     0,    17,    25,     0,    21,    27,
00249      0,    23,    27,     0,    21,    29,     0,    23,    29,     0,
00250     22,    28,     0,    23,    30,     0,    24,    30,     0,     4,
00251      0,     3,     0,     6,     0,     7,     0,     5,     0,     8,
00252      0,     9,     0,    10,     0
00253 };
00254 
00255 #endif
00256 
00257 #if YYDEBUG != 0
00258 static const short yyrline[] = { 0,
00259    208,   213,   218,   221,   226,   229,   232,   237,   242,   245,
00260    252,   259,   266,   273,   284,   295,   308,   319,   326,   335,
00261    338,   343,   348,   353,   358,   361,   364
00262 };
00263 #endif
00264 
00265 
00266 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
00267 
00268 static const char * const yytname[] = {   "$","error","$undefined.","DATA","LOOP",
00269 "ITEM","CATEGORY","COLUMN","STRING","WORD","BINARY","UNKNOWN","COMMENT","ERROR",
00270 "cbf","cbfstart","datablockstart","datablock","category","column","assignment",
00271 "loopstart","loopcategory","loopcolumn","loopassignment","loop","datablockname",
00272 "categoryname","columnname","itemname","value", NULL
00273 };
00274 #endif
00275 
00276 static const short yyr1[] = {     0,
00277     14,    15,    16,    16,    17,    17,    17,    18,    19,    19,
00278     20,    21,    22,    22,    23,    23,    23,    24,    24,    25,
00279     26,    27,    28,    29,    30,    30,    30
00280 };
00281 
00282 static const short yyr2[] = {     0,
00283      1,     0,     1,     2,     1,     1,     1,     2,     2,     2,
00284      2,     2,     2,     2,     2,     2,     2,     2,     2,     1,
00285      1,     1,     1,     1,     1,     1,     1
00286 };
00287 
00288 static const short yydefact[] = {     2,
00289      0,     3,     5,     1,     0,     0,     6,     0,     0,     0,
00290      7,    21,     4,    20,    24,    22,    12,     8,    10,    23,
00291      9,    25,    26,    27,    11,    13,    15,    17,    14,    16,
00292     18,    19,     0,     0
00293 };
00294 
00295 static const short yydefgoto[] = {     1,
00296      2,     3,     4,     5,     6,     7,     8,     9,    10,    11,
00297     17,    13,    18,    21,    19,    25
00298 };
00299 
00300 static const short yypact[] = {-32768,
00301      6,-32768,-32768,     7,    13,     8,-32768,     9,    13,    -5,
00302      8,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00303 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00304 -32768,-32768,     2,-32768
00305 };
00306 
00307 static const short yypgoto[] = {-32768,
00308 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00309 -32768,-32768,     0,    -2,    11,    12
00310 };
00311 
00312 
00313 #define YYLAST          23
00314 
00315 
00316 static const short yytable[] = {    15,
00317     16,    34,    22,    23,    24,    33,    28,    26,    12,    29,
00318     14,    15,    16,    15,    16,    22,    23,    24,    27,    20,
00319     30,    31,    32
00320 };
00321 
00322 static const short yycheck[] = {     5,
00323      6,     0,     8,     9,    10,     0,     9,     8,     3,    10,
00324      4,     5,     6,     5,     6,     8,     9,    10,     8,     7,
00325     10,    10,    11
00326 };
00327 #define YYPURE 1
00328 
00329 /***********************************************************************
00330  * cbf_PARSER.simple                                                   *
00331  * made from the _output_ of a bsion run against a grammar by          *
00332  * Herbert J. Bernstein, yaya@bernstein-plus-sons.com, 10 August 1998  *
00333  *                                                                     *
00334  * This file is used as a replacement for /usr/lib/bison.simple        *
00335  * if it is necessary to rebuild cbf.stx.tab.c                         *
00336  *                                                                     *
00337  * Under the terms of the "special exception", below, we may use       * 
00338  * the file from which this file was made "without restriction".       *
00339  * We have made only one signficant change to the original file        *
00340  * changing the __GNUC__ declaration of yyparse to be                  *
00341  *                                                                     *
00342  *  #ifdef YYPARSE_PARAM                                               *
00343  *  int yyparse (void *YYPARSE_PARAM);                                 *
00344  *  #else                                                              *
00345  *  int yyparse (void);                                                *
00346  *  #endif                                                             *
00347  *                                                                     *
00348  * and suppressed the "#line" declarations                             *
00349  *                                                                     *
00350  * Please treat this file as being subject to the same conditions      *
00351  * as the original bison.simple.  However, inclusion of this file      *
00352  * with other software purely for the purpose of providing a           *
00353  * replacement for bison.simple does not bring that other software     *
00354  * within the reach of the GNU General Public License.                 *
00355  ***********************************************************************/
00356  
00357 
00358 /* Skeleton output parser for bison,
00359    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
00360 
00361    This program is free software; you can redistribute it and/or modify
00362    it under the terms of the GNU General Public License as published by
00363    the Free Software Foundation; either version 2, or (at your option)
00364    any later version.
00365 
00366    This program is distributed in the hope that it will be useful,
00367    but WITHOUT ANY WARRANTY; without even the implied warranty of
00368    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00369    GNU General Public License for more details.
00370 
00371    You should have received a copy of the GNU General Public License
00372    along with this program; if not, write to the Free Software
00373    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
00374 
00375 /* As a special exception, when this file is copied by Bison into a
00376    Bison output file, you may use that output file without restriction.
00377    This special exception was added by the Free Software Foundation
00378    in version 1.24 of Bison.  */
00379 
00380 #ifndef alloca
00381 #ifdef __GNUC__
00382 #define alloca __builtin_alloca
00383 #else /* not GNU C.  */
00384 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
00385 #include <alloca.h>
00386 #else /* not sparc */
00387 #if defined (MSDOS) && !defined (__TURBOC__)
00388 #include <malloc.h>
00389 #else /* not MSDOS, or __TURBOC__ */
00390 #if defined(_AIX)
00391 #include <malloc.h>
00392  #pragma alloca
00393 #else /* not MSDOS, __TURBOC__, or _AIX */
00394 #ifdef __hpux
00395 #ifdef __cplusplus
00396 extern "C" {
00397 void *alloca (unsigned int);
00398 };
00399 #else /* not __cplusplus */
00400 void *alloca ();
00401 #endif /* not __cplusplus */
00402 #endif /* __hpux */
00403 #endif /* not _AIX */
00404 #endif /* not MSDOS, or __TURBOC__ */
00405 #endif /* not sparc.  */
00406 #endif /* not GNU C.  */
00407 #endif /* alloca not defined.  */
00408 
00409 /* This is the parser code that is written into each bison parser
00410   when the %semantic_parser declaration is not specified in the grammar.
00411   It was written by Richard Stallman by simplifying the hairy parser
00412   used when %semantic_parser is specified.  */
00413 
00414 /* Note: there must be only one dollar sign in this file.
00415    It is replaced by the list of actions, each action
00416    as one case of the switch.  */
00417 
00418 #define yyerrok         (yyerrstatus = 0)
00419 #define yyclearin       (yychar = YYEMPTY)
00420 #define YYEMPTY         -2
00421 #define YYEOF           0
00422 #define YYACCEPT        return(0)
00423 #define YYABORT         return(1)
00424 #define YYERROR         goto yyerrlab1
00425 /* Like YYERROR except do call yyerror.
00426    This remains here temporarily to ease the
00427    transition to the new meaning of YYERROR, for GCC.
00428    Once GCC version 2 has supplanted version 1, this can go.  */
00429 #define YYFAIL          goto yyerrlab
00430 #define YYRECOVERING()  (!!yyerrstatus)
00431 #define YYBACKUP(token, value) \
00432 do                                                              \
00433   if (yychar == YYEMPTY && yylen == 1)                          \
00434     { yychar = (token), yylval = (value);                       \
00435       yychar1 = YYTRANSLATE (yychar);                           \
00436       YYPOPSTACK;                                               \
00437       goto yybackup;                                            \
00438     }                                                           \
00439   else                                                          \
00440     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
00441 while (0)
00442 
00443 #define YYTERROR        1
00444 #define YYERRCODE       256
00445 
00446 #ifndef YYPURE
00447 #define YYLEX           yylex()
00448 #endif
00449 
00450 #ifdef YYPURE
00451 #ifdef YYLSP_NEEDED
00452 #ifdef YYLEX_PARAM
00453 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
00454 #else
00455 #define YYLEX           yylex(&yylval, &yylloc)
00456 #endif
00457 #else /* not YYLSP_NEEDED */
00458 #ifdef YYLEX_PARAM
00459 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
00460 #else
00461 #define YYLEX           yylex(&yylval)
00462 #endif
00463 #endif /* not YYLSP_NEEDED */
00464 #endif
00465 
00466 /* If nonreentrant, generate the variables here */
00467 
00468 #ifndef YYPURE
00469 
00470 int     yychar;                 /*  the lookahead symbol                */
00471 YYSTYPE yylval;                 /*  the semantic value of the           */
00472                                 /*  lookahead symbol                    */
00473 
00474 #ifdef YYLSP_NEEDED
00475 YYLTYPE yylloc;                 /*  location data for the lookahead     */
00476                                 /*  symbol                              */
00477 #endif
00478 
00479 int yynerrs;                    /*  number of parse errors so far       */
00480 #endif  /* not YYPURE */
00481 
00482 #if YYDEBUG != 0
00483 int yydebug;                    /*  nonzero means print parse trace     */
00484 /* Since this is uninitialized, it does not stop multiple parsers
00485    from coexisting.  */
00486 #endif
00487 
00488 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
00489 
00490 #ifndef YYINITDEPTH
00491 #define YYINITDEPTH 200
00492 #endif
00493 
00494 /*  YYMAXDEPTH is the maximum size the stacks can grow to
00495     (effective only if the built-in stack extension method is used).  */
00496 
00497 #if YYMAXDEPTH == 0
00498 #undef YYMAXDEPTH
00499 #endif
00500 
00501 #ifndef YYMAXDEPTH
00502 #define YYMAXDEPTH 10000
00503 #endif
00504 
00505 /* Prevent warning if -Wstrict-prototypes.  */
00506 #ifdef __GNUC__
00507 #ifdef YYPARSE_PARAM
00508 int yyparse (void *YYPARSE_PARAM);
00509 #else
00510 int yyparse (void);
00511 #endif
00512 #endif
00513 
00514 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
00515 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
00516 #else                           /* not GNU C or C++ */
00517 #ifndef __cplusplus
00518 
00519 /* This is the most reliable way to avoid incompatibilities
00520    in available built-in functions on various systems.  */
00521 static void
00522 __yy_memcpy (to, from, count)
00523      char *to;
00524      char *from;
00525      int count;
00526 {
00527   register char *f = from;
00528   register char *t = to;
00529   register int i = count;
00530 
00531   while (i-- > 0)
00532     *t++ = *f++;
00533 }
00534 
00535 #else /* __cplusplus */
00536 
00537 /* This is the most reliable way to avoid incompatibilities
00538    in available built-in functions on various systems.  */
00539 static void
00540 __yy_memcpy (char *to, char *from, int count)
00541 {
00542   register char *f = from;
00543   register char *t = to;
00544   register int i = count;
00545 
00546   while (i-- > 0)
00547     *t++ = *f++;
00548 }
00549 
00550 #endif
00551 #endif
00552 
00553 
00554 
00555 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
00556    into yyparse.  The argument should have type void *.
00557    It should actually point to an object.
00558    Grammar actions can access the variable by casting it
00559    to the proper pointer type.  */
00560 
00561 #ifdef YYPARSE_PARAM
00562 #ifdef __cplusplus
00563 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
00564 #define YYPARSE_PARAM_DECL
00565 #else /* not __cplusplus */
00566 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
00567 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
00568 #endif /* not __cplusplus */
00569 #else /* not YYPARSE_PARAM */
00570 #define YYPARSE_PARAM_ARG
00571 #define YYPARSE_PARAM_DECL
00572 #endif /* not YYPARSE_PARAM */
00573 
00574 int
00575 yyparse(YYPARSE_PARAM_ARG)
00576      YYPARSE_PARAM_DECL
00577 {
00578   register int yystate;
00579   register int yyn;
00580   register short *yyssp;
00581   register YYSTYPE *yyvsp;
00582   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
00583   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
00584 
00585   short yyssa[YYINITDEPTH];     /*  the state stack                     */
00586   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
00587 
00588   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
00589   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
00590 
00591 #ifdef YYLSP_NEEDED
00592   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
00593   YYLTYPE *yyls = yylsa;
00594   YYLTYPE *yylsp;
00595 
00596 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
00597 #else
00598 #define YYPOPSTACK   (yyvsp--, yyssp--)
00599 #endif
00600 
00601   int yystacksize = YYINITDEPTH;
00602 
00603 #ifdef YYPURE
00604   int yychar;
00605   YYSTYPE yylval;
00606   int yynerrs;
00607 #ifdef YYLSP_NEEDED
00608   YYLTYPE yylloc;
00609 #endif
00610 #endif
00611 
00612   YYSTYPE yyval;                /*  the variable used to return         */
00613                                 /*  semantic values from the action     */
00614                                 /*  routines                            */
00615 
00616   int yylen;
00617 
00618 #if YYDEBUG != 0
00619   if (yydebug)
00620     fprintf(stderr, "Starting parse\n");
00621 #endif
00622 
00623   yystate = 0;
00624   yyerrstatus = 0;
00625   yynerrs = 0;
00626   yychar = YYEMPTY;             /* Cause a token to be read.  */
00627 
00628   /* Initialize stack pointers.
00629      Waste one element of value and location stack
00630      so that they stay on the same level as the state stack.
00631      The wasted elements are never initialized.  */
00632 
00633   yyssp = yyss - 1;
00634   yyvsp = yyvs;
00635 #ifdef YYLSP_NEEDED
00636   yylsp = yyls;
00637 #endif
00638 
00639 /* Push a new state, which is found in  yystate  .  */
00640 /* In all cases, when you get here, the value and location stacks
00641    have just been pushed. so pushing a state here evens the stacks.  */
00642 yynewstate:
00643 
00644   *++yyssp = yystate;
00645 
00646   if (yyssp >= yyss + yystacksize - 1)
00647     {
00648       /* Give user a chance to reallocate the stack */
00649       /* Use copies of these so that the &'s don't force the real ones into memory. */
00650       YYSTYPE *yyvs1 = yyvs;
00651       short *yyss1 = yyss;
00652 #ifdef YYLSP_NEEDED
00653       YYLTYPE *yyls1 = yyls;
00654 #endif
00655 
00656       /* Get the current used size of the three stacks, in elements.  */
00657       int size = yyssp - yyss + 1;
00658 
00659 #ifdef yyoverflow
00660       /* Each stack pointer address is followed by the size of
00661          the data in use in that stack, in bytes.  */
00662 #ifdef YYLSP_NEEDED
00663       /* This used to be a conditional around just the two extra args,
00664          but that might be undefined if yyoverflow is a macro.  */
00665       yyoverflow("parser stack overflow",
00666                  &yyss1, size * sizeof (*yyssp),
00667                  &yyvs1, size * sizeof (*yyvsp),
00668                  &yyls1, size * sizeof (*yylsp),
00669                  &yystacksize);
00670 #else
00671       yyoverflow("parser stack overflow",
00672                  &yyss1, size * sizeof (*yyssp),
00673                  &yyvs1, size * sizeof (*yyvsp),
00674                  &yystacksize);
00675 #endif
00676 
00677       yyss = yyss1; yyvs = yyvs1;
00678 #ifdef YYLSP_NEEDED
00679       yyls = yyls1;
00680 #endif
00681 #else /* no yyoverflow */
00682       /* Extend the stack our own way.  */
00683       if (yystacksize >= YYMAXDEPTH)
00684         {
00685           yyerror("parser stack overflow");
00686           return 2;
00687         }
00688       yystacksize *= 2;
00689       if (yystacksize > YYMAXDEPTH)
00690         yystacksize = YYMAXDEPTH;
00691       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
00692       __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
00693       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
00694       __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
00695 #ifdef YYLSP_NEEDED
00696       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
00697       __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
00698 #endif
00699 #endif /* no yyoverflow */
00700 
00701       yyssp = yyss + size - 1;
00702       yyvsp = yyvs + size - 1;
00703 #ifdef YYLSP_NEEDED
00704       yylsp = yyls + size - 1;
00705 #endif
00706 
00707 #if YYDEBUG != 0
00708       if (yydebug)
00709         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
00710 #endif
00711 
00712       if (yyssp >= yyss + yystacksize - 1)
00713         YYABORT;
00714     }
00715 
00716 #if YYDEBUG != 0
00717   if (yydebug)
00718     fprintf(stderr, "Entering state %d\n", yystate);
00719 #endif
00720 
00721   goto yybackup;
00722  yybackup:
00723 
00724 /* Do appropriate processing given the current state.  */
00725 /* Read a lookahead token if we need one and don't already have one.  */
00726 /* yyresume: */
00727 
00728   /* First try to decide what to do without reference to lookahead token.  */
00729 
00730   yyn = yypact[yystate];
00731   if (yyn == YYFLAG)
00732     goto yydefault;
00733 
00734   /* Not known => get a lookahead token if don't already have one.  */
00735 
00736   /* yychar is either YYEMPTY or YYEOF
00737      or a valid token in external form.  */
00738 
00739   if (yychar == YYEMPTY)
00740     {
00741 #if YYDEBUG != 0
00742       if (yydebug)
00743         fprintf(stderr, "Reading a token: ");
00744 #endif
00745       yychar = YYLEX;
00746     }
00747 
00748   /* Convert token to internal form (in yychar1) for indexing tables with */
00749 
00750   if (yychar <= 0)              /* This means end of input. */
00751     {
00752       yychar1 = 0;
00753       yychar = YYEOF;           /* Don't call YYLEX any more */
00754 
00755 #if YYDEBUG != 0
00756       if (yydebug)
00757         fprintf(stderr, "Now at end of input.\n");
00758 #endif
00759     }
00760   else
00761     {
00762       yychar1 = YYTRANSLATE(yychar);
00763 
00764 #if YYDEBUG != 0
00765       if (yydebug)
00766         {
00767           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
00768           /* Give the individual parser a way to print the precise meaning
00769              of a token, for further debugging info.  */
00770 #ifdef YYPRINT
00771           YYPRINT (stderr, yychar, yylval);
00772 #endif
00773           fprintf (stderr, ")\n");
00774         }
00775 #endif
00776     }
00777 
00778   yyn += yychar1;
00779   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00780     goto yydefault;
00781 
00782   yyn = yytable[yyn];
00783 
00784   /* yyn is what to do for this token type in this state.
00785      Negative => reduce, -yyn is rule number.
00786      Positive => shift, yyn is new state.
00787        New state is final state => don't bother to shift,
00788        just return success.
00789      0, or most negative number => error.  */
00790 
00791   if (yyn < 0)
00792     {
00793       if (yyn == YYFLAG)
00794         goto yyerrlab;
00795       yyn = -yyn;
00796       goto yyreduce;
00797     }
00798   else if (yyn == 0)
00799     goto yyerrlab;
00800 
00801   if (yyn == YYFINAL)
00802     YYACCEPT;
00803 
00804   /* Shift the lookahead token.  */
00805 
00806 #if YYDEBUG != 0
00807   if (yydebug)
00808     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
00809 #endif
00810 
00811   /* Discard the token being shifted unless it is eof.  */
00812   if (yychar != YYEOF)
00813     yychar = YYEMPTY;
00814 
00815   *++yyvsp = yylval;
00816 #ifdef YYLSP_NEEDED
00817   *++yylsp = yylloc;
00818 #endif
00819 
00820   /* count tokens shifted since error; after three, turn off error status.  */
00821   if (yyerrstatus) yyerrstatus--;
00822 
00823   yystate = yyn;
00824   goto yynewstate;
00825 
00826 /* Do the default action for the current state.  */
00827 yydefault:
00828 
00829   yyn = yydefact[yystate];
00830   if (yyn == 0)
00831     goto yyerrlab;
00832 
00833 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
00834 yyreduce:
00835   yylen = yyr2[yyn];
00836   if (yylen > 0)
00837     yyval = yyvsp[1-yylen]; /* implement default value of the action */
00838 
00839 #if YYDEBUG != 0
00840   if (yydebug)
00841     {
00842       int i;
00843 
00844       fprintf (stderr, "Reducing via rule %d (line %d), ",
00845                yyn, yyrline[yyn]);
00846 
00847       /* Print the symbols being reduced, and their result.  */
00848       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
00849         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
00850       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
00851     }
00852 #endif
00853 
00854 
00855 
00856   switch (yyn) {
00857 
00858 case 1:
00859 {
00860                                                   cbf_failnez (cbf_find_parent (&(yyval.node), yyvsp[0].node, CBF_ROOT))
00861                                                 ;
00862     break;}
00863 case 2:
00864 {
00865                                                   yyval.node = ((void **) context) [1];
00866                                                 ;
00867     break;}
00868 case 3:
00869 {
00870                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyvsp[0].node, CBF_DATABLOCK, NULL))
00871                                                 ;
00872     break;}
00873 case 4:
00874 {
00875                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyvsp[-1].node, CBF_DATABLOCK, yyvsp[0].text))
00876                                                 ;
00877     break;}
00878 case 5:
00879 {
00880                                                   yyval.node = yyvsp[0].node;
00881                                                 ;
00882     break;}
00883 case 6:
00884 {
00885                                                   cbf_failnez (cbf_find_parent (&(yyval.node), yyvsp[0].node, CBF_DATABLOCK))
00886                                                 ;
00887     break;}
00888 case 7:
00889 {
00890                                                   cbf_failnez (cbf_find_parent (&(yyval.node), yyvsp[0].node, CBF_DATABLOCK))
00891                                                 ;
00892     break;}
00893 case 8:
00894 {
00895                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyvsp[-1].node, CBF_CATEGORY, yyvsp[0].text))
00896                                                 ;
00897     break;}
00898 case 9:
00899 {
00900                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyvsp[-1].node, CBF_COLUMN, yyvsp[0].text))
00901                                                 ;
00902     break;}
00903 case 10:
00904 {
00905                                                   cbf_failnez (cbf_make_new_child (&(yyval.node), yyvsp[-1].node, CBF_CATEGORY, NULL))
00906                                                   
00907                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyval.node, CBF_COLUMN, yyvsp[0].text))
00908                                                 ;
00909     break;}
00910 case 11:
00911 {
00912                                                   yyval.node = yyvsp[-1].node;
00913 
00914                                                   cbf_failnez (cbf_set_columnrow (yyval.node, 0, yyvsp[0].text, 1))
00915                                                 ;
00916     break;}
00917 case 12:
00918 {
00919                                                   cbf_failnez (cbf_make_node (&(yyval.node), CBF_LINK, NULL, NULL))
00920 
00921                                                   cbf_failnez (cbf_set_link (yyval.node, yyvsp[-1].node))
00922                                                 ;
00923     break;}
00924 case 13:
00925 {
00926                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyvsp[-1].node, CBF_CATEGORY, yyvsp[0].text))
00927 
00928                                                   cbf_failnez (cbf_set_link (yyvsp[-1].node, yyval.node))
00929 
00930                                                   yyval.node = yyvsp[-1].node;
00931                                                 ;
00932     break;}
00933 case 14:
00934 {
00935                                                   cbf_failnez (cbf_find_parent (&(yyval.node), yyvsp[-1].node, CBF_DATABLOCK))
00936 
00937                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyval.node, CBF_CATEGORY, yyvsp[0].text))
00938 
00939                                                   cbf_failnez (cbf_set_link (yyvsp[-1].node, yyval.node))
00940 
00941                                                   yyval.node = yyvsp[-1].node;
00942                                                 ;
00943     break;}
00944 case 15:
00945 {
00946                                                   cbf_failnez (cbf_make_new_child (&(yyval.node), yyvsp[-1].node, CBF_CATEGORY, NULL))
00947                                                   
00948                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyval.node, CBF_COLUMN, yyvsp[0].text))
00949 
00950                                                   cbf_failnez (cbf_set_link (yyvsp[-1].node, yyval.node))
00951 
00952                                                   cbf_failnez (cbf_add_link (yyvsp[-1].node, yyval.node))
00953 
00954                                                   yyval.node = yyvsp[-1].node;
00955                                                 ;
00956     break;}
00957 case 16:
00958 {
00959                                                   cbf_failnez (cbf_find_parent (&(yyval.node), yyvsp[-1].node, CBF_DATABLOCK))
00960 
00961                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyval.node, CBF_CATEGORY, NULL))
00962                                                   
00963                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyval.node, CBF_COLUMN, yyvsp[0].text))
00964 
00965                                                   cbf_failnez (cbf_set_link (yyvsp[-1].node, yyval.node))
00966 
00967                                                   cbf_failnez (cbf_add_link (yyvsp[-1].node, yyval.node))
00968 
00969                                                   yyval.node = yyvsp[-1].node;
00970                                                 ;
00971     break;}
00972 case 17:
00973 {
00974                                                   cbf_failnez (cbf_make_child (&(yyval.node), yyvsp[-1].node, CBF_COLUMN, yyvsp[0].text))
00975 
00976                                                   cbf_failnez (cbf_set_link (yyvsp[-1].node, yyval.node))
00977 
00978                                                   cbf_failnez (cbf_add_link (yyvsp[-1].node, yyval.node))
00979 
00980                                                   yyval.node = yyvsp[-1].node;
00981                                                 ;
00982     break;}
00983 case 18:
00984 {
00985                                                   yyval.node = yyvsp[-1].node;
00986 
00987                                                   cbf_failnez (cbf_shift_link (yyval.node))
00988 
00989                                                   cbf_failnez (cbf_add_columnrow (yyval.node, yyvsp[0].text))
00990                                                 ;
00991     break;}
00992 case 19:
00993 {
00994                                                   yyval.node = yyvsp[-1].node;
00995 
00996                                                   cbf_failnez (cbf_shift_link (yyval.node))
00997 
00998                                                   cbf_failnez (cbf_add_columnrow (yyval.node, yyvsp[0].text))
00999                                                 ;
01000     break;}
01001 case 21:
01002 {
01003                                                   yyval.text = yyvsp[0].text;
01004                                                 ;
01005     break;}
01006 case 22:
01007 {
01008                                                   yyval.text = yyvsp[0].text;
01009                                                 ;
01010     break;}
01011 case 23:
01012 {
01013                                                   yyval.text = yyvsp[0].text;
01014                                                 ;
01015     break;}
01016 case 24:
01017 {
01018                                                   yyval.text = yyvsp[0].text;
01019                                                 ;
01020     break;}
01021 case 25:
01022 {
01023                                                   yyval.text = yyvsp[0].text;
01024                                                 ;
01025     break;}
01026 case 26:
01027 {
01028                                                   yyval.text = yyvsp[0].text;
01029                                                 ;
01030     break;}
01031 case 27:
01032 {
01033                                                   yyval.text = yyvsp[0].text;
01034                                                 ;
01035     break;}
01036 }
01037    /* the action file gets copied in in place of this dollarsign */
01038 
01039 
01040   yyvsp -= yylen;
01041   yyssp -= yylen;
01042 #ifdef YYLSP_NEEDED
01043   yylsp -= yylen;
01044 #endif
01045 
01046 #if YYDEBUG != 0
01047   if (yydebug)
01048     {
01049       short *ssp1 = yyss - 1;
01050       fprintf (stderr, "state stack now");
01051       while (ssp1 != yyssp)
01052         fprintf (stderr, " %d", *++ssp1);
01053       fprintf (stderr, "\n");
01054     }
01055 #endif
01056 
01057   *++yyvsp = yyval;
01058 
01059 #ifdef YYLSP_NEEDED
01060   yylsp++;
01061   if (yylen == 0)
01062     {
01063       yylsp->first_line = yylloc.first_line;
01064       yylsp->first_column = yylloc.first_column;
01065       yylsp->last_line = (yylsp-1)->last_line;
01066       yylsp->last_column = (yylsp-1)->last_column;
01067       yylsp->text = 0;
01068     }
01069   else
01070     {
01071       yylsp->last_line = (yylsp+yylen-1)->last_line;
01072       yylsp->last_column = (yylsp+yylen-1)->last_column;
01073     }
01074 #endif
01075 
01076   /* Now "shift" the result of the reduction.
01077      Determine what state that goes to,
01078      based on the state we popped back to
01079      and the rule number reduced by.  */
01080 
01081   yyn = yyr1[yyn];
01082 
01083   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01084   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01085     yystate = yytable[yystate];
01086   else
01087     yystate = yydefgoto[yyn - YYNTBASE];
01088 
01089   goto yynewstate;
01090 
01091 yyerrlab:   /* here on detecting error */
01092 
01093   if (! yyerrstatus)
01094     /* If not already recovering from an error, report this error.  */
01095     {
01096       ++yynerrs;
01097 
01098 #ifdef YYERROR_VERBOSE
01099       yyn = yypact[yystate];
01100 
01101       if (yyn > YYFLAG && yyn < YYLAST)
01102         {
01103           int size = 0;
01104           char *msg;
01105           int x, count;
01106 
01107           count = 0;
01108           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
01109           for (x = (yyn < 0 ? -yyn : 0);
01110                x < (sizeof(yytname) / sizeof(char *)); x++)
01111             if (yycheck[x + yyn] == x)
01112               size += strlen(yytname[x]) + 15, count++;
01113           msg = (char *) malloc(size + 15);
01114           if (msg != 0)
01115             {
01116               strcpy(msg, "parse error");
01117 
01118               if (count < 5)
01119                 {
01120                   count = 0;
01121                   for (x = (yyn < 0 ? -yyn : 0);
01122                        x < (sizeof(yytname) / sizeof(char *)); x++)
01123                     if (yycheck[x + yyn] == x)
01124                       {
01125                         strcat(msg, count == 0 ? ", expecting `" : " or `");
01126                         strcat(msg, yytname[x]);
01127                         strcat(msg, "'");
01128                         count++;
01129                       }
01130                 }
01131               yyerror(msg);
01132               free(msg);
01133             }
01134           else
01135             yyerror ("parse error; also virtual memory exceeded");
01136         }
01137       else
01138 #endif /* YYERROR_VERBOSE */
01139         yyerror("parse error");
01140     }
01141 
01142   goto yyerrlab1;
01143 yyerrlab1:   /* here on error raised explicitly by an action */
01144 
01145   if (yyerrstatus == 3)
01146     {
01147       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
01148 
01149       /* return failure if at end of input */
01150       if (yychar == YYEOF)
01151         YYABORT;
01152 
01153 #if YYDEBUG != 0
01154       if (yydebug)
01155         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
01156 #endif
01157 
01158       yychar = YYEMPTY;
01159     }
01160 
01161   /* Else will try to reuse lookahead token
01162      after shifting the error token.  */
01163 
01164   yyerrstatus = 3;              /* Each real token shifted decrements this */
01165 
01166   goto yyerrhandle;
01167 
01168 yyerrdefault:  /* current state does not do anything special for the error token. */
01169 
01170 #if 0
01171   /* This is wrong; only states that explicitly want error tokens
01172      should shift them.  */
01173   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
01174   if (yyn) goto yydefault;
01175 #endif
01176 
01177 yyerrpop:   /* pop the current state because it cannot handle the error token */
01178 
01179   if (yyssp == yyss) YYABORT;
01180   yyvsp--;
01181   yystate = *--yyssp;
01182 #ifdef YYLSP_NEEDED
01183   yylsp--;
01184 #endif
01185 
01186 #if YYDEBUG != 0
01187   if (yydebug)
01188     {
01189       short *ssp1 = yyss - 1;
01190       fprintf (stderr, "Error: state stack now");
01191       while (ssp1 != yyssp)
01192         fprintf (stderr, " %d", *++ssp1);
01193       fprintf (stderr, "\n");
01194     }
01195 #endif
01196 
01197 yyerrhandle:
01198 
01199   yyn = yypact[yystate];
01200   if (yyn == YYFLAG)
01201     goto yyerrdefault;
01202 
01203   yyn += YYTERROR;
01204   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01205     goto yyerrdefault;
01206 
01207   yyn = yytable[yyn];
01208   if (yyn < 0)
01209     {
01210       if (yyn == YYFLAG)
01211         goto yyerrpop;
01212       yyn = -yyn;
01213       goto yyreduce;
01214     }
01215   else if (yyn == 0)
01216     goto yyerrpop;
01217 
01218   if (yyn == YYFINAL)
01219     YYACCEPT;
01220 
01221 #if YYDEBUG != 0
01222   if (yydebug)
01223     fprintf(stderr, "Shifting error token, ");
01224 #endif
01225 
01226   *++yyvsp = yylval;
01227 #ifdef YYLSP_NEEDED
01228   *++yylsp = yylloc;
01229 #endif
01230 
01231   yystate = yyn;
01232   goto yynewstate;
01233 }
01234 
01235 
01236 
01237 #ifdef __cplusplus
01238 
01239 }
01240 
01241 #endif