• Main Page
  • Data Structures
  • Files

sl_gram.c

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.3.  */
00002 
00003 /* Skeleton implementation for Bison's Yacc-like parsers in C
00004 
00005    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00006    Free Software Foundation, Inc.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2, or (at your option)
00011    any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.  */
00022 
00023 /* As a special exception, you may create a larger work that contains
00024    part or all of the Bison parser skeleton and distribute that work
00025    under terms of your choice, so long as that work isn't itself a
00026    parser generator using the skeleton or a modified version thereof
00027    as a parser skeleton.  Alternatively, if you modify or redistribute
00028    the parser skeleton itself, you may (at your option) remove this
00029    special exception, which will cause the skeleton and the resulting
00030    Bison output files to be licensed under the GNU General Public
00031    License without this special exception.
00032 
00033    This special exception was added by the Free Software Foundation in
00034    version 2.2 of Bison.  */
00035 
00036 /* C LALR(1) parser skeleton written by Richard Stallman, by
00037    simplifying the original so-called "semantic" parser.  */
00038 
00039 /* All symbols defined below should begin with slx_ or SL_, to avoid
00040    infringing on user name space.  This should be done even for local
00041    variables, as they might otherwise be expanded by user macros.
00042    There are some unavoidable exceptions within include files to
00043    define necessary library symbols; they are noted "INFRINGES ON
00044    USER NAME SPACE" below.  */
00045 
00046 /* Identify Bison output.  */
00047 #define SL_BISON 1
00048 
00049 /* Bison version.  */
00050 #define SL_BISON_VERSION "2.3"
00051 
00052 /* Skeleton name.  */
00053 #define SL_SKELETON_NAME "yacc.c"
00054 
00055 /* Pure parsers.  */
00056 #define SL_PURE 0
00057 
00058 /* Using locations.  */
00059 #define SL_LSP_NEEDED 0
00060 
00061 
00062 
00063 /* Tokens.  */
00064 #ifndef SL_TOKENTYPE
00065 # define SL_TOKENTYPE
00066    /* Put the tokens into the symbol table, so that GDB and other debuggers
00067       know about them.  */
00068    enum slx_tokentype {
00069      ACCFERM = 1,
00070      ACCOUVR = 2,
00071      CONSTANTE = 3,
00072      EGAL = 4,
00073      IDENT = 5,
00074      INF = 6,
00075      INFEGAL = 7,
00076      MOINS = 8,
00077      PLUS = 9,
00078      SUP = 10,
00079      SUPEGAL = 11,
00080      VAR = 12,
00081      VIRG = 13
00082    };
00083 #endif
00084 /* Tokens.  */
00085 #define ACCFERM 1
00086 #define ACCOUVR 2
00087 #define CONSTANTE 3
00088 #define EGAL 4
00089 #define IDENT 5
00090 #define INF 6
00091 #define INFEGAL 7
00092 #define MOINS 8
00093 #define PLUS 9
00094 #define SUP 10
00095 #define SUPEGAL 11
00096 #define VAR 12
00097 #define VIRG 13
00098 
00099 
00100 
00101 
00102 /* Copy the first part of user declarations.  */
00103 #line 7 "sl_gram.y"
00104 
00105 
00106 #include <stdio.h>
00107 #include <stdlib.h>
00108 #include <string.h>
00109 
00110 #include "boolean.h"
00111 #include "arithmetique.h"
00112 #include "vecteur.h"
00113 #include "contrainte.h"
00114 #include "sc.h"
00115 #include "malloc.h"
00116 #include "union.h"
00117 
00118 
00119 extern char slx_text[]; /* dialogue avec l'analyseur lexical */
00120 Psysteme ps_yacc;
00121 boolean syntax_error;
00122 Value valcst;
00123 Value fac;        /* facteur multiplicatif suivant qu'on analyse un terme*/
00124                       /* introduit par un moins (-1) ou par un plus (1) */
00125 int sens;             /* indique le sens de l'inegalite
00126                          sens = -1  ==> l'operateur est soit > ,soit >=,
00127                          sens = 1   ==> l'operateur est soit <, soit <=   */
00128 short int cote;       /* booleen indiquant quel membre est en cours d'analyse*/
00129 Value b1, b2;      /* element du vecteur colonne du systeme donne 
00130           par l'analyse d'une contrainte */
00131 Pcontrainte eq;       /* pointeur sur l'egalite ou l'inegalite courante */
00132 Pvecteur cp ;         /* pointeur sur le membre courant */ 
00133 short int operat;     /* dernier operateur rencontre */
00134 
00135 extern   Pcontrainte p_eg_fin;
00136 extern   Pcontrainte p_ineg_fin;
00137 extern   Pvecteur p_pred;
00138 extern   Pvecteur p_membre_courant;
00139 extern   Pvecteur cp;
00140 Psyslist sl_yacc; Pbase ba_yacc; Variable va_yacc; 
00141 
00142 /*code des operateurs de comparaison */
00143 #define OPINF 1
00144 #define OPINFEGAL 2
00145 #define OPEGAL 3
00146 #define OPSUPEGAL 4
00147 #define OPSUP 5
00148 #define DROIT 1
00149 #define GAUCHE 2
00150 /* #define NULL 0 */
00151 
00152 
00153 
00154 /* Enabling traces.  */
00155 #ifndef SL_DEBUG
00156 # define SL_DEBUG 0
00157 #endif
00158 
00159 /* Enabling verbose error messages.  */
00160 #ifdef SL_ERROR_VERBOSE
00161 # undef SL_ERROR_VERBOSE
00162 # define SL_ERROR_VERBOSE 1
00163 #else
00164 # define SL_ERROR_VERBOSE 0
00165 #endif
00166 
00167 /* Enabling the token table.  */
00168 #ifndef SL_TOKEN_TABLE
00169 # define SL_TOKEN_TABLE 0
00170 #endif
00171 
00172 #if ! defined SL_STYPE && ! defined SL_STYPE_IS_DECLARED
00173 typedef union SL_STYPE
00174 #line 74 "sl_gram.y"
00175 {
00176     Value Value;
00177     Variable Variable;
00178 }
00179 /* Line 187 of yacc.c.  */
00180 #line 181 "y.tab.c"
00181         SL_STYPE;
00182 # define slx_stype SL_STYPE /* obsolescent; will be withdrawn */
00183 # define SL_STYPE_IS_DECLARED 1
00184 # define SL_STYPE_IS_TRIVIAL 1
00185 #endif
00186 
00187 
00188 
00189 /* Copy the second part of user declarations.  */
00190 
00191 
00192 /* Line 216 of yacc.c.  */
00193 #line 194 "y.tab.c"
00194 
00195 #ifdef short
00196 # undef short
00197 #endif
00198 
00199 #ifdef SL_TYPE_UINT8
00200 typedef SL_TYPE_UINT8 slx_type_uint8;
00201 #else
00202 typedef unsigned char slx_type_uint8;
00203 #endif
00204 
00205 #ifdef SL_TYPE_INT8
00206 typedef SL_TYPE_INT8 slx_type_int8;
00207 #elif (defined __STDC__ || defined __C99__FUNC__ \
00208      || defined __cplusplus || defined _MSC_VER)
00209 typedef signed char slx_type_int8;
00210 #else
00211 typedef short int slx_type_int8;
00212 #endif
00213 
00214 #ifdef SL_TYPE_UINT16
00215 typedef SL_TYPE_UINT16 slx_type_uint16;
00216 #else
00217 typedef unsigned short int slx_type_uint16;
00218 #endif
00219 
00220 #ifdef SL_TYPE_INT16
00221 typedef SL_TYPE_INT16 slx_type_int16;
00222 #else
00223 typedef short int slx_type_int16;
00224 #endif
00225 
00226 #ifndef SL_SIZE_T
00227 # ifdef __SIZE_TYPE__
00228 #  define SL_SIZE_T __SIZE_TYPE__
00229 # elif defined size_t
00230 #  define SL_SIZE_T size_t
00231 # elif ! defined SL_SIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00232      || defined __cplusplus || defined _MSC_VER)
00233 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00234 #  define SL_SIZE_T size_t
00235 # else
00236 #  define SL_SIZE_T unsigned int
00237 # endif
00238 #endif
00239 
00240 #define SL_SIZE_MAXIMUM ((SL_SIZE_T) -1)
00241 
00242 #ifndef SL__
00243 # if SL_ENABLE_NLS
00244 #  if ENABLE_NLS
00245 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00246 #   define SL__(msgid) dgettext ("bison-runtime", msgid)
00247 #  endif
00248 # endif
00249 # ifndef SL__
00250 #  define SL__(msgid) msgid
00251 # endif
00252 #endif
00253 
00254 /* Suppress unused-variable warnings by "using" E.  */
00255 #if ! defined lint || defined __GNUC__
00256 # define SL_USE(e) ((void) (e))
00257 #else
00258 # define SL_USE(e) /* empty */
00259 #endif
00260 
00261 /* Identity function, used to suppress warnings about constant conditions.  */
00262 #ifndef lint
00263 # define SL_ID(n) (n)
00264 #else
00265 #if (defined __STDC__ || defined __C99__FUNC__ \
00266      || defined __cplusplus || defined _MSC_VER)
00267 static int
00268 SL_ID (int i)
00269 #else
00270 static int
00271 SL_ID (i)
00272     int i;
00273 #endif
00274 {
00275   return i;
00276 }
00277 #endif
00278 
00279 #if ! defined slx_overflow || SL_ERROR_VERBOSE
00280 
00281 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00282 
00283 # ifdef SL_STACK_USE_ALLOCA
00284 #  if SL_STACK_USE_ALLOCA
00285 #   ifdef __GNUC__
00286 #    define SL_STACK_ALLOC __builtin_alloca
00287 #   elif defined __BUILTIN_VA_ARG_INCR
00288 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00289 #   elif defined _AIX
00290 #    define SL_STACK_ALLOC __alloca
00291 #   elif defined _MSC_VER
00292 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00293 #    define alloca _alloca
00294 #   else
00295 #    define SL_STACK_ALLOC alloca
00296 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00297      || defined __cplusplus || defined _MSC_VER)
00298 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00299 #     ifndef _STDLIB_H
00300 #      define _STDLIB_H 1
00301 #     endif
00302 #    endif
00303 #   endif
00304 #  endif
00305 # endif
00306 
00307 # ifdef SL_STACK_ALLOC
00308    /* Pacify GCC's `empty if-body' warning.  */
00309 #  define SL_STACK_FREE(Ptr) do { /* empty */; } while (SL_ID (0))
00310 #  ifndef SL_STACK_ALLOC_MAXIMUM
00311     /* The OS might guarantee only one guard page at the bottom of the stack,
00312        and a page size can be as small as 4096 bytes.  So we cannot safely
00313        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00314        to allow for a few compiler-allocated temporary stack slots.  */
00315 #   define SL_STACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00316 #  endif
00317 # else
00318 #  define SL_STACK_ALLOC SL_MALLOC
00319 #  define SL_STACK_FREE SL_FREE
00320 #  ifndef SL_STACK_ALLOC_MAXIMUM
00321 #   define SL_STACK_ALLOC_MAXIMUM SL_SIZE_MAXIMUM
00322 #  endif
00323 #  if (defined __cplusplus && ! defined _STDLIB_H \
00324        && ! ((defined SL_MALLOC || defined malloc) \
00325              && (defined SL_FREE || defined free)))
00326 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00327 #   ifndef _STDLIB_H
00328 #    define _STDLIB_H 1
00329 #   endif
00330 #  endif
00331 #  ifndef SL_MALLOC
00332 #   define SL_MALLOC malloc
00333 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00334      || defined __cplusplus || defined _MSC_VER)
00335 void *malloc (SL_SIZE_T); /* INFRINGES ON USER NAME SPACE */
00336 #   endif
00337 #  endif
00338 #  ifndef SL_FREE
00339 #   define SL_FREE free
00340 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00341      || defined __cplusplus || defined _MSC_VER)
00342 void free (void *); /* INFRINGES ON USER NAME SPACE */
00343 #   endif
00344 #  endif
00345 # endif
00346 #endif /* ! defined slx_overflow || SL_ERROR_VERBOSE */
00347 
00348 
00349 #if (! defined slx_overflow \
00350      && (! defined __cplusplus \
00351          || (defined SL_STYPE_IS_TRIVIAL && SL_STYPE_IS_TRIVIAL)))
00352 
00353 /* A type that is properly aligned for any stack member.  */
00354 union slx_alloc
00355 {
00356   slx_type_int16 slx_ss;
00357   SL_STYPE slx_vs;
00358   };
00359 
00360 /* The size of the maximum gap between one aligned stack and the next.  */
00361 # define SL_STACK_GAP_MAXIMUM (sizeof (union slx_alloc) - 1)
00362 
00363 /* The size of an array large to enough to hold all stacks, each with
00364    N elements.  */
00365 # define SL_STACK_BYTES(N) \
00366      ((N) * (sizeof (slx_type_int16) + sizeof (SL_STYPE)) \
00367       + SL_STACK_GAP_MAXIMUM)
00368 
00369 /* Copy COUNT objects from FROM to TO.  The source and destination do
00370    not overlap.  */
00371 # ifndef SL_COPY
00372 #  if defined __GNUC__ && 1 < __GNUC__
00373 #   define SL_COPY(To, From, Count) \
00374       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00375 #  else
00376 #   define SL_COPY(To, From, Count)             \
00377       do                                        \
00378         {                                       \
00379           SL_SIZE_T slx_i;                              \
00380           for (slx_i = 0; slx_i < (Count); slx_i++)     \
00381             (To)[slx_i] = (From)[slx_i];                \
00382         }                                       \
00383       while (SL_ID (0))
00384 #  endif
00385 # endif
00386 
00387 /* Relocate STACK from its old location to the new one.  The
00388    local variables SL_SIZE and SL_STACKSIZE give the old and new number of
00389    elements in the stack, and SL_PTR gives the new location of the
00390    stack.  Advance SL_PTR to a properly aligned location for the next
00391    stack.  */
00392 # define SL_STACK_RELOCATE(Stack)                                       \
00393     do                                                                  \
00394       {                                                                 \
00395         SL_SIZE_T slx_newbytes;                                         \
00396         SL_COPY (&slx_ptr->Stack, Stack, slx_size);                             \
00397         Stack = &slx_ptr->Stack;                                                \
00398         slx_newbytes = slx_stacksize * sizeof (*Stack) + SL_STACK_GAP_MAXIMUM; \
00399         slx_ptr += slx_newbytes / sizeof (*slx_ptr);                            \
00400       }                                                                 \
00401     while (SL_ID (0))
00402 
00403 #endif
00404 
00405 /* SL_FINAL -- State number of the termination state.  */
00406 #define SL_FINAL  3
00407 /* SL_LAST -- Last index in SL_TABLE.  */
00408 #define SL_LAST   31
00409 
00410 /* SL_NTOKENS -- Number of terminals.  */
00411 #define SL_NTOKENS  16
00412 /* SL_NNTS -- Number of nonterminals.  */
00413 #define SL_NNTS  25
00414 /* SL_NRULES -- Number of rules.  */
00415 #define SL_NRULES  40
00416 /* SL_NRULES -- Number of states.  */
00417 #define SL_NSTATES  49
00418 
00419 /* SL_TRANSLATE(SL_LEX) -- Bison symbol number corresponding to SL_LEX.  */
00420 #define SL_UNDEFTOK  2
00421 #define SL_MAXUTOK   257
00422 
00423 #define SL_TRANSLATE(SL_X)                                              \
00424   ((unsigned int) (SL_X) <= SL_MAXUTOK ? slx_translate[SL_X] : SL_UNDEFTOK)
00425 
00426 /* SL_TRANSLATE[SL_LEX] -- Bison symbol number corresponding to SL_LEX.  */
00427 static const slx_type_uint8 slx_translate[] =
00428 {
00429        0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
00430       12,    13,    14,    15,     2,     2,     2,     2,     2,     2,
00431        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00432        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00433        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00434        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00435        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00436        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00437        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00438        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00439        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00440        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00441        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00442        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00443        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00444        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00445        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00446        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00447        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00448        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00449        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00450        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00451        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00452        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00453        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00454        2,     2,     2,     2,     2,     2,     1,     2
00455 };
00456 
00457 #if SL_DEBUG
00458 /* SL_PRHS[SL_N] -- Index of the first RHS symbol of rule number SL_N in
00459    SL_RHS.  */
00460 static const slx_type_uint8 slx_prhs[] =
00461 {
00462        0,     0,     3,     8,     9,    10,    13,    15,    19,    21,
00463       23,    26,    33,    34,    35,    37,    41,    42,    49,    50,
00464       51,    54,    55,    58,    62,    65,    67,    69,    71,    73,
00465       75,    77,    79,    81,    83,    85,    87,    89,    94,    95,
00466       97
00467 };
00468 
00469 /* SL_RHS -- A `-1'-separated list of the rules' RHS.  */
00470 static const slx_type_int8 slx_rhs[] =
00471 {
00472       17,     0,    -1,    18,    20,    23,    19,    -1,    -1,    -1,
00473       14,    21,    -1,    22,    -1,    21,    15,    22,    -1,     7,
00474       -1,    24,    -1,    24,    23,    -1,    25,     4,    27,    40,
00475        3,    26,    -1,    -1,    -1,    28,    -1,    27,    15,    28,
00476       -1,    -1,    29,    38,    36,    31,    39,    30,    -1,    -1,
00477       -1,    37,    33,    -1,    -1,    32,    33,    -1,    31,    37,
00478       33,    -1,    35,    34,    -1,    35,    -1,    34,    -1,     7,
00479       -1,     5,    -1,     8,    -1,     9,    -1,     6,    -1,    12,
00480       -1,    13,    -1,    11,    -1,    10,    -1,    31,    -1,    38,
00481       36,    31,    39,    -1,    -1,    15,    -1,    -1
00482 };
00483 
00484 /* SL_RLINE[SL_N] -- source line where rule number SL_N was defined.  */
00485 static const slx_type_uint16 slx_rline[] =
00486 {
00487        0,    82,    82,    86,    93,    98,   101,   102,   105,   112,
00488      113,   116,   120,   128,   139,   140,   141,   144,   148,   161,
00489      166,   167,   167,   168,   171,   183,   195,   206,   221,   227,
00490      235,   243,   251,   259,   268,   270,   274,   275,   279,   307,
00491      308
00492 };
00493 #endif
00494 
00495 #if SL_DEBUG || SL_ERROR_VERBOSE || SL_TOKEN_TABLE
00496 /* SL_TNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00497    First, the terminals, then, starting at SL_NTOKENS, nonterminals.  */
00498 static const char *const slx_tname[] =
00499 {
00500   "$end", "error", "$undefined", "ACCFERM", "ACCOUVR", "CONSTANTE",
00501   "EGAL", "IDENT", "INF", "INFEGAL", "MOINS", "PLUS", "SUP", "SUPEGAL",
00502   "VAR", "VIRG", "$accept", "s_list", "inisl", "endsl", "defvar", "l_var",
00503   "newid", "l_sys", "system", "inisys", "endsys", "l_eq", "eq", "debeq",
00504   "feq", "membre", "@1", "terme", "ident", "const", "op", "addop",
00505   "multi_membre", "fin_mult_membre", "virg_opt", 0
00506 };
00507 #endif
00508 
00509 # ifdef SL_PRINT
00510 /* SL_TOKNUM[SL_LEX-NUM] -- Internal token number corresponding to
00511    token SL_LEX-NUM.  */
00512 static const slx_type_uint16 slx_toknum[] =
00513 {
00514        0,   256,   257,     1,     2,     3,     4,     5,     6,     7,
00515        8,     9,    10,    11,    12,    13
00516 };
00517 # endif
00518 
00519 /* SL_R1[SL_N] -- Symbol number of symbol that rule SL_N derives.  */
00520 static const slx_type_uint8 slx_r1[] =
00521 {
00522        0,    16,    17,    18,    19,    20,    21,    21,    22,    23,
00523       23,    24,    25,    26,    27,    27,    27,    28,    29,    30,
00524       31,    32,    31,    31,    33,    33,    33,    34,    35,    36,
00525       36,    36,    36,    36,    37,    37,    38,    38,    39,    40,
00526       40
00527 };
00528 
00529 /* SL_R2[SL_N] -- Number of symbols composing right hand side of rule SL_N.  */
00530 static const slx_type_uint8 slx_r2[] =
00531 {
00532        0,     2,     4,     0,     0,     2,     1,     3,     1,     1,
00533        2,     6,     0,     0,     1,     3,     0,     6,     0,     0,
00534        2,     0,     2,     3,     2,     1,     1,     1,     1,     1,
00535        1,     1,     1,     1,     1,     1,     1,     4,     0,     1,
00536        0
00537 };
00538 
00539 /* SL_DEFACT[STATE-NAME] -- Default rule to reduce with in state
00540    STATE-NUM when SL_TABLE doesn't specify something else to do.  Zero
00541    means the default is an error.  */
00542 static const slx_type_uint8 slx_defact[] =
00543 {
00544        3,     0,     0,     1,     0,    12,     8,     5,     6,     4,
00545        9,     0,     0,     2,    10,    18,     7,    40,    14,    21,
00546       18,     0,    35,    34,    36,     0,     0,     0,    15,    13,
00547        0,    28,    27,    22,    26,    25,    20,    31,    29,    30,
00548       32,    33,    21,    11,    23,    24,    38,    37,    17
00549 };
00550 
00551 /* SL_DEFGOTO[NTERM-NUM].  */
00552 static const slx_type_int8 slx_defgoto[] =
00553 {
00554       -1,     1,     2,    13,     5,     7,     8,     9,    10,    11,
00555       43,    17,    18,    19,    48,    24,    25,    33,    34,    35,
00556       42,    26,    27,    47,    21
00557 };
00558 
00559 /* SL_PACT[STATE-NUM] -- Index in SL_TABLE of the portion describing
00560    STATE-NUM.  */
00561 #define SL_PACT_NINF -25
00562 static const slx_type_int8 slx_pact[] =
00563 {
00564      -25,     7,     2,   -25,    11,   -25,   -25,     4,   -25,   -25,
00565       16,    17,    11,   -25,   -25,    -2,   -25,     8,   -25,     1,
00566       21,    22,   -25,   -25,     1,    10,    10,    -3,   -25,   -25,
00567       10,   -25,   -25,   -25,   -25,    19,   -25,   -25,   -25,   -25,
00568      -25,   -25,     1,   -25,   -25,   -25,     1,    -1,   -25
00569 };
00570 
00571 /* SL_PGOTO[NTERM-NUM].  */
00572 static const slx_type_int8 slx_pgoto[] =
00573 {
00574      -25,   -25,   -25,   -25,   -25,   -25,    15,    18,   -25,   -25,
00575      -25,   -25,     9,   -25,   -25,   -12,   -25,   -22,    -4,   -25,
00576      -25,   -24,   -25,   -25,   -25
00577 };
00578 
00579 /* SL_TABLE[SL_PACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00580    positive, shift that token.  If negative, reduce the rule which
00581    number is the opposite.  If zero, do what SL_DEFACT says.
00582    If SL_TABLE_NINF, syntax error.  */
00583 #define SL_TABLE_NINF -40
00584 static const slx_type_int8 slx_table[] =
00585 {
00586       30,   -16,   -19,    37,    36,    38,    39,     3,    44,    40,
00587       41,    22,    23,   -16,   -19,    31,     4,    32,     6,    12,
00588      -12,    15,    30,    20,   -39,    29,    32,    16,    14,    28,
00589       46,    45
00590 };
00591 
00592 static const slx_type_uint8 slx_check[] =
00593 {
00594       24,     3,     3,     6,    26,     8,     9,     0,    30,    12,
00595       13,    10,    11,    15,    15,     5,    14,     7,     7,    15,
00596        4,     4,    46,    15,     3,     3,     7,    12,    10,    20,
00597       42,    35
00598 };
00599 
00600 /* SL_STOS[STATE-NUM] -- The (internal number of the) accessing
00601    symbol of state STATE-NUM.  */
00602 static const slx_type_uint8 slx_stos[] =
00603 {
00604        0,    17,    18,     0,    14,    20,     7,    21,    22,    23,
00605       24,    25,    15,    19,    23,     4,    22,    27,    28,    29,
00606       15,    40,    10,    11,    31,    32,    37,    38,    28,     3,
00607       37,     5,     7,    33,    34,    35,    33,     6,     8,     9,
00608       12,    13,    36,    26,    33,    34,    31,    39,    30
00609 };
00610 
00611 #define slx_errok               (slx_errstatus = 0)
00612 #define slx_clearin     (slx_char = SL_EMPTY)
00613 #define SL_EMPTY                (-2)
00614 #define SL_EOF          0
00615 
00616 #define SL_ACCEPT       goto slx_acceptlab
00617 #define SL_ABORT                goto slx_abortlab
00618 #define SL_ERROR                goto slx_errorlab
00619 
00620 
00621 /* Like SL_ERROR except do call slx_error.  This remains here temporarily
00622    to ease the transition to the new meaning of SL_ERROR, for GCC.
00623    Once GCC version 2 has supplanted version 1, this can go.  */
00624 
00625 #define SL_FAIL         goto slx_errlab
00626 
00627 #define SL_RECOVERING()  (!!slx_errstatus)
00628 
00629 #define SL_BACKUP(Token, Value)                                 \
00630 do                                                              \
00631   if (slx_char == SL_EMPTY && slx_len == 1)                             \
00632     {                                                           \
00633       slx_char = (Token);                                               \
00634       slx_lval = (Value);                                               \
00635       slx_token = SL_TRANSLATE (slx_char);                              \
00636       SL_POPSTACK (1);                                          \
00637       goto slx_backup;                                          \
00638     }                                                           \
00639   else                                                          \
00640     {                                                           \
00641       slx_error (SL__("syntax error: cannot back up")); \
00642       SL_ERROR;                                                 \
00643     }                                                           \
00644 while (SL_ID (0))
00645 
00646 
00647 #define SL_TERROR       1
00648 #define SL_ERRCODE      256
00649 
00650 
00651 /* SL_LLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00652    If N is 0, then set CURRENT to the empty location which ends
00653    the previous symbol: RHS[0] (always defined).  */
00654 
00655 #define SL_RHSLOC(Rhs, K) ((Rhs)[K])
00656 #ifndef SL_LLOC_DEFAULT
00657 # define SL_LLOC_DEFAULT(Current, Rhs, N)                               \
00658     do                                                                  \
00659       if (SL_ID (N))                                                    \
00660         {                                                               \
00661           (Current).first_line   = SL_RHSLOC (Rhs, 1).first_line;       \
00662           (Current).first_column = SL_RHSLOC (Rhs, 1).first_column;     \
00663           (Current).last_line    = SL_RHSLOC (Rhs, N).last_line;                \
00664           (Current).last_column  = SL_RHSLOC (Rhs, N).last_column;      \
00665         }                                                               \
00666       else                                                              \
00667         {                                                               \
00668           (Current).first_line   = (Current).last_line   =              \
00669             SL_RHSLOC (Rhs, 0).last_line;                               \
00670           (Current).first_column = (Current).last_column =              \
00671             SL_RHSLOC (Rhs, 0).last_column;                             \
00672         }                                                               \
00673     while (SL_ID (0))
00674 #endif
00675 
00676 
00677 /* SL__LOCATION_PRINT -- Print the location on the stream.
00678    This macro was not mandated originally: define only if we know
00679    we won't break user code: when these are the locations we know.  */
00680 
00681 #ifndef SL__LOCATION_PRINT
00682 # if SL_LTYPE_IS_TRIVIAL
00683 #  define SL__LOCATION_PRINT(File, Loc)                 \
00684      fprintf (File, "%d.%d-%d.%d",                      \
00685               (Loc).first_line, (Loc).first_column,     \
00686               (Loc).last_line,  (Loc).last_column)
00687 # else
00688 #  define SL__LOCATION_PRINT(File, Loc) ((void) 0)
00689 # endif
00690 #endif
00691 
00692 
00693 /* SL_LEX -- calling `slx_lex' with the right arguments.  */
00694 
00695 #ifdef SL_LEX_PARAM
00696 # define SL_LEX slx_lex (SL_LEX_PARAM)
00697 #else
00698 # define SL_LEX slx_lex ()
00699 #endif
00700 
00701 /* Enable debugging if requested.  */
00702 #if SL_DEBUG
00703 
00704 # ifndef SL_FPRINTF
00705 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00706 #  define SL_FPRINTF fprintf
00707 # endif
00708 
00709 # define SL_DPRINTF(Args)                       \
00710 do {                                            \
00711   if (slx_debug)                                        \
00712     SL_FPRINTF Args;                            \
00713 } while (SL_ID (0))
00714 
00715 # define SL__SYMBOL_PRINT(Title, Type, Value, Location)                   \
00716 do {                                                                      \
00717   if (slx_debug)                                                                  \
00718     {                                                                     \
00719       SL_FPRINTF (stderr, "%s ", Title);                                          \
00720       slx__symbol_print (stderr,                                                  \
00721                   Type, Value); \
00722       SL_FPRINTF (stderr, "\n");                                                  \
00723     }                                                                     \
00724 } while (SL_ID (0))
00725 
00726 
00727 /*--------------------------------.
00728 | Print this symbol on SL_OUTPUT.  |
00729 `--------------------------------*/
00730 
00731 /*ARGSUSED*/
00732 #if (defined __STDC__ || defined __C99__FUNC__ \
00733      || defined __cplusplus || defined _MSC_VER)
00734 static void
00735 slx__symbol_value_print (FILE *slx_output, int slx_type, SL_STYPE const * const slx_valuep)
00736 #else
00737 static void
00738 slx__symbol_value_print (slx_output, slx_type, slx_valuep)
00739     FILE *slx_output;
00740     int slx_type;
00741     SL_STYPE const * const slx_valuep;
00742 #endif
00743 {
00744   if (!slx_valuep)
00745     return;
00746 # ifdef SL_PRINT
00747   if (slx_type < SL_NTOKENS)
00748     SL_PRINT (slx_output, slx_toknum[slx_type], *slx_valuep);
00749 # else
00750   SL_USE (slx_output);
00751 # endif
00752   switch (slx_type)
00753     {
00754       default:
00755         break;
00756     }
00757 }
00758 
00759 
00760 /*--------------------------------.
00761 | Print this symbol on SL_OUTPUT.  |
00762 `--------------------------------*/
00763 
00764 #if (defined __STDC__ || defined __C99__FUNC__ \
00765      || defined __cplusplus || defined _MSC_VER)
00766 static void
00767 slx__symbol_print (FILE *slx_output, int slx_type, SL_STYPE const * const slx_valuep)
00768 #else
00769 static void
00770 slx__symbol_print (slx_output, slx_type, slx_valuep)
00771     FILE *slx_output;
00772     int slx_type;
00773     SL_STYPE const * const slx_valuep;
00774 #endif
00775 {
00776   if (slx_type < SL_NTOKENS)
00777     SL_FPRINTF (slx_output, "token %s (", slx_tname[slx_type]);
00778   else
00779     SL_FPRINTF (slx_output, "nterm %s (", slx_tname[slx_type]);
00780 
00781   slx__symbol_value_print (slx_output, slx_type, slx_valuep);
00782   SL_FPRINTF (slx_output, ")");
00783 }
00784 
00785 /*------------------------------------------------------------------.
00786 | slx__stack_print -- Print the state stack from its BOTTOM up to its |
00787 | TOP (included).                                                   |
00788 `------------------------------------------------------------------*/
00789 
00790 #if (defined __STDC__ || defined __C99__FUNC__ \
00791      || defined __cplusplus || defined _MSC_VER)
00792 static void
00793 slx__stack_print (slx_type_int16 *bottom, slx_type_int16 *top)
00794 #else
00795 static void
00796 slx__stack_print (bottom, top)
00797     slx_type_int16 *bottom;
00798     slx_type_int16 *top;
00799 #endif
00800 {
00801   SL_FPRINTF (stderr, "Stack now");
00802   for (; bottom <= top; ++bottom)
00803     SL_FPRINTF (stderr, " %d", *bottom);
00804   SL_FPRINTF (stderr, "\n");
00805 }
00806 
00807 # define SL__STACK_PRINT(Bottom, Top)                           \
00808 do {                                                            \
00809   if (slx_debug)                                                        \
00810     slx__stack_print ((Bottom), (Top));                         \
00811 } while (SL_ID (0))
00812 
00813 
00814 /*------------------------------------------------.
00815 | Report that the SL_RULE is going to be reduced.  |
00816 `------------------------------------------------*/
00817 
00818 #if (defined __STDC__ || defined __C99__FUNC__ \
00819      || defined __cplusplus || defined _MSC_VER)
00820 static void
00821 slx__reduce_print (SL_STYPE *slx_vsp, int slx_rule)
00822 #else
00823 static void
00824 slx__reduce_print (slx_vsp, slx_rule)
00825     SL_STYPE *slx_vsp;
00826     int slx_rule;
00827 #endif
00828 {
00829   int slx_nrhs = slx_r2[slx_rule];
00830   int slx_i;
00831   unsigned long int slx_lno = slx_rline[slx_rule];
00832   SL_FPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00833              slx_rule - 1, slx_lno);
00834   /* The symbols being reduced.  */
00835   for (slx_i = 0; slx_i < slx_nrhs; slx_i++)
00836     {
00837       fprintf (stderr, "   $%d = ", slx_i + 1);
00838       slx__symbol_print (stderr, slx_rhs[slx_prhs[slx_rule] + slx_i],
00839                        &(slx_vsp[(slx_i + 1) - (slx_nrhs)])
00840                                        );
00841       fprintf (stderr, "\n");
00842     }
00843 }
00844 
00845 # define SL__REDUCE_PRINT(Rule)         \
00846 do {                                    \
00847   if (slx_debug)                                \
00848     slx__reduce_print (slx_vsp, Rule); \
00849 } while (SL_ID (0))
00850 
00851 /* Nonzero means print parse trace.  It is left uninitialized so that
00852    multiple parsers can coexist.  */
00853 int slx_debug;
00854 #else /* !SL_DEBUG */
00855 # define SL_DPRINTF(Args)
00856 # define SL__SYMBOL_PRINT(Title, Type, Value, Location)
00857 # define SL__STACK_PRINT(Bottom, Top)
00858 # define SL__REDUCE_PRINT(Rule)
00859 #endif /* !SL_DEBUG */
00860 
00861 
00862 /* SL_INITDEPTH -- initial size of the parser's stacks.  */
00863 #ifndef SL_INITDEPTH
00864 # define SL_INITDEPTH 200
00865 #endif
00866 
00867 /* SL_MAXDEPTH -- maximum size the stacks can grow to (effective only
00868    if the built-in stack extension method is used).
00869 
00870    Do not make this value too large; the results are undefined if
00871    SL_STACK_ALLOC_MAXIMUM < SL_STACK_BYTES (SL_MAXDEPTH)
00872    evaluated with infinite-precision integer arithmetic.  */
00873 
00874 #ifndef SL_MAXDEPTH
00875 # define SL_MAXDEPTH 10000
00876 #endif
00877 
00878 
00879 
00880 #if SL_ERROR_VERBOSE
00881 
00882 # ifndef slx_strlen
00883 #  if defined __GLIBC__ && defined _STRING_H
00884 #   define slx_strlen strlen
00885 #  else
00886 /* Return the length of SL_STR.  */
00887 #if (defined __STDC__ || defined __C99__FUNC__ \
00888      || defined __cplusplus || defined _MSC_VER)
00889 static SL_SIZE_T
00890 slx_strlen (const char *slx_str)
00891 #else
00892 static SL_SIZE_T
00893 slx_strlen (slx_str)
00894     const char *slx_str;
00895 #endif
00896 {
00897   SL_SIZE_T slx_len;
00898   for (slx_len = 0; slx_str[slx_len]; slx_len++)
00899     continue;
00900   return slx_len;
00901 }
00902 #  endif
00903 # endif
00904 
00905 # ifndef slx_stpcpy
00906 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
00907 #   define slx_stpcpy stpcpy
00908 #  else
00909 /* Copy SL_SRC to SL_DEST, returning the address of the terminating '\0' in
00910    SL_DEST.  */
00911 #if (defined __STDC__ || defined __C99__FUNC__ \
00912      || defined __cplusplus || defined _MSC_VER)
00913 static char *
00914 slx_stpcpy (char *slx_dest, const char *slx_src)
00915 #else
00916 static char *
00917 slx_stpcpy (slx_dest, slx_src)
00918     char *slx_dest;
00919     const char *slx_src;
00920 #endif
00921 {
00922   char *slx_d = slx_dest;
00923   const char *slx_s = slx_src;
00924 
00925   while ((*slx_d++ = *slx_s++) != '\0')
00926     continue;
00927 
00928   return slx_d - 1;
00929 }
00930 #  endif
00931 # endif
00932 
00933 # ifndef slx_tnamerr
00934 /* Copy to SL_RES the contents of SL_STR after stripping away unnecessary
00935    quotes and backslashes, so that it's suitable for slx_error.  The
00936    heuristic is that double-quoting is unnecessary unless the string
00937    contains an apostrophe, a comma, or backslash (other than
00938    backslash-backslash).  SL_STR is taken from slx_tname.  If SL_RES is
00939    null, do not copy; instead, return the length of what the result
00940    would have been.  */
00941 static SL_SIZE_T
00942 slx_tnamerr (char *slx_res, const char *slx_str)
00943 {
00944   if (*slx_str == '"')
00945     {
00946       SL_SIZE_T slx_n = 0;
00947       char const *slx_p = slx_str;
00948 
00949       for (;;)
00950         switch (*++slx_p)
00951           {
00952           case '\'':
00953           case ',':
00954             goto do_not_strip_quotes;
00955 
00956           case '\\':
00957             if (*++slx_p != '\\')
00958               goto do_not_strip_quotes;
00959             /* Fall through.  */
00960           default:
00961             if (slx_res)
00962               slx_res[slx_n] = *slx_p;
00963             slx_n++;
00964             break;
00965 
00966           case '"':
00967             if (slx_res)
00968               slx_res[slx_n] = '\0';
00969             return slx_n;
00970           }
00971     do_not_strip_quotes: ;
00972     }
00973 
00974   if (! slx_res)
00975     return slx_strlen (slx_str);
00976 
00977   return slx_stpcpy (slx_res, slx_str) - slx_res;
00978 }
00979 # endif
00980 
00981 /* Copy into SL_RESULT an error message about the unexpected token
00982    SL_CHAR while in state SL_STATE.  Return the number of bytes copied,
00983    including the terminating null byte.  If SL_RESULT is null, do not
00984    copy anything; just return the number of bytes that would be
00985    copied.  As a special case, return 0 if an ordinary "syntax error"
00986    message will do.  Return SL_SIZE_MAXIMUM if overflow occurs during
00987    size calculation.  */
00988 static SL_SIZE_T
00989 slx_syntax_error (char *slx_result, int slx_state, int slx_char)
00990 {
00991   int slx_n = slx_pact[slx_state];
00992 
00993   if (! (SL_PACT_NINF < slx_n && slx_n <= SL_LAST))
00994     return 0;
00995   else
00996     {
00997       int slx_type = SL_TRANSLATE (slx_char);
00998       SL_SIZE_T slx_size0 = slx_tnamerr (0, slx_tname[slx_type]);
00999       SL_SIZE_T slx_size = slx_size0;
01000       SL_SIZE_T slx_size1;
01001       int slx_size_overflow = 0;
01002       enum { SL_ERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01003       char const *slx_arg[SL_ERROR_VERBOSE_ARGS_MAXIMUM];
01004       int slx_x;
01005 
01006 # if 0
01007       /* This is so xgettext sees the translatable formats that are
01008          constructed on the fly.  */
01009       SL__("syntax error, unexpected %s");
01010       SL__("syntax error, unexpected %s, expecting %s");
01011       SL__("syntax error, unexpected %s, expecting %s or %s");
01012       SL__("syntax error, unexpected %s, expecting %s or %s or %s");
01013       SL__("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01014 # endif
01015       char *slx_fmt;
01016       char const *slx_f;
01017       static char const slx_unexpected[] = "syntax error, unexpected %s";
01018       static char const slx_expecting[] = ", expecting %s";
01019       static char const slx_or[] = " or %s";
01020       char slx_format[sizeof slx_unexpected
01021                     + sizeof slx_expecting - 1
01022                     + ((SL_ERROR_VERBOSE_ARGS_MAXIMUM - 2)
01023                        * (sizeof slx_or - 1))];
01024       char const *slx_prefix = slx_expecting;
01025 
01026       /* Start SL_X at -SL_N if negative to avoid negative indexes in
01027          SL_CHECK.  */
01028       int slx_xbegin = slx_n < 0 ? -slx_n : 0;
01029 
01030       /* Stay within bounds of both slx_check and slx_tname.  */
01031       int slx_checklim = SL_LAST - slx_n + 1;
01032       int slx_xend = slx_checklim < SL_NTOKENS ? slx_checklim : SL_NTOKENS;
01033       int slx_count = 1;
01034 
01035       slx_arg[0] = slx_tname[slx_type];
01036       slx_fmt = slx_stpcpy (slx_format, slx_unexpected);
01037 
01038       for (slx_x = slx_xbegin; slx_x < slx_xend; ++slx_x)
01039         if (slx_check[slx_x + slx_n] == slx_x && slx_x != SL_TERROR)
01040           {
01041             if (slx_count == SL_ERROR_VERBOSE_ARGS_MAXIMUM)
01042               {
01043                 slx_count = 1;
01044                 slx_size = slx_size0;
01045                 slx_format[sizeof slx_unexpected - 1] = '\0';
01046                 break;
01047               }
01048             slx_arg[slx_count++] = slx_tname[slx_x];
01049             slx_size1 = slx_size + slx_tnamerr (0, slx_tname[slx_x]);
01050             slx_size_overflow |= (slx_size1 < slx_size);
01051             slx_size = slx_size1;
01052             slx_fmt = slx_stpcpy (slx_fmt, slx_prefix);
01053             slx_prefix = slx_or;
01054           }
01055 
01056       slx_f = SL__(slx_format);
01057       slx_size1 = slx_size + slx_strlen (slx_f);
01058       slx_size_overflow |= (slx_size1 < slx_size);
01059       slx_size = slx_size1;
01060 
01061       if (slx_size_overflow)
01062         return SL_SIZE_MAXIMUM;
01063 
01064       if (slx_result)
01065         {
01066           /* Avoid sprintf, as that infringes on the user's name space.
01067              Don't have undefined behavior even if the translation
01068              produced a string with the wrong number of "%s"s.  */
01069           char *slx_p = slx_result;
01070