root/test/manual/etags/y-src/parse.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. yymemcpy
  2. yystrlen
  3. yystpcpy
  4. yyparse
  5. FUN1
  6. FUN2
  7. FUN0
  8. FUN2
  9. FUN1

     1 /* A Bison parser, made from parse.y
     2    by GNU bison 1.32.  */
     3 
     4 #define YYBISON 1  /* Identify Bison output.  */
     5 
     6 # define        NE      257
     7 # define        LE      258
     8 # define        GE      259
     9 # define        NEG     260
    10 # define        L_CELL  261
    11 # define        L_RANGE 262
    12 # define        L_VAR   263
    13 # define        L_CONST 264
    14 # define        L_FN0   265
    15 # define        L_FN1   266
    16 # define        L_FN2   267
    17 # define        L_FN3   268
    18 # define        L_FN4   269
    19 # define        L_FNN   270
    20 # define        L_FN1R  271
    21 # define        L_FN2R  272
    22 # define        L_FN3R  273
    23 # define        L_FN4R  274
    24 # define        L_FNNR  275
    25 # define        L_LE    276
    26 # define        L_NE    277
    27 # define        L_GE    278
    28 
    29 #line 1 "y-src/parse.y"
    30 
    31 /*      Copyright (C) 1990, 1992-1993, 2016-2023 Free Software Foundation,
    32  *      Inc.
    33 
    34 This file is part of Oleo, the GNU Spreadsheet.
    35 
    36 Oleo is free software; you can redistribute it and/or modify
    37 it under the terms of the GNU General Public License as published by
    38 the Free Software Foundation; either version 2, or (at your option)
    39 any later version.
    40 
    41 Oleo is distributed in the hope that it will be useful,
    42 but WITHOUT ANY WARRANTY; without even the implied warranty of
    43 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    44 GNU General Public License for more details.
    45 
    46 You should have received a copy of the GNU General Public License
    47 along with Oleo; see the file COPYING.  If not, write to
    48 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    49 #line 41 "y-src/parse.y"
    50 
    51 #include "funcdef.h"
    52 
    53 #include <ctype.h>
    54 
    55 #define obstack_chunk_alloc ck_malloc
    56 #define obstack_chunk_free free
    57 #include "obstack.h"
    58 #include "sysdef.h"
    59 
    60 #include "global.h"
    61 #include "errors.h"
    62 #include "node.h"
    63 #include "eval.h"
    64 #include "ref.h"
    65 
    66 int yylex ();
    67 #ifdef __STDC__
    68 void yyerror (char *);
    69 #else
    70 void yyerror ();
    71 #endif
    72 VOIDSTAR parse_hash;
    73 extern VOIDSTAR hash_find();
    74 
    75 /* This table contains a list of the infix single-char functions */
    76 unsigned char fnin[] = {
    77         SUM, DIFF, DIV, PROD, MOD, /* AND, OR, */ POW, EQUAL, IF, CONCAT, 0
    78 };
    79 
    80 #define YYSTYPE _y_y_s_t_y_p_e
    81 typedef struct node *YYSTYPE;
    82 YYSTYPE parse_return;
    83 #ifdef __STDC__
    84 YYSTYPE make_list (YYSTYPE, YYSTYPE);
    85 #else
    86 YYSTYPE make_list ();
    87 #endif
    88 
    89 char *instr;
    90 int parse_error = 0;
    91 extern struct obstack tmp_mem;
    92 
    93 #ifndef YYSTYPE
    94 #define YYSTYPE int
    95 #endif
    96 #ifndef YYDEBUG
    97 # define YYDEBUG 0
    98 #endif
    99 
   100 
   101 
   102 #define YYFINAL         131
   103 #define YYFLAG          -32768
   104 #define YYNTBASE        41
   105 
   106 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
   107 #define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 47)
   108 
   109 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
   110 static const char yytranslate[] =
   111 {
   112        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   113        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   114        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   115        2,     2,     2,    19,     2,     2,     2,    16,     5,     2,
   116       38,    39,    14,    12,    40,    13,     2,    15,     2,     2,
   117        2,     2,     2,     2,     2,     2,     2,     2,     4,     2,
   118        8,     6,    10,     3,     2,     2,     2,     2,     2,     2,
   119        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   120        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   121        2,     2,     2,     2,    17,     2,     2,     2,     2,     2,
   122        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   123        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   124        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   125        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   126        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   127        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   128        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   129        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   130        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   131        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   132        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   133        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   134        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   135        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   136        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   137        2,     2,     2,     2,     2,     2,     1,     7,     9,    11,
   138       18,    20,    21,    22,    23,    24,    25,    26,    27,    28,
   139       29,    30,    31,    32,    33,    34,    35,    36,    37
   140 };
   141 
   142 #if YYDEBUG
   143 static const short yyprhs[] =
   144 {
   145        0,     0,     2,     4,     6,     8,    12,    17,    24,    33,
   146       44,    49,    54,    59,    66,    73,    82,    91,   100,   109,
   147      114,   120,   124,   128,   132,   136,   140,   144,   148,   152,
   148      156,   160,   164,   168,   172,   175,   178,   182,   186,   189,
   149      191,   195,   197,   199,   201,   205,   207
   150 };
   151 static const short yyrhs[] =
   152 {
   153       42,     0,     1,     0,    23,     0,    46,     0,    24,    38,
   154       39,     0,    25,    38,    42,    39,     0,    26,    38,    42,
   155       40,    42,    39,     0,    27,    38,    42,    40,    42,    40,
   156       42,    39,     0,    28,    38,    42,    40,    42,    40,    42,
   157       40,    42,    39,     0,    29,    38,    43,    39,     0,    30,
   158       38,    21,    39,     0,    30,    38,    22,    39,     0,    31,
   159       38,    21,    40,    42,    39,     0,    31,    38,    22,    40,
   160       42,    39,     0,    31,    38,    21,    40,    42,    40,    42,
   161       39,     0,    31,    38,    22,    40,    42,    40,    42,    39,
   162        0,    32,    38,    21,    40,    42,    40,    42,    39,     0,
   163       32,    38,    22,    40,    42,    40,    42,    39,     0,    34,
   164       38,    45,    39,     0,    42,     3,    42,     4,    42,     0,
   165       42,     5,    42,     0,    42,     8,    42,     0,    42,     9,
   166       42,     0,    42,     6,    42,     0,    42,     7,    42,     0,
   167       42,    10,    42,     0,    42,    11,    42,     0,    42,    12,
   168       42,     0,    42,    13,    42,     0,    42,    14,    42,     0,
   169       42,    15,    42,     0,    42,    16,    42,     0,    42,    17,
   170       42,     0,    13,    42,     0,    19,    42,     0,    38,    42,
   171       39,     0,    38,    42,     1,     0,    38,     1,     0,    42,
   172        0,    43,    40,    42,     0,    21,     0,    42,     0,    44,
   173        0,    45,    40,    44,     0,    20,     0,    22,     0
   174 };
   175 
   176 #endif
   177 
   178 #if YYDEBUG
   179 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
   180 static const short yyrline[] =
   181 {
   182        0,    86,    88,    94,    95,    96,    98,   102,   106,   110,
   183      114,   118,   121,   125,   129,   135,   142,   150,   154,   159,
   184      163,   174,   178,   182,   186,   190,   194,   198,   202,   206,
   185      210,   214,   218,   222,   226,   241,   245,   247,   255,   262,
   186      264,   268,   269,   272,   274,   278,   280
   187 };
   188 #endif
   189 
   190 
   191 #if (YYDEBUG) || defined YYERROR_VERBOSE
   192 
   193 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
   194 static const char *const yytname[] =
   195 {
   196   "$", "error", "$undefined.", "'?'", "':'", "'&'", "'='", "NE", "'<'", 
   197   "LE", "'>'", "GE", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "NEG", 
   198   "'!'", "L_CELL", "L_RANGE", "L_VAR", "L_CONST", "L_FN0", "L_FN1", 
   199   "L_FN2", "L_FN3", "L_FN4", "L_FNN", "L_FN1R", "L_FN2R", "L_FN3R", 
   200   "L_FN4R", "L_FNNR", "L_LE", "L_NE", "L_GE", "'('", "')'", "','", "line", 
   201   "exp", "exp_list", "range_exp", "range_exp_list", "cell", NULL
   202 };
   203 #endif
   204 
   205 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
   206 static const short yyr1[] =
   207 {
   208        0,    41,    41,    42,    42,    42,    42,    42,    42,    42,
   209       42,    42,    42,    42,    42,    42,    42,    42,    42,    42,
   210       42,    42,    42,    42,    42,    42,    42,    42,    42,    42,
   211       42,    42,    42,    42,    42,    42,    42,    42,    42,    43,
   212       43,    44,    44,    45,    45,    46,    46
   213 };
   214 
   215 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
   216 static const short yyr2[] =
   217 {
   218        0,     1,     1,     1,     1,     3,     4,     6,     8,    10,
   219        4,     4,     4,     6,     6,     8,     8,     8,     8,     4,
   220        5,     3,     3,     3,     3,     3,     3,     3,     3,     3,
   221        3,     3,     3,     3,     2,     2,     3,     3,     2,     1,
   222        3,     1,     1,     1,     3,     1,     1
   223 };
   224 
   225 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
   226    doesn't specify something else to do.  Zero means the default is an
   227    error. */
   228 static const short yydefact[] =
   229 {
   230        0,     2,     0,     0,    45,    46,     3,     0,     0,     0,
   231        0,     0,     0,     0,     0,     0,     0,     0,     1,     4,
   232       34,    35,     0,     0,     0,     0,     0,     0,     0,     0,
   233        0,     0,    38,     0,     0,     0,     0,     0,     0,     0,
   234        0,     0,     0,     0,     0,     0,     0,     0,     5,     0,
   235        0,     0,     0,    39,     0,     0,     0,     0,     0,     0,
   236        0,    41,    42,    43,     0,    37,    36,     0,    21,    24,
   237       25,    22,    23,    26,    27,    28,    29,    30,    31,    32,
   238       33,     6,     0,     0,     0,    10,     0,    11,    12,     0,
   239        0,     0,     0,    19,     0,     0,     0,     0,     0,    40,
   240        0,     0,     0,     0,    44,    20,     7,     0,     0,    13,
   241        0,    14,     0,     0,     0,     0,     0,     0,     0,     0,
   242        0,     8,     0,    15,    16,    17,    18,     0,     9,     0,
   243        0,     0
   244 };
   245 
   246 static const short yydefgoto[] =
   247 {
   248      129,    62,    54,    63,    64,    19
   249 };
   250 
   251 static const short yypact[] =
   252 {
   253      104,-32768,   486,   486,-32768,-32768,-32768,   -37,   -22,   -16,
   254       10,    12,    14,    29,    43,    47,    50,   124,   537,-32768,
   255   -32768,-32768,    59,   486,   486,   486,   486,   486,     7,     9,
   256       11,   464,-32768,    48,   486,   486,   486,   486,   486,   486,
   257      486,   486,   486,   486,   486,   486,   486,   486,-32768,   332,
   258      173,   209,   224,   537,    54,    60,    61,    64,    66,    69,
   259       71,-32768,   537,-32768,    57,-32768,-32768,   522,    -2,   193,
   260      193,   547,   547,   547,   547,     4,     4,    84,    84,    84,
   261       84,-32768,   486,   486,   486,-32768,   486,-32768,-32768,   486,
   262      486,   486,   486,-32768,   464,   486,   353,   245,   260,   537,
   263       63,   158,   281,   296,-32768,   537,-32768,   486,   486,-32768,
   264      486,-32768,   486,   486,   486,   369,   317,   388,   404,   423,
   265      439,-32768,   486,-32768,-32768,-32768,-32768,   458,-32768,   115,
   266      116,-32768
   267 };
   268 
   269 static const short yypgoto[] =
   270 {
   271   -32768,     0,-32768,    24,-32768,-32768
   272 };
   273 
   274 
   275 #define YYLAST          564
   276 
   277 
   278 static const short yytable[] =
   279 {
   280       18,    22,    20,    21,    36,    37,    38,    39,    40,    41,
   281       42,    43,    44,    45,    46,    47,    23,    33,    44,    45,
   282       46,    47,    24,    49,    50,    51,    52,    53,    55,    56,
   283       57,    58,    59,    60,    67,    68,    69,    70,    71,    72,
   284       73,    74,    75,    76,    77,    78,    79,    80,    25,    65,
   285       26,    34,    27,    35,    36,    37,    38,    39,    40,    41,
   286       42,    43,    44,    45,    46,    47,    34,    28,    35,    36,
   287       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
   288       47,    29,    96,    97,    98,    30,    99,    66,    31,   100,
   289      101,   102,   103,    85,    86,   105,    93,    94,    48,    87,
   290       88,    47,   109,   110,    89,     1,    90,   115,   116,    91,
   291      117,    92,   118,   119,   120,   130,   131,     2,   104,     0,
   292        0,     0,   127,     3,     4,    32,     5,     6,     7,     8,
   293        9,    10,    11,    12,    13,    14,    15,     2,    16,     0,
   294        0,     0,    17,     3,     4,     0,     5,     6,     7,     8,
   295        9,    10,    11,    12,    13,    14,    15,     0,    16,     0,
   296        0,    34,    17,    35,    36,    37,    38,    39,    40,    41,
   297       42,    43,    44,    45,    46,    47,    34,     0,    35,    36,
   298       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
   299       47,     0,     0,     0,     0,     0,     0,   111,   112,-32768,
   300   -32768,    38,    39,    40,    41,    42,    43,    44,    45,    46,
   301       47,     0,    34,    82,    35,    36,    37,    38,    39,    40,
   302       41,    42,    43,    44,    45,    46,    47,    34,     0,    35,
   303       36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
   304       46,    47,     0,     0,     0,     0,     0,     0,    34,    83,
   305       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
   306       45,    46,    47,    34,    84,    35,    36,    37,    38,    39,
   307       40,    41,    42,    43,    44,    45,    46,    47,     0,     0,
   308        0,     0,     0,     0,    34,   107,    35,    36,    37,    38,
   309       39,    40,    41,    42,    43,    44,    45,    46,    47,    34,
   310      108,    35,    36,    37,    38,    39,    40,    41,    42,    43,
   311       44,    45,    46,    47,     0,     0,     0,     0,     0,     0,
   312       34,   113,    35,    36,    37,    38,    39,    40,    41,    42,
   313       43,    44,    45,    46,    47,    34,   114,    35,    36,    37,
   314       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
   315        0,     0,     0,     0,     0,     0,    34,   122,    35,    36,
   316       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
   317       47,    81,    34,     0,    35,    36,    37,    38,    39,    40,
   318       41,    42,    43,    44,    45,    46,    47,     0,     0,     0,
   319        0,    34,   106,    35,    36,    37,    38,    39,    40,    41,
   320       42,    43,    44,    45,    46,    47,     0,    34,   121,    35,
   321       36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
   322       46,    47,     0,     0,     0,     0,    34,   123,    35,    36,
   323       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
   324       47,     0,    34,   124,    35,    36,    37,    38,    39,    40,
   325       41,    42,    43,    44,    45,    46,    47,     0,     0,     0,
   326        0,    34,   125,    35,    36,    37,    38,    39,    40,    41,
   327       42,    43,    44,    45,    46,    47,     0,     2,   126,     0,
   328        0,     0,     0,     3,     4,    61,     5,     6,     7,     8,
   329        9,    10,    11,    12,    13,    14,    15,   128,    16,     2,
   330        0,     0,    17,     0,     0,     3,     4,     0,     5,     6,
   331        7,     8,     9,    10,    11,    12,    13,    14,    15,     0,
   332       16,     0,     0,     0,    17,    34,    95,    35,    36,    37,
   333       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
   334       34,     0,    35,    36,    37,    38,    39,    40,    41,    42,
   335       43,    44,    45,    46,    47,-32768,-32768,-32768,-32768,    42,
   336       43,    44,    45,    46,    47
   337 };
   338 
   339 static const short yycheck[] =
   340 {
   341        0,    38,     2,     3,     6,     7,     8,     9,    10,    11,
   342       12,    13,    14,    15,    16,    17,    38,    17,    14,    15,
   343       16,    17,    38,    23,    24,    25,    26,    27,    21,    22,
   344       21,    22,    21,    22,    34,    35,    36,    37,    38,    39,
   345       40,    41,    42,    43,    44,    45,    46,    47,    38,     1,
   346       38,     3,    38,     5,     6,     7,     8,     9,    10,    11,
   347       12,    13,    14,    15,    16,    17,     3,    38,     5,     6,
   348        7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
   349       17,    38,    82,    83,    84,    38,    86,    39,    38,    89,
   350       90,    91,    92,    39,    40,    95,    39,    40,    39,    39,
   351       39,    17,    39,    40,    40,     1,    40,   107,   108,    40,
   352      110,    40,   112,   113,   114,     0,     0,    13,    94,    -1,
   353       -1,    -1,   122,    19,    20,     1,    22,    23,    24,    25,
   354       26,    27,    28,    29,    30,    31,    32,    13,    34,    -1,
   355       -1,    -1,    38,    19,    20,    -1,    22,    23,    24,    25,
   356       26,    27,    28,    29,    30,    31,    32,    -1,    34,    -1,
   357       -1,     3,    38,     5,     6,     7,     8,     9,    10,    11,
   358       12,    13,    14,    15,    16,    17,     3,    -1,     5,     6,
   359        7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
   360       17,    -1,    -1,    -1,    -1,    -1,    -1,    39,    40,     6,
   361        7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
   362       17,    -1,     3,    40,     5,     6,     7,     8,     9,    10,
   363       11,    12,    13,    14,    15,    16,    17,     3,    -1,     5,
   364        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
   365       16,    17,    -1,    -1,    -1,    -1,    -1,    -1,     3,    40,
   366        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
   367       15,    16,    17,     3,    40,     5,     6,     7,     8,     9,
   368       10,    11,    12,    13,    14,    15,    16,    17,    -1,    -1,
   369       -1,    -1,    -1,    -1,     3,    40,     5,     6,     7,     8,
   370        9,    10,    11,    12,    13,    14,    15,    16,    17,     3,
   371       40,     5,     6,     7,     8,     9,    10,    11,    12,    13,
   372       14,    15,    16,    17,    -1,    -1,    -1,    -1,    -1,    -1,
   373        3,    40,     5,     6,     7,     8,     9,    10,    11,    12,
   374       13,    14,    15,    16,    17,     3,    40,     5,     6,     7,
   375        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
   376       -1,    -1,    -1,    -1,    -1,    -1,     3,    40,     5,     6,
   377        7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
   378       17,    39,     3,    -1,     5,     6,     7,     8,     9,    10,
   379       11,    12,    13,    14,    15,    16,    17,    -1,    -1,    -1,
   380       -1,     3,    39,     5,     6,     7,     8,     9,    10,    11,
   381       12,    13,    14,    15,    16,    17,    -1,     3,    39,     5,
   382        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
   383       16,    17,    -1,    -1,    -1,    -1,     3,    39,     5,     6,
   384        7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
   385       17,    -1,     3,    39,     5,     6,     7,     8,     9,    10,
   386       11,    12,    13,    14,    15,    16,    17,    -1,    -1,    -1,
   387       -1,     3,    39,     5,     6,     7,     8,     9,    10,    11,
   388       12,    13,    14,    15,    16,    17,    -1,    13,    39,    -1,
   389       -1,    -1,    -1,    19,    20,    21,    22,    23,    24,    25,
   390       26,    27,    28,    29,    30,    31,    32,    39,    34,    13,
   391       -1,    -1,    38,    -1,    -1,    19,    20,    -1,    22,    23,
   392       24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
   393       34,    -1,    -1,    -1,    38,     3,     4,     5,     6,     7,
   394        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
   395        3,    -1,     5,     6,     7,     8,     9,    10,    11,    12,
   396       13,    14,    15,    16,    17,     8,     9,    10,    11,    12,
   397       13,    14,    15,    16,    17
   398 };
   399 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
   400 #line 3 "/usr/share/bison/bison.simple"
   401 
   402 /* Skeleton output parser for bison,
   403    Copyright (C) 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
   404 
   405    This program is free software; you can redistribute it and/or modify
   406    it under the terms of the GNU General Public License as published by
   407    the Free Software Foundation; either version 2, or (at your option)
   408    any later version.
   409 
   410    This program is distributed in the hope that it will be useful,
   411    but WITHOUT ANY WARRANTY; without even the implied warranty of
   412    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   413    GNU General Public License for more details.
   414 
   415    You should have received a copy of the GNU General Public License
   416    along with this program; if not, write to the Free Software
   417    Foundation, Inc., 59 Temple Place - Suite 330,
   418    Boston, MA 02111-1307, USA.  */
   419 
   420 /* As a special exception, when this file is copied by Bison into a
   421    Bison output file, you may use that output file without restriction.
   422    This special exception was added by the Free Software Foundation
   423    in version 1.24 of Bison.  */
   424 
   425 /* This is the parser code that is written into each bison parser when
   426    the %semantic_parser declaration is not specified in the grammar.
   427    It was written by Richard Stallman by simplifying the hairy parser
   428    used when %semantic_parser is specified.  */
   429 
   430 /* All symbols defined below should begin with yy or YY, to avoid
   431    infringing on user name space.  This should be done even for local
   432    variables, as they might otherwise be expanded by user macros.
   433    There are some unavoidable exceptions within include files to
   434    define necessary library symbols; they are noted "INFRINGES ON
   435    USER NAME SPACE" below.  */
   436 
   437 #ifdef __cplusplus
   438 # define YYSTD(x) std::x
   439 #else
   440 # define YYSTD(x) x
   441 #endif
   442 
   443 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
   444 
   445 /* The parser invokes alloca or malloc; define the necessary symbols.  */
   446 
   447 # if YYSTACK_USE_ALLOCA
   448 #  define YYSTACK_ALLOC alloca
   449 #  define YYSIZE_T YYSTD (size_t)
   450 # else
   451 #  ifndef YYSTACK_USE_ALLOCA
   452 #   if defined (alloca) || defined (_ALLOCA_H)
   453 #    define YYSTACK_ALLOC alloca
   454 #    define YYSIZE_T YYSTD (size_t)
   455 #   else
   456 #    ifdef __GNUC__
   457 #     define YYSTACK_ALLOC __builtin_alloca
   458 #    endif
   459 #   endif
   460 #  endif
   461 # endif
   462 
   463 # ifdef YYSTACK_ALLOC
   464    /* Pacify GCC's `empty if-body' warning. */
   465 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
   466 # else
   467 #  ifdef __cplusplus
   468 #   include <cstdlib> /* INFRINGES ON USER NAME SPACE */
   469 #   define YYSIZE_T std::size_t
   470 #  else
   471 #   ifdef __STDC__
   472 #    include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
   473 #    define YYSIZE_T size_t
   474 #   endif
   475 #  endif
   476 #  define YYSTACK_ALLOC YYSTD (malloc)
   477 #  define YYSTACK_FREE YYSTD (free)
   478 # endif
   479 
   480 /* A type that is properly aligned for any stack member.  */
   481 union yyalloc
   482 {
   483   short yyss;
   484   YYSTYPE yyvs;
   485 # if YYLSP_NEEDED
   486   YYLTYPE yyls;
   487 # endif
   488 };
   489 
   490 /* The size of the maximum gap between one aligned stack and the next.  */
   491 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
   492 
   493 /* The size of an array large to enough to hold all stacks, each with
   494    N elements.  */
   495 # if YYLSP_NEEDED
   496 #  define YYSTACK_BYTES(N) \
   497      ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))      \
   498       + 2 * YYSTACK_GAP_MAX)
   499 # else
   500 #  define YYSTACK_BYTES(N) \
   501      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
   502       + YYSTACK_GAP_MAX)
   503 # endif
   504 
   505 /* Relocate the TYPE STACK from its old location to the new one.  The
   506    local variables YYSIZE and YYSTACKSIZE give the old and new number of
   507    elements in the stack, and YYPTR gives the new location of the
   508    stack.  Advance YYPTR to a properly aligned location for the next
   509    stack.  */
   510 # define YYSTACK_RELOCATE(Type, Stack)                                  \
   511     do                                                                  \
   512       {                                                                 \
   513         YYSIZE_T yynewbytes;                                            \
   514         yymemcpy ((char *) yyptr, (char *) (Stack),                     \
   515                   yysize * (YYSIZE_T) sizeof (Type));                   \
   516         Stack = &yyptr->Stack;                                          \
   517         yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX;     \
   518         yyptr += yynewbytes / sizeof (*yyptr);                          \
   519       }                                                                 \
   520     while (0)
   521 
   522 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
   523 
   524 
   525 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
   526 # define YYSIZE_T __SIZE_TYPE__
   527 #endif
   528 #if ! defined (YYSIZE_T) && defined (size_t)
   529 # define YYSIZE_T size_t
   530 #endif
   531 #if ! defined (YYSIZE_T)
   532 # ifdef __cplusplus
   533 #  include <cstddef> /* INFRINGES ON USER NAME SPACE */
   534 #  define YYSIZE_T std::size_t
   535 # else
   536 #  ifdef __STDC__
   537 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
   538 #   define YYSIZE_T size_t
   539 #  endif
   540 # endif
   541 #endif
   542 #if ! defined (YYSIZE_T)
   543 # define YYSIZE_T unsigned int
   544 #endif
   545 
   546 #define yyerrok         (yyerrstatus = 0)
   547 #define yyclearin       (yychar = YYEMPTY)
   548 #define YYEMPTY         -2
   549 #define YYEOF           0
   550 #define YYACCEPT        goto yyacceptlab
   551 #define YYABORT         goto yyabortlab
   552 #define YYERROR         goto yyerrlab1
   553 /* Like YYERROR except do call yyerror.  This remains here temporarily
   554    to ease the transition to the new meaning of YYERROR, for GCC.
   555    Once GCC version 2 has supplanted version 1, this can go.  */
   556 #define YYFAIL          goto yyerrlab
   557 #define YYRECOVERING()  (!!yyerrstatus)
   558 #define YYBACKUP(Token, Value)                                  \
   559 do                                                              \
   560   if (yychar == YYEMPTY && yylen == 1)                          \
   561     {                                                           \
   562       yychar = (Token);                                         \
   563       yylval = (Value);                                         \
   564       yychar1 = YYTRANSLATE (yychar);                           \
   565       YYPOPSTACK;                                               \
   566       goto yybackup;                                            \
   567     }                                                           \
   568   else                                                          \
   569     {                                                           \
   570       yyerror ("syntax error: cannot back up");                 \
   571       YYERROR;                                                  \
   572     }                                                           \
   573 while (0)
   574 
   575 #define YYTERROR        1
   576 #define YYERRCODE       256
   577 
   578 
   579 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
   580    are run).
   581 
   582    When YYLLOC_DEFAULT is run, CURRENT is set the location of the
   583    first token.  By default, to implement support for ranges, extend
   584    its range to the last symbol.  */
   585 
   586 #ifndef YYLLOC_DEFAULT
   587 # define YYLLOC_DEFAULT(Current, Rhs, N)        \
   588    Current.last_line   = Rhs[N].last_line;      \
   589    Current.last_column = Rhs[N].last_column;
   590 #endif
   591 
   592 
   593 /* YYLEX -- calling `yylex' with the right arguments.  */
   594 
   595 #if YYPURE
   596 # if YYLSP_NEEDED
   597 #  ifdef YYLEX_PARAM
   598 #   define YYLEX                yylex (&yylval, &yylloc, YYLEX_PARAM)
   599 #  else
   600 #   define YYLEX                yylex (&yylval, &yylloc)
   601 #  endif
   602 # else /* !YYLSP_NEEDED */
   603 #  ifdef YYLEX_PARAM
   604 #   define YYLEX                yylex (&yylval, YYLEX_PARAM)
   605 #  else
   606 #   define YYLEX                yylex (&yylval)
   607 #  endif
   608 # endif /* !YYLSP_NEEDED */
   609 #else /* !YYPURE */
   610 # define YYLEX                  yylex ()
   611 #endif /* !YYPURE */
   612 
   613 
   614 /* Enable debugging if requested.  */
   615 #if YYDEBUG
   616 
   617 # ifndef YYFPRINTF
   618 #  ifdef __cplusplus
   619 #   include <cstdio>  /* INFRINGES ON USER NAME SPACE */
   620 #  else
   621 #   include <stdio.h> /* INFRINGES ON USER NAME SPACE */
   622 #  endif
   623 #  define YYFPRINTF YYSTD (fprintf)
   624 # endif
   625 
   626 # define YYDPRINTF(Args)                        \
   627 do {                                            \
   628   if (yydebug)                                  \
   629     YYFPRINTF Args;                             \
   630 } while (0)
   631 /* Nonzero means print parse trace. [The following comment makes no
   632    sense to me.  Could someone clarify it?  --akim] Since this is
   633    uninitialized, it does not stop multiple parsers from coexisting.
   634    */
   635 int yydebug;
   636 #else /* !YYDEBUG */
   637 # define YYDPRINTF(Args)
   638 #endif /* !YYDEBUG */
   639 
   640 /* YYINITDEPTH -- initial size of the parser's stacks.  */
   641 #ifndef YYINITDEPTH
   642 # define YYINITDEPTH 200
   643 #endif
   644 
   645 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   646    if the built-in stack extension method is used).
   647 
   648    Do not make this value too large; the results are undefined if
   649    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   650    evaluated with infinite-precision integer arithmetic.  */
   651 
   652 #if YYMAXDEPTH == 0
   653 # undef YYMAXDEPTH
   654 #endif
   655 
   656 #ifndef YYMAXDEPTH
   657 # define YYMAXDEPTH 10000
   658 #endif
   659 
   660 #if ! defined (yyoverflow) && ! defined (yymemcpy)
   661 # if __GNUC__ > 1               /* GNU C and GNU C++ define this.  */
   662 #  define yymemcpy __builtin_memcpy
   663 # else                          /* not GNU C or C++ */
   664 
   665 /* This is the most reliable way to avoid incompatibilities
   666    in available built-in functions on various systems.  */
   667 static void
   668 #  if defined (__STDC__) || defined (__cplusplus)
   669 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
   670 #  else
   671 yymemcpy (yyto, yyfrom, yycount)
   672      char *yyto;
   673      const char *yyfrom;
   674      YYSIZE_T yycount;
   675 #  endif
   676 {
   677   register const char *yyf = yyfrom;
   678   register char *yyt = yyto;
   679   register YYSIZE_T yyi = yycount;
   680 
   681   while (yyi-- != 0)
   682     *yyt++ = *yyf++;
   683 }
   684 # endif
   685 #endif
   686 
   687 #ifdef YYERROR_VERBOSE
   688 
   689 # ifndef yystrlen
   690 #  if defined (__GLIBC__) && defined (_STRING_H)
   691 #   define yystrlen strlen
   692 #  else
   693 /* Return the length of YYSTR.  */
   694 static YYSIZE_T
   695 #   if defined (__STDC__) || defined (__cplusplus)
   696 yystrlen (const char *yystr)
   697 #   else
   698 yystrlen (yystr)
   699      const char *yystr;
   700 #   endif
   701 {
   702   register const char *yys = yystr;
   703 
   704   while (*yys++ != '\0')
   705     continue;
   706 
   707   return yys - yystr - 1;
   708 }
   709 #  endif
   710 # endif
   711 
   712 # ifndef yystpcpy
   713 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
   714 #   define yystpcpy stpcpy
   715 #  else
   716 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   717    YYDEST.  */
   718 static char *
   719 #   if defined (__STDC__) || defined (__cplusplus)
   720 yystpcpy (char *yydest, const char *yysrc)
   721 #   else
   722 yystpcpy (yydest, yysrc)
   723      char *yydest;
   724      const char *yysrc;
   725 #   endif
   726 {
   727   register char *yyd = yydest;
   728   register const char *yys = yysrc;
   729 
   730   while ((*yyd++ = *yys++) != '\0')
   731     continue;
   732 
   733   return yyd - 1;
   734 }
   735 #  endif
   736 # endif
   737 #endif
   738 
   739 #line 341 "/usr/share/bison/bison.simple"
   740 
   741 
   742 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
   743    into yyparse.  The argument should have type void *.
   744    It should actually point to an object.
   745    Grammar actions can access the variable by casting it
   746    to the proper pointer type.  */
   747 
   748 #ifdef YYPARSE_PARAM
   749 # ifdef __cplusplus
   750 #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
   751 #  define YYPARSE_PARAM_DECL
   752 # else /* !__cplusplus */
   753 #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
   754 #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
   755 # endif /* !__cplusplus */
   756 #else /* !YYPARSE_PARAM */
   757 # define YYPARSE_PARAM_ARG
   758 # define YYPARSE_PARAM_DECL
   759 #endif /* !YYPARSE_PARAM */
   760 
   761 /* Prevent warning if -Wstrict-prototypes.  */
   762 #ifdef __GNUC__
   763 # ifdef YYPARSE_PARAM
   764 int yyparse (void *);
   765 # else
   766 int yyparse (void);
   767 # endif
   768 #endif
   769 
   770 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
   771    variables are global, or local to YYPARSE.  */
   772 
   773 #define YY_DECL_NON_LSP_VARIABLES                       \
   774 /* The lookahead symbol.  */                            \
   775 int yychar;                                             \
   776                                                         \
   777 /* The semantic value of the lookahead symbol. */       \
   778 YYSTYPE yylval;                                         \
   779                                                         \
   780 /* Number of parse errors so far.  */                   \
   781 int yynerrs;
   782 
   783 #if YYLSP_NEEDED
   784 # define YY_DECL_VARIABLES                      \
   785 YY_DECL_NON_LSP_VARIABLES                       \
   786                                                 \
   787 /* Location data for the lookahead symbol.  */  \
   788 YYLTYPE yylloc;
   789 #else
   790 # define YY_DECL_VARIABLES                      \
   791 YY_DECL_NON_LSP_VARIABLES
   792 #endif
   793 
   794 
   795 /* If nonreentrant, generate the variables here. */
   796 
   797 #if !YYPURE
   798 YY_DECL_VARIABLES
   799 #endif  /* !YYPURE */
   800 
   801 int
   802 yyparse (YYPARSE_PARAM_ARG)
   803      YYPARSE_PARAM_DECL
   804 {
   805   /* If reentrant, generate the variables here. */
   806 #if YYPURE
   807   YY_DECL_VARIABLES
   808 #endif  /* !YYPURE */
   809 
   810   register int yystate;
   811   register int yyn;
   812   int yyresult;
   813   /* Number of tokens to shift before error messages enabled.  */
   814   int yyerrstatus;
   815   /* Lookahead token as an internal (translated) token number.  */
   816   int yychar1 = 0;
   817 
   818   /* Three stacks and their tools:
   819      `yyss': related to states,
   820      `yyvs': related to semantic values,
   821      `yyls': related to locations.
   822 
   823      Refer to the stacks thru separate pointers, to allow yyoverflow
   824      to reallocate them elsewhere.  */
   825 
   826   /* The state stack. */
   827   short yyssa[YYINITDEPTH];
   828   short *yyss = yyssa;
   829   register short *yyssp;
   830 
   831   /* The semantic value stack.  */
   832   YYSTYPE yyvsa[YYINITDEPTH];
   833   YYSTYPE *yyvs = yyvsa;
   834   register YYSTYPE *yyvsp;
   835 
   836 #if YYLSP_NEEDED
   837   /* The location stack.  */
   838   YYLTYPE yylsa[YYINITDEPTH];
   839   YYLTYPE *yyls = yylsa;
   840   YYLTYPE *yylsp;
   841 #endif
   842 
   843 #if YYLSP_NEEDED
   844 # define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
   845 #else
   846 # define YYPOPSTACK   (yyvsp--, yyssp--)
   847 #endif
   848 
   849   YYSIZE_T yystacksize = YYINITDEPTH;
   850 
   851 
   852   /* The variables used to return semantic value and location from the
   853      action routines.  */
   854   YYSTYPE yyval;
   855 #if YYLSP_NEEDED
   856   YYLTYPE yyloc;
   857 #endif
   858 
   859   /* When reducing, the number of symbols on the RHS of the reduced
   860      rule. */
   861   int yylen;
   862 
   863   YYDPRINTF ((stderr, "Starting parse\n"));
   864 
   865   yystate = 0;
   866   yyerrstatus = 0;
   867   yynerrs = 0;
   868   yychar = YYEMPTY;             /* Cause a token to be read.  */
   869 
   870   /* Initialize stack pointers.
   871      Waste one element of value and location stack
   872      so that they stay on the same level as the state stack.
   873      The wasted elements are never initialized.  */
   874 
   875   yyssp = yyss;
   876   yyvsp = yyvs;
   877 #if YYLSP_NEEDED
   878   yylsp = yyls;
   879 #endif
   880   goto yysetstate;
   881 
   882 /*------------------------------------------------------------.
   883 | yynewstate -- Push a new state, which is found in yystate.  |
   884 `------------------------------------------------------------*/
   885  yynewstate:
   886   /* In all cases, when you get here, the value and location stacks
   887      have just been pushed. so pushing a state here evens the stacks.
   888      */
   889   yyssp++;
   890 
   891  yysetstate:
   892   *yyssp = yystate;
   893 
   894   if (yyssp >= yyss + yystacksize - 1)
   895     {
   896       /* Get the current used size of the three stacks, in elements.  */
   897       YYSIZE_T yysize = yyssp - yyss + 1;
   898 
   899 #ifdef yyoverflow
   900       {
   901         /* Give user a chance to reallocate the stack. Use copies of
   902            these so that the &'s don't force the real ones into
   903            memory.  */
   904         YYSTYPE *yyvs1 = yyvs;
   905         short *yyss1 = yyss;
   906 
   907         /* Each stack pointer address is followed by the size of the
   908            data in use in that stack, in bytes.  */
   909 # if YYLSP_NEEDED
   910         YYLTYPE *yyls1 = yyls;
   911         /* This used to be a conditional around just the two extra args,
   912            but that might be undefined if yyoverflow is a macro.  */
   913         yyoverflow ("parser stack overflow",
   914                     &yyss1, yysize * sizeof (*yyssp),
   915                     &yyvs1, yysize * sizeof (*yyvsp),
   916                     &yyls1, yysize * sizeof (*yylsp),
   917                     &yystacksize);
   918         yyls = yyls1;
   919 # else
   920         yyoverflow ("parser stack overflow",
   921                     &yyss1, yysize * sizeof (*yyssp),
   922                     &yyvs1, yysize * sizeof (*yyvsp),
   923                     &yystacksize);
   924 # endif
   925         yyss = yyss1;
   926         yyvs = yyvs1;
   927       }
   928 #else /* no yyoverflow */
   929       /* Extend the stack our own way.  */
   930       if (yystacksize >= YYMAXDEPTH)
   931         goto yyoverflowlab;
   932       yystacksize *= 2;
   933       if (yystacksize > YYMAXDEPTH)
   934         yystacksize = YYMAXDEPTH;
   935 
   936       {
   937         short *yyss1 = yyss;
   938         union yyalloc *yyptr =
   939           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
   940         if (! yyptr)
   941           goto yyoverflowlab;
   942         YYSTACK_RELOCATE (short, yyss);
   943         YYSTACK_RELOCATE (YYSTYPE, yyvs);
   944 # if YYLSP_NEEDED
   945         YYSTACK_RELOCATE (YYLTYPE, yyls);
   946 # endif
   947 # undef YYSTACK_RELOCATE
   948         if (yyss1 != yyssa)
   949           YYSTACK_FREE (yyss1);
   950       }
   951 #endif /* no yyoverflow */
   952 
   953       yyssp = yyss + yysize - 1;
   954       yyvsp = yyvs + yysize - 1;
   955 #if YYLSP_NEEDED
   956       yylsp = yyls + yysize - 1;
   957 #endif
   958 
   959       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
   960                   (unsigned long int) yystacksize));
   961 
   962       if (yyssp >= yyss + yystacksize - 1)
   963         YYABORT;
   964     }
   965 
   966   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
   967 
   968   goto yybackup;
   969 
   970 
   971 /*-----------.
   972 | yybackup.  |
   973 `-----------*/
   974 yybackup:
   975 
   976 /* Do appropriate processing given the current state.  */
   977 /* Read a lookahead token if we need one and don't already have one.  */
   978 /* yyresume: */
   979 
   980   /* First try to decide what to do without reference to lookahead token.  */
   981 
   982   yyn = yypact[yystate];
   983   if (yyn == YYFLAG)
   984     goto yydefault;
   985 
   986   /* Not known => get a lookahead token if don't already have one.  */
   987 
   988   /* yychar is either YYEMPTY or YYEOF
   989      or a valid token in external form.  */
   990 
   991   if (yychar == YYEMPTY)
   992     {
   993       YYDPRINTF ((stderr, "Reading a token: "));
   994       yychar = YYLEX;
   995     }
   996 
   997   /* Convert token to internal form (in yychar1) for indexing tables with */
   998 
   999   if (yychar <= 0)              /* This means end of input. */
  1000     {
  1001       yychar1 = 0;
  1002       yychar = YYEOF;           /* Don't call YYLEX any more */
  1003 
  1004       YYDPRINTF ((stderr, "Now at end of input.\n"));
  1005     }
  1006   else
  1007     {
  1008       yychar1 = YYTRANSLATE (yychar);
  1009 
  1010 #if YYDEBUG
  1011      /* We have to keep this `#if YYDEBUG', since we use variables
  1012         which are defined only if `YYDEBUG' is set.  */
  1013       if (yydebug)
  1014         {
  1015           YYFPRINTF (stderr, "Next token is %d (%s",
  1016                      yychar, yytname[yychar1]);
  1017           /* Give the individual parser a way to print the precise
  1018              meaning of a token, for further debugging info.  */
  1019 # ifdef YYPRINT
  1020           YYPRINT (stderr, yychar, yylval);
  1021 # endif
  1022           YYFPRINTF (stderr, ")\n");
  1023         }
  1024 #endif
  1025     }
  1026 
  1027   yyn += yychar1;
  1028   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  1029     goto yydefault;
  1030 
  1031   yyn = yytable[yyn];
  1032 
  1033   /* yyn is what to do for this token type in this state.
  1034      Negative => reduce, -yyn is rule number.
  1035      Positive => shift, yyn is new state.
  1036        New state is final state => don't bother to shift,
  1037        just return success.
  1038      0, or most negative number => error.  */
  1039 
  1040   if (yyn < 0)
  1041     {
  1042       if (yyn == YYFLAG)
  1043         goto yyerrlab;
  1044       yyn = -yyn;
  1045       goto yyreduce;
  1046     }
  1047   else if (yyn == 0)
  1048     goto yyerrlab;
  1049 
  1050   if (yyn == YYFINAL)
  1051     YYACCEPT;
  1052 
  1053   /* Shift the lookahead token.  */
  1054   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
  1055               yychar, yytname[yychar1]));
  1056 
  1057   /* Discard the token being shifted unless it is eof.  */
  1058   if (yychar != YYEOF)
  1059     yychar = YYEMPTY;
  1060 
  1061   *++yyvsp = yylval;
  1062 #if YYLSP_NEEDED
  1063   *++yylsp = yylloc;
  1064 #endif
  1065 
  1066   /* Count tokens shifted since error; after three, turn off error
  1067      status.  */
  1068   if (yyerrstatus)
  1069     yyerrstatus--;
  1070 
  1071   yystate = yyn;
  1072   goto yynewstate;
  1073 
  1074 
  1075 /*-----------------------------------------------------------.
  1076 | yydefault -- do the default action for the current state.  |
  1077 `-----------------------------------------------------------*/
  1078 yydefault:
  1079   yyn = yydefact[yystate];
  1080   if (yyn == 0)
  1081     goto yyerrlab;
  1082   goto yyreduce;
  1083 
  1084 
  1085 /*-----------------------------.
  1086 | yyreduce -- Do a reduction.  |
  1087 `-----------------------------*/
  1088 yyreduce:
  1089   /* yyn is the number of a rule to reduce with.  */
  1090   yylen = yyr2[yyn];
  1091 
  1092   /* If YYLEN is nonzero, implement the default value of the action:
  1093      `$$ = $1'.
  1094 
  1095      Otherwise, the following line sets YYVAL to the semantic value of
  1096      the lookahead token.  This behavior is undocumented and Bison
  1097      users should not rely upon it.  Assigning to YYVAL
  1098      unconditionally makes the parser a bit smaller, and it avoids a
  1099      GCC warning that YYVAL may be used uninitialized.  */
  1100   yyval = yyvsp[1-yylen];
  1101 
  1102 #if YYLSP_NEEDED
  1103   /* Similarly for the default location.  Let the user run additional
  1104      commands if for instance locations are ranges.  */
  1105   yyloc = yylsp[1-yylen];
  1106   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  1107 #endif
  1108 
  1109 #if YYDEBUG
  1110   /* We have to keep this `#if YYDEBUG', since we use variables which
  1111      are defined only if `YYDEBUG' is set.  */
  1112   if (yydebug)
  1113     {
  1114       int yyi;
  1115 
  1116       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
  1117                  yyn, yyrline[yyn]);
  1118 
  1119       /* Print the symbols being reduced, and their result.  */
  1120       for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
  1121         YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
  1122       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  1123     }
  1124 #endif
  1125 
  1126   switch (yyn) {
  1127 
  1128 case 1:
  1129 #line 87 "y-src/parse.y"
  1130 { parse_return=yyvsp[0]; }
  1131     break;
  1132 case 2:
  1133 #line 88 "y-src/parse.y"
  1134 {
  1135                 if(!parse_error)
  1136                         parse_error=PARSE_ERR;
  1137                 parse_return=0; }
  1138     break;
  1139 case 5:
  1140 #line 96 "y-src/parse.y"
  1141 {
  1142                 yyval=yyvsp[-2]; }
  1143     break;
  1144 case 6:
  1145 #line 98 "y-src/parse.y"
  1146 {
  1147                 (yyvsp[-3])->n_x.v_subs[0]=yyvsp[-1];
  1148                 (yyvsp[-3])->n_x.v_subs[1]=(struct node *)0;
  1149                 yyval=yyvsp[-3]; }
  1150     break;
  1151 case 7:
  1152 #line 102 "y-src/parse.y"
  1153 {
  1154                 (yyvsp[-5])->n_x.v_subs[0]=yyvsp[-3];
  1155                 (yyvsp[-5])->n_x.v_subs[1]=yyvsp[-1];
  1156                 yyval=yyvsp[-5]; }
  1157     break;
  1158 case 8:
  1159 #line 106 "y-src/parse.y"
  1160 {
  1161                 (yyvsp[-7])->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]);
  1162                 (yyvsp[-7])->n_x.v_subs[1]=yyvsp[-1];
  1163                 yyval=yyvsp[-7];}
  1164     break;
  1165 case 9:
  1166 #line 110 "y-src/parse.y"
  1167 {
  1168                 (yyvsp[-9])->n_x.v_subs[0]=make_list(yyvsp[-7],yyvsp[-5]);
  1169                 (yyvsp[-9])->n_x.v_subs[1]=make_list(yyvsp[-3],yyvsp[-1]);
  1170                 yyval=yyvsp[-9];}
  1171     break;
  1172 case 10:
  1173 #line 114 "y-src/parse.y"
  1174 {
  1175                 (yyvsp[-3])->n_x.v_subs[0]=(struct node *)0;
  1176                 (yyvsp[-3])->n_x.v_subs[1]=yyvsp[-1];
  1177                 yyval=yyvsp[-3]; }
  1178     break;
  1179 case 11:
  1180 #line 118 "y-src/parse.y"
  1181 {
  1182                 yyvsp[-3]->n_x.v_subs[0]=yyvsp[-1];
  1183                 yyval=yyvsp[-3]; }
  1184     break;
  1185 case 12:
  1186 #line 121 "y-src/parse.y"
  1187 {
  1188                 yyvsp[-3]->n_x.v_subs[0]=yyvsp[-1];
  1189                 yyval=yyvsp[-3]; }
  1190     break;
  1191 case 13:
  1192 #line 125 "y-src/parse.y"
  1193 {
  1194                 yyvsp[-5]->n_x.v_subs[0]=yyvsp[-3];
  1195                 yyvsp[-5]->n_x.v_subs[1]=yyvsp[-1];
  1196                 yyval=yyvsp[-5]; }
  1197     break;
  1198 case 14:
  1199 #line 129 "y-src/parse.y"
  1200 {
  1201                 yyvsp[-5]->n_x.v_subs[0]=yyvsp[-3];
  1202                 yyvsp[-5]->n_x.v_subs[1]=yyvsp[-1];
  1203                 yyval=yyvsp[-5]; }
  1204     break;
  1205 case 15:
  1206 #line 135 "y-src/parse.y"
  1207 {
  1208                 if(yyvsp[-7]->comp_value!=F_INDEX)
  1209                         parse_error=PARSE_ERR;
  1210                 yyvsp[-7]->comp_value=F_INDEX2;
  1211                 yyvsp[-7]->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]);
  1212                 yyvsp[-7]->n_x.v_subs[1]=yyvsp[-1];
  1213                 yyval=yyvsp[-7]; }
  1214     break;
  1215 case 16:
  1216 #line 142 "y-src/parse.y"
  1217 {
  1218                 if(yyvsp[-7]->comp_value!=F_INDEX)
  1219                         parse_error=PARSE_ERR;
  1220                 yyvsp[-7]->comp_value=F_INDEX2;
  1221                 yyvsp[-7]->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]);
  1222                 yyvsp[-7]->n_x.v_subs[1]=yyvsp[-1];
  1223                 yyval=yyvsp[-7]; }
  1224     break;
  1225 case 17:
  1226 #line 150 "y-src/parse.y"
  1227 {
  1228                 (yyvsp[-7])->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]);
  1229                 (yyvsp[-7])->n_x.v_subs[1]=yyvsp[-1];
  1230                 yyval=yyvsp[-7];}
  1231     break;
  1232 case 18:
  1233 #line 154 "y-src/parse.y"
  1234 {
  1235                 (yyvsp[-7])->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]);
  1236                 (yyvsp[-7])->n_x.v_subs[1]=yyvsp[-1];
  1237                 yyval=yyvsp[-7];}
  1238     break;
  1239 case 19:
  1240 #line 159 "y-src/parse.y"
  1241 {
  1242                 (yyvsp[-3])->n_x.v_subs[0]=(struct node *)0;
  1243                 (yyvsp[-3])->n_x.v_subs[1]=yyvsp[-1];
  1244                 yyval=yyvsp[-3]; }
  1245     break;
  1246 case 20:
  1247 #line 163 "y-src/parse.y"
  1248 {
  1249                 yyvsp[-3]->comp_value=IF;
  1250                 yyvsp[-3]->n_x.v_subs[0]=yyvsp[-1];
  1251                 yyvsp[-3]->n_x.v_subs[1]=yyvsp[0];
  1252                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-4];
  1253                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[-2];
  1254                 yyval=yyvsp[-3]; }
  1255     break;
  1256 case 21:
  1257 #line 174 "y-src/parse.y"
  1258 {
  1259                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1260                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1261                 yyval = yyvsp[-1]; }
  1262     break;
  1263 case 22:
  1264 #line 178 "y-src/parse.y"
  1265 {
  1266                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1267                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1268                 yyval = yyvsp[-1]; }
  1269     break;
  1270 case 23:
  1271 #line 182 "y-src/parse.y"
  1272 {
  1273                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1274                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1275                 yyval = yyvsp[-1]; }
  1276     break;
  1277 case 24:
  1278 #line 186 "y-src/parse.y"
  1279 {
  1280                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1281                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1282                 yyval = yyvsp[-1]; }
  1283     break;
  1284 case 25:
  1285 #line 190 "y-src/parse.y"
  1286 {
  1287                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1288                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1289                 yyval = yyvsp[-1]; }
  1290     break;
  1291 case 26:
  1292 #line 194 "y-src/parse.y"
  1293 {
  1294                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1295                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1296                 yyval = yyvsp[-1]; }
  1297     break;
  1298 case 27:
  1299 #line 198 "y-src/parse.y"
  1300 {
  1301                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1302                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1303                 yyval = yyvsp[-1]; }
  1304     break;
  1305 case 28:
  1306 #line 202 "y-src/parse.y"
  1307 {
  1308                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1309                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1310                 yyval = yyvsp[-1]; }
  1311     break;
  1312 case 29:
  1313 #line 206 "y-src/parse.y"
  1314 {
  1315                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1316                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1317                 yyval = yyvsp[-1]; }
  1318     break;
  1319 case 30:
  1320 #line 210 "y-src/parse.y"
  1321 {
  1322                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1323                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1324                 yyval = yyvsp[-1]; }
  1325     break;
  1326 case 31:
  1327 #line 214 "y-src/parse.y"
  1328 {
  1329                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1330                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1331                 yyval = yyvsp[-1]; }
  1332     break;
  1333 case 32:
  1334 #line 218 "y-src/parse.y"
  1335 {
  1336                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1337                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1338                 yyval = yyvsp[-1]; }
  1339     break;
  1340 case 33:
  1341 #line 222 "y-src/parse.y"
  1342 {
  1343                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2];
  1344                 yyvsp[-1]->n_x.v_subs[1]=yyvsp[0];
  1345                 yyval = yyvsp[-1]; }
  1346     break;
  1347 case 34:
  1348 #line 226 "y-src/parse.y"
  1349 {
  1350                 if(yyvsp[0]->comp_value==CONST_FLT) {
  1351                         yyvsp[0]->n_x.v_float= -(yyvsp[0]->n_x.v_float);
  1352                         /* free($1); */
  1353                         yyval=yyvsp[0];
  1354                 } else if(yyvsp[0]->comp_value==CONST_INT) {
  1355                         yyvsp[0]->n_x.v_int= -(yyvsp[0]->n_x.v_int);
  1356                         /* free($1); */
  1357                         yyval=yyvsp[0];
  1358                 } else {
  1359                         yyvsp[-1]->comp_value = NEGATE;
  1360                         yyvsp[-1]->n_x.v_subs[0]=yyvsp[0];
  1361                         yyvsp[-1]->n_x.v_subs[1]=(struct node *)0;
  1362                         yyval = yyvsp[-1];
  1363                 } }
  1364     break;
  1365 case 35:
  1366 #line 241 "y-src/parse.y"
  1367 {
  1368                 yyvsp[-1]->n_x.v_subs[0]=yyvsp[0];
  1369                 yyvsp[-1]->n_x.v_subs[1]=(struct node *)0;
  1370                 yyval = yyvsp[-1]; }
  1371     break;
  1372 case 36:
  1373 #line 246 "y-src/parse.y"
  1374 { yyval = yyvsp[-1]; }
  1375     break;
  1376 case 37:
  1377 #line 247 "y-src/parse.y"
  1378 {
  1379                 if(!parse_error)
  1380                         parse_error=NO_CLOSE;
  1381                 }
  1382     break;
  1383 case 38:
  1384 #line 255 "y-src/parse.y"
  1385 {
  1386                 if(!parse_error)
  1387                         parse_error=NO_CLOSE;
  1388                 }
  1389     break;
  1390 case 39:
  1391 #line 263 "y-src/parse.y"
  1392 { yyval = make_list(yyvsp[0], 0); }
  1393     break;
  1394 case 40:
  1395 #line 265 "y-src/parse.y"
  1396 { yyval = make_list(yyvsp[0], yyvsp[-2]); }
  1397     break;
  1398 case 43:
  1399 #line 273 "y-src/parse.y"
  1400 { yyval=make_list(yyvsp[0], 0); }
  1401     break;
  1402 case 44:
  1403 #line 275 "y-src/parse.y"
  1404 { yyval=make_list(yyvsp[0],yyvsp[-2]); }
  1405     break;
  1406 case 45:
  1407 #line 279 "y-src/parse.y"
  1408 { yyval=yyvsp[0]; }
  1409     break;
  1410 }
  1411 
  1412 #line 727 "/usr/share/bison/bison.simple"
  1413 
  1414 
  1415   yyvsp -= yylen;
  1416   yyssp -= yylen;
  1417 #if YYLSP_NEEDED
  1418   yylsp -= yylen;
  1419 #endif
  1420 
  1421 #if YYDEBUG
  1422   if (yydebug)
  1423     {
  1424       short *yyssp1 = yyss - 1;
  1425       YYFPRINTF (stderr, "state stack now");
  1426       while (yyssp1 != yyssp)
  1427         YYFPRINTF (stderr, " %d", *++yyssp1);
  1428       YYFPRINTF (stderr, "\n");
  1429     }
  1430 #endif
  1431 
  1432   *++yyvsp = yyval;
  1433 #if YYLSP_NEEDED
  1434   *++yylsp = yyloc;
  1435 #endif
  1436 
  1437   /* Now `shift' the result of the reduction.  Determine what state
  1438      that goes to, based on the state we popped back to and the rule
  1439      number reduced by.  */
  1440 
  1441   yyn = yyr1[yyn];
  1442 
  1443   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1444   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1445     yystate = yytable[yystate];
  1446   else
  1447     yystate = yydefgoto[yyn - YYNTBASE];
  1448 
  1449   goto yynewstate;
  1450 
  1451 
  1452 /*------------------------------------.
  1453 | yyerrlab -- here on detecting error |
  1454 `------------------------------------*/
  1455 yyerrlab:
  1456   /* If not already recovering from an error, report this error.  */
  1457   if (!yyerrstatus)
  1458     {
  1459       ++yynerrs;
  1460 
  1461 #ifdef YYERROR_VERBOSE
  1462       yyn = yypact[yystate];
  1463 
  1464       if (yyn > YYFLAG && yyn < YYLAST)
  1465         {
  1466           YYSIZE_T yysize = 0;
  1467           char *yymsg;
  1468           int yyx, yycount;
  1469 
  1470           yycount = 0;
  1471           /* Start YYX at -YYN if negative to avoid negative indexes in
  1472              YYCHECK.  */
  1473           for (yyx = yyn < 0 ? -yyn : 0;
  1474                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
  1475             if (yycheck[yyx + yyn] == yyx)
  1476               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
  1477           yysize += yystrlen ("parse error, unexpected ") + 1;
  1478           yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
  1479           yymsg = (char *) YYSTACK_ALLOC (yysize);
  1480           if (yymsg != 0)
  1481             {
  1482               char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
  1483               yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
  1484 
  1485               if (yycount < 5)
  1486                 {
  1487                   yycount = 0;
  1488                   for (yyx = yyn < 0 ? -yyn : 0;
  1489                        yyx < (int) (sizeof (yytname) / sizeof (char *));
  1490                        yyx++)
  1491                     if (yycheck[yyx + yyn] == yyx)
  1492                       {
  1493                         const char *yyq = ! yycount ? ", expecting " : " or ";
  1494                         yyp = yystpcpy (yyp, yyq);
  1495                         yyp = yystpcpy (yyp, yytname[yyx]);
  1496                         yycount++;
  1497                       }
  1498                 }
  1499               yyerror (yymsg);
  1500               YYSTACK_FREE (yymsg);
  1501             }
  1502           else
  1503             yyerror ("parse error; also virtual memory exhausted");
  1504         }
  1505       else
  1506 #endif /* defined (YYERROR_VERBOSE) */
  1507         yyerror ("parse error");
  1508     }
  1509   goto yyerrlab1;
  1510 
  1511 
  1512 /*--------------------------------------------------.
  1513 | yyerrlab1 -- error raised explicitly by an action |
  1514 `--------------------------------------------------*/
  1515 yyerrlab1:
  1516   if (yyerrstatus == 3)
  1517     {
  1518       /* If just tried and failed to reuse lookahead token after an
  1519          error, discard it.  */
  1520 
  1521       /* return failure if at end of input */
  1522       if (yychar == YYEOF)
  1523         YYABORT;
  1524       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
  1525                   yychar, yytname[yychar1]));
  1526       yychar = YYEMPTY;
  1527     }
  1528 
  1529   /* Else will try to reuse lookahead token after shifting the error
  1530      token.  */
  1531 
  1532   yyerrstatus = 3;              /* Each real token shifted decrements this */
  1533 
  1534   goto yyerrhandle;
  1535 
  1536 
  1537 /*-------------------------------------------------------------------.
  1538 | yyerrdefault -- current state does not do anything special for the |
  1539 | error token.                                                       |
  1540 `-------------------------------------------------------------------*/
  1541 yyerrdefault:
  1542 #if 0
  1543   /* This is wrong; only states that explicitly want error tokens
  1544      should shift them.  */
  1545 
  1546   /* If its default is to accept any token, ok.  Otherwise pop it.  */
  1547   yyn = yydefact[yystate];
  1548   if (yyn)
  1549     goto yydefault;
  1550 #endif
  1551 
  1552 
  1553 /*---------------------------------------------------------------.
  1554 | yyerrpop -- pop the current state because it cannot handle the |
  1555 | error token                                                    |
  1556 `---------------------------------------------------------------*/
  1557 yyerrpop:
  1558   if (yyssp == yyss)
  1559     YYABORT;
  1560   yyvsp--;
  1561   yystate = *--yyssp;
  1562 #if YYLSP_NEEDED
  1563   yylsp--;
  1564 #endif
  1565 
  1566 #if YYDEBUG
  1567   if (yydebug)
  1568     {
  1569       short *yyssp1 = yyss - 1;
  1570       YYFPRINTF (stderr, "Error: state stack now");
  1571       while (yyssp1 != yyssp)
  1572         YYFPRINTF (stderr, " %d", *++yyssp1);
  1573       YYFPRINTF (stderr, "\n");
  1574     }
  1575 #endif
  1576 
  1577 /*--------------.
  1578 | yyerrhandle.  |
  1579 `--------------*/
  1580 yyerrhandle:
  1581   yyn = yypact[yystate];
  1582   if (yyn == YYFLAG)
  1583     goto yyerrdefault;
  1584 
  1585   yyn += YYTERROR;
  1586   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1587     goto yyerrdefault;
  1588 
  1589   yyn = yytable[yyn];
  1590   if (yyn < 0)
  1591     {
  1592       if (yyn == YYFLAG)
  1593         goto yyerrpop;
  1594       yyn = -yyn;
  1595       goto yyreduce;
  1596     }
  1597   else if (yyn == 0)
  1598     goto yyerrpop;
  1599 
  1600   if (yyn == YYFINAL)
  1601     YYACCEPT;
  1602 
  1603   YYDPRINTF ((stderr, "Shifting error token, "));
  1604 
  1605   *++yyvsp = yylval;
  1606 #if YYLSP_NEEDED
  1607   *++yylsp = yylloc;
  1608 #endif
  1609 
  1610   yystate = yyn;
  1611   goto yynewstate;
  1612 
  1613 
  1614 /*-------------------------------------.
  1615 | yyacceptlab -- YYACCEPT comes here.  |
  1616 `-------------------------------------*/
  1617 yyacceptlab:
  1618   yyresult = 0;
  1619   goto yyreturn;
  1620 
  1621 /*-----------------------------------.
  1622 | yyabortlab -- YYABORT comes here.  |
  1623 `-----------------------------------*/
  1624 yyabortlab:
  1625   yyresult = 1;
  1626   goto yyreturn;
  1627 
  1628 /*---------------------------------------------.
  1629 | yyoverflowab -- parser overflow comes here.  |
  1630 `---------------------------------------------*/
  1631 yyoverflowlab:
  1632   yyerror ("parser stack overflow");
  1633   yyresult = 2;
  1634   /* Fall through.  */
  1635 
  1636 yyreturn:
  1637 #ifndef yyoverflow
  1638   if (yyss != yyssa)
  1639     YYSTACK_FREE (yyss);
  1640 #endif
  1641   return yyresult;
  1642 }
  1643 #line 282 "y-src/parse.y"
  1644 
  1645 
  1646 void
  1647 yyerror FUN1(char *, s)
  1648 {
  1649         if(!parse_error)
  1650                 parse_error=PARSE_ERR;
  1651 }
  1652 
  1653 YYSTYPE
  1654 make_list FUN2(YYSTYPE, car, YYSTYPE, cdr)
  1655 {
  1656         YYSTYPE ret;
  1657 
  1658         ret=(YYSTYPE)obstack_alloc(&tmp_mem,sizeof(*ret));
  1659         ret->comp_value = 0;
  1660         ret->n_x.v_subs[0]=car;
  1661         ret->n_x.v_subs[1]=cdr;
  1662         return ret;
  1663 }
  1664 
  1665 #define ERROR -1
  1666 
  1667 extern struct node *yylval;
  1668 
  1669 #ifdef __STDC__
  1670 unsigned char parse_cell_or_range (char **,struct rng *);
  1671 #else
  1672 unsigned char parse_cell_or_range ();
  1673 #endif
  1674 
  1675 int
  1676 yylex FUN0()
  1677 {
  1678         int ch;
  1679         struct node *new;
  1680         int isflt;
  1681         char *begin;
  1682         char *tmp_str;
  1683         unsigned char byte_value;
  1684         int n;
  1685 
  1686         /* unsigned char *ptr; */
  1687         int nn;
  1688         struct function *fp;
  1689         int tmp_ch;
  1690 
  1691 #ifdef TEST
  1692         if(!instr)
  1693                 return ERROR;
  1694 #endif
  1695         while(isspace(*instr))
  1696                 instr++;
  1697         ch = *instr++;
  1698         if(ch=='(' || ch==',' || ch==')')
  1699                 return ch;
  1700 
  1701         new=(struct node *)obstack_alloc(&tmp_mem,sizeof(struct node));
  1702         new->add_byte=0;
  1703         new->sub_value=0;
  1704         switch(ch) {
  1705         case 0:
  1706                 return 0;
  1707 
  1708         case '0': case '1': case '2': case '3': case '4': case '5': case '6':
  1709         case '7': case '8': case '9': case '.':
  1710                 isflt = (ch=='.');
  1711 
  1712                 begin=instr-1;
  1713                 tmp_str=instr;
  1714 
  1715                 while(isdigit(*tmp_str) || (!isflt && *tmp_str=='.' && ++isflt))
  1716                         tmp_str++;
  1717                 if(*tmp_str=='e' || *tmp_str=='E') {
  1718                         isflt=1;
  1719                         tmp_str++;
  1720                         if(*tmp_str=='-' || *tmp_str=='+')
  1721                                 tmp_str++;
  1722                         while(isdigit(*tmp_str))
  1723                                 tmp_str++;
  1724                 }
  1725                 if(isflt) {
  1726                         new->n_x.v_float=astof((char **)(&begin));
  1727                         byte_value=CONST_FLT;
  1728                 } else {
  1729                         new->n_x.v_int=astol((char **)(&begin));
  1730                         if(begin!=tmp_str) {
  1731                                 begin=instr-1;
  1732                                 new->n_x.v_float=astof((char **)(&begin));
  1733                                 byte_value=CONST_FLT;
  1734                         } else
  1735                                 byte_value=CONST_INT;
  1736                 }
  1737                 ch=L_CONST;
  1738                 instr=begin;
  1739                 break;
  1740 
  1741         case '"':
  1742                 begin=instr;
  1743                 while(*instr && *instr!='"') {
  1744                         if(*instr=='\\' && instr[1])
  1745                                 instr++;
  1746                         instr++;
  1747                 }
  1748                 if(!*instr) {
  1749                         parse_error=NO_QUOTE;
  1750                         return ERROR;
  1751                 }
  1752                 tmp_str=new->n_x.v_string=(char *)ck_malloc(1+instr-begin);
  1753                 while(begin!=instr) {
  1754                         unsigned char n;
  1755 
  1756                         if(*begin=='\\') {
  1757                                 begin++;
  1758                                 if(begin[0]>='0' && begin[0]<='7') {
  1759                                         if(begin[1]>='0' && begin[1]<='7') {
  1760                                                 if(begin[2]>='0' && begin[2]<='7') {
  1761                                                         n=(begin[2]-'0') + (010 * (begin[1]-'0')) + ( 0100 * (begin[0]-'0'));
  1762                                                         begin+=3;
  1763                                                 } else {
  1764                                                         n=(begin[1]-'0') + (010 * (begin[0]-'0'));
  1765                                                         begin+=2;
  1766                                                 }
  1767                                         } else {
  1768                                                 n=begin[0]-'0';
  1769                                                 begin++;
  1770                                         }
  1771                                 } else
  1772                                         n= *begin++;
  1773                                 *tmp_str++= n;
  1774                         } else
  1775                                 *tmp_str++= *begin++;
  1776                 }
  1777                 *tmp_str='\0';
  1778                 instr++;
  1779                 byte_value=CONST_STR;
  1780                 ch=L_CONST;
  1781                 break;
  1782 
  1783         case '+':       case '-':
  1784 
  1785         case '*':       case '/':       case '%':       case '&':
  1786         /* case '|': */ case '^':       case '=':
  1787 
  1788         case '?':
  1789         {
  1790                 unsigned char *ptr;
  1791 
  1792                 for(ptr= fnin;*ptr;ptr++)
  1793                         if(the_funs[*ptr].fn_str[0]==ch)
  1794                                 break;
  1795 #ifdef TEST
  1796                 if(!*ptr)
  1797                         panic("Can't find fnin[] entry for '%c'",ch);
  1798 #endif
  1799                 byte_value= *ptr;
  1800         }
  1801                 break;
  1802 
  1803         case ':':
  1804                 byte_value=IF;
  1805                 break;
  1806 
  1807         case '!':
  1808         case '<':
  1809         case '>':
  1810                 if(*instr!='=') {
  1811                         byte_value = (ch=='<') ? LESS : (ch=='>') ? GREATER : NOT;
  1812                         break;
  1813                 }
  1814                 instr++;
  1815                 byte_value = (ch=='<') ? LESSEQ : (ch=='>') ? GREATEQ : NOTEQUAL;
  1816                 ch = (ch=='<') ? LE : (ch=='>') ? GE : NE;
  1817                 break;
  1818 
  1819         case '\'':
  1820         case ';':
  1821         case '[':
  1822         case '\\':
  1823         case ']':
  1824         case '`':
  1825         case '{':
  1826         case '}':
  1827         case '~':
  1828         bad_chr:
  1829                 parse_error=BAD_CHAR;
  1830                 return ERROR;
  1831 
  1832         case '#':
  1833                 begin=instr-1;
  1834                 while(*instr && (isalnum(*instr) || *instr=='_'))
  1835                         instr++;
  1836                 ch= *instr;
  1837                 *instr=0;
  1838                 if(!stricmp(begin,tname))
  1839                         byte_value=F_TRUE;
  1840                 else if(!stricmp(begin,fname))
  1841                         byte_value=F_FALSE;
  1842                 else if(!stricmp(begin,iname) && (begin[4]==0 || !stricmp(begin+4,"inity")))
  1843                         byte_value=CONST_INF;
  1844                 else if(!stricmp(begin,mname) ||
  1845                         !stricmp(begin,"#ninf"))
  1846                         byte_value=CONST_NINF;
  1847                 else if(!stricmp(begin,nname) ||
  1848                         !stricmp(begin,"#nan"))
  1849                         byte_value=CONST_NAN;
  1850                 else {
  1851                         for(n=1;n<=ERR_MAX;n++)
  1852                                 if(!stricmp(begin,ename[n]))
  1853                                         break;
  1854                         if(n>ERR_MAX)
  1855                                 n=BAD_CHAR;
  1856                         new->n_x.v_int=n;
  1857                         byte_value=CONST_ERR;
  1858                 }
  1859                 *instr=ch;
  1860                 ch=L_CONST;
  1861                 break;
  1862 
  1863         default:
  1864                 if(!a0 && (ch=='@' || ch=='$'))
  1865                    goto bad_chr;
  1866 
  1867                 if(a0 && ch=='@') {
  1868                         begin=instr;
  1869                         while(*instr && (isalpha(*instr) || isdigit(*instr) || *instr=='_'))
  1870                                 instr++;
  1871                         n=instr-begin;
  1872                 } else {
  1873                         begin=instr-1;
  1874                         byte_value=parse_cell_or_range(&begin,&(new->n_x.v_rng));
  1875                         if(byte_value) {
  1876                                 if((byte_value& ~0x3)==R_CELL)
  1877                                         ch=L_CELL;
  1878                                 else
  1879                                         ch=L_RANGE;
  1880                                 instr=begin;
  1881                                 break;
  1882                         }
  1883 
  1884                         while(*instr && (isalpha(*instr) || isdigit(*instr) || *instr=='_'))
  1885                                 instr++;
  1886 
  1887                         n=instr-begin;
  1888                         while(isspace(*instr))
  1889                                 instr++;
  1890 
  1891                         if(*instr!='(') {
  1892                                 ch=L_VAR;
  1893                                 byte_value=VAR;
  1894                                 new->n_x.v_var=find_or_make_var(begin,n);
  1895                                 break;
  1896                         }
  1897                 }
  1898                 tmp_ch=begin[n];
  1899                 begin[n]='\0';
  1900                 fp=hash_find(parse_hash,begin);
  1901                 begin[n]=tmp_ch;
  1902                 byte_value= ERROR;
  1903                 if(!fp) {
  1904                         parse_error=BAD_FUNC;
  1905                         return ERROR;
  1906                 }
  1907 
  1908                 if(fp>=the_funs && fp<=&the_funs[USR1])
  1909                         byte_value=fp-the_funs;
  1910                 else {
  1911                         for(nn=0;nn<n_usr_funs;nn++) {
  1912                                 if(fp>=&usr_funs[nn][0] && fp<=&usr_funs[nn][usr_n_funs[nn]]) {
  1913                                         byte_value=USR1+nn;
  1914                                         new->sub_value=fp-&usr_funs[nn][0];
  1915                                         break;
  1916                                 }
  1917                         }
  1918 #ifdef TEST
  1919                         if(nn==n_usr_funs) {
  1920                                 io_error_msg("Couldn't turn fp into a ##");
  1921                                 parse_error=BAD_FUNC;
  1922                                 return ERROR;
  1923                         }
  1924 #endif
  1925                 }
  1926 
  1927                 if(fp->fn_argn&X_J)
  1928                         ch= byte_value==F_IF ? L_FN3 : L_FN2;
  1929                 else if(fp->fn_argt[0]=='R' || fp->fn_argt[0]=='E')
  1930                         ch=L_FN1R-1+fp->fn_argn-X_A0;
  1931                 else
  1932                         ch=L_FN0 + fp->fn_argn-X_A0;
  1933 
  1934                 break;
  1935         }
  1936         /* new->node_type=ch; */
  1937         new->comp_value=byte_value;
  1938         yylval=new;
  1939         return ch;
  1940 }
  1941 
  1942 /* Return value is
  1943         0 if it doesn't look like a cell or a range,
  1944         R_CELL if it is a cell (ptr now points past the characters, lr and lc hold the row and col of the cell)
  1945         RANGE if it is a range (ptr points past the chars)
  1946  */
  1947 unsigned char
  1948 parse_cell_or_range FUN2(char **,ptr, struct rng *,retp)
  1949 {
  1950         if(a0) {
  1951                 unsigned tmpc,tmpr;
  1952                 char *p;
  1953                 int abz = ROWREL|COLREL;
  1954 
  1955                 p= *ptr;
  1956                 tmpc=0;
  1957                 if(*p=='$') {
  1958                         abz-=COLREL;
  1959                         p++;
  1960                 }
  1961                 if(!isalpha(*p))
  1962                         return 0;
  1963                 tmpc=str_to_col(&p);
  1964                 if(tmpc<MIN_COL || tmpc>MAX_COL)
  1965                         return 0;
  1966                 if(*p=='$') {
  1967                         abz-=ROWREL;
  1968                         p++;
  1969                 }
  1970                 if(!isdigit(*p))
  1971                         return 0;
  1972                 for(tmpr=0;isdigit(*p);p++)
  1973                         tmpr=tmpr*10 + *p - '0';
  1974 
  1975                 if(tmpr<MIN_ROW || tmpr>MAX_ROW)
  1976                         return 0;
  1977 
  1978                 if(*p==':' || *p=='.') {
  1979                         unsigned tmpc1,tmpr1;
  1980 
  1981                         abz = ((abz&COLREL) ? LCREL : 0)|((abz&ROWREL) ? LRREL : 0)|HRREL|HCREL;
  1982                         p++;
  1983                         if(*p=='$') {
  1984                                 abz-=HCREL;
  1985                                 p++;
  1986                         }
  1987                         if(!isalpha(*p))
  1988                                 return 0;
  1989                         tmpc1=str_to_col(&p);
  1990                         if(tmpc1<MIN_COL || tmpc1>MAX_COL)
  1991                                 return 0;
  1992                         if(*p=='$') {
  1993                                 abz-=HRREL;
  1994                                 p++;
  1995                         }
  1996                         if(!isdigit(*p))
  1997                                 return 0;
  1998                         for(tmpr1=0;isdigit(*p);p++)
  1999                                 tmpr1=tmpr1*10 + *p - '0';
  2000                         if(tmpr1<MIN_ROW || tmpr1>MAX_ROW)
  2001                                 return 0;
  2002 
  2003                         if(tmpr<tmpr1) {
  2004                                 retp->lr=tmpr;
  2005                                 retp->hr=tmpr1;
  2006                         } else {
  2007                                 retp->lr=tmpr1;
  2008                                 retp->hr=tmpr;
  2009                         }
  2010                         if(tmpc<tmpc1) {
  2011                                 retp->lc=tmpc;
  2012                                 retp->hc=tmpc1;
  2013                         } else {
  2014                                 retp->lc=tmpc1;
  2015                                 retp->hc=tmpc;
  2016                         }
  2017                         *ptr= p;
  2018                         return RANGE | abz;
  2019                 }
  2020                 retp->lr = retp->hr = tmpr;
  2021                 retp->lc = retp->hc = tmpc;
  2022                 *ptr=p;
  2023                 return R_CELL | abz;
  2024         } else {
  2025                 char *p;
  2026                 unsigned char retr;
  2027                 unsigned char retc;
  2028                 int ended;
  2029                 long num;
  2030                 CELLREF tmp;
  2031 
  2032 #define CK_ABS_R(x)     if((x)<MIN_ROW || (x)>MAX_ROW)  \
  2033                                 return 0;               \
  2034                         else
  2035 
  2036 #define CK_REL_R(x)     if(   ((x)>0 && MAX_ROW-(x)<cur_row)    \
  2037                            || ((x)<0 && MIN_ROW-(x)>cur_row))   \
  2038                                 return 0;                       \
  2039                         else
  2040 
  2041 #define CK_ABS_C(x)     if((x)<MIN_COL || (x)>MAX_COL)  \
  2042                                 return 0;               \
  2043                         else
  2044 
  2045 #define CK_REL_C(x)     if(   ((x)>0 && MAX_COL-(x)<cur_col)    \
  2046                            || ((x)<0 && MIN_COL-(x)>cur_col))   \
  2047                                 return 0;                       \
  2048                         else
  2049 
  2050 #define MAYBEREL(p) (*(p)=='[' && (isdigit((p)[1]) || (((p)[1]=='+' || (p)[1]=='-') && isdigit((p)[2]))))
  2051 
  2052                 p= *ptr;
  2053                 retr=0;
  2054                 retc=0;
  2055                 ended=0;
  2056                 while(ended==0) {
  2057                         switch(*p) {
  2058                         case 'r':
  2059                         case 'R':
  2060                                 if(retr) {
  2061                                         ended++;
  2062                                         break;
  2063                                 }
  2064                                 p++;
  2065                                 retr=R_CELL;
  2066                                 if(isdigit(*p)) {
  2067                                         num=astol(&p);
  2068                                         CK_ABS_R(num);
  2069                                         retp->lr= retp->hr=num;
  2070                                 } else if(MAYBEREL(p)) {
  2071                                         p++;
  2072                                         num=astol(&p);
  2073                                         CK_REL_R(num);
  2074                                         retp->lr= retp->hr=num+cur_row;
  2075                                         retr|=ROWREL;
  2076                                         if(*p==':') {
  2077                                                 retr=RANGE|LRREL|HRREL;
  2078                                                 p++;
  2079                                                 num=astol(&p);
  2080                                                 CK_REL_R(num);
  2081                                                 retp->hr=num+cur_row;
  2082                                         }
  2083                                         if(*p++!=']')
  2084                                                 return 0;
  2085                                 } else if(retc || *p=='c' || *p=='C') {
  2086                                         retr|=ROWREL;
  2087                                         retp->lr= retp->hr=cur_row;
  2088                                 } else
  2089                                         return 0;
  2090                                 if(*p==':' && retr!=(RANGE|LRREL|HRREL)) {
  2091                                         retr= (retr&ROWREL) ? RANGE|LRREL : RANGE;
  2092                                         p++;
  2093                                         if(isdigit(*p)) {
  2094                                                 num=astol(&p);
  2095                                                 CK_ABS_R(num);
  2096                                                 retp->hr=num;
  2097                                         } else if(MAYBEREL(p)) {
  2098                                                 p++;
  2099                                                 num=astol(&p);
  2100                                                 CK_REL_R(num);
  2101                                                 retp->hr=num+cur_row;
  2102                                                 retr|=HRREL;
  2103                                                 if(*p++!=']')
  2104                                                         return 0;
  2105                                         } else
  2106                                                 return 0;
  2107                                 }
  2108 
  2109                                 if(retc)
  2110                                         ended++;
  2111                                 break;
  2112 
  2113                         case 'c':
  2114                         case 'C':
  2115                                 if(retc) {
  2116                                         ended++;
  2117                                         break;
  2118                                 }
  2119                                 p++;
  2120                                 retc=R_CELL;
  2121                                 if(isdigit(*p)) {
  2122                                         num=astol(&p);
  2123                                         CK_ABS_C(num);
  2124                                         retp->lc= retp->hc=num;
  2125                                 } else if(MAYBEREL(p)) {
  2126                                         p++;
  2127                                         num=astol(&p);
  2128                                         CK_REL_C(num);
  2129                                         retp->lc= retp->hc=num+cur_col;
  2130                                         retc|=COLREL;
  2131                                         if(*p==':') {
  2132                                                 retc=RANGE|LCREL|HCREL;
  2133                                                 p++;
  2134                                                 num=astol(&p);
  2135                                                 CK_REL_C(num);
  2136                                                 retp->hc=num+cur_col;
  2137                                         }
  2138                                         if(*p++!=']')
  2139                                                 return 0;
  2140                                 } else if(retr || *p=='r' || *p=='R') {
  2141                                         retc|=COLREL;
  2142                                         retp->lc= retp->hc=cur_col;
  2143                                 } else
  2144                                         return 0;
  2145                                 if(*p==':' && retc!=(RANGE|LCREL|HCREL)) {
  2146                                         retc= (retc&COLREL) ? RANGE|LCREL : RANGE;
  2147                                         p++;
  2148                                         if(isdigit(*p)) {
  2149                                                 num=astol(&p);
  2150                                                 CK_ABS_C(num);
  2151                                                 retp->hc=num;
  2152                                         } else if(MAYBEREL(p)) {
  2153                                                 p++;
  2154                                                 num=astol(&p);
  2155                                                 CK_REL_C(num);
  2156                                                 retp->hc=num+cur_col;
  2157                                                 retc|=HCREL;
  2158                                                 if(*p++!=']')
  2159                                                         return 0;
  2160                                         } else
  2161                                                 return 0;
  2162                                 }
  2163 
  2164                                 if(retr)
  2165                                         ended++;
  2166                                 break;
  2167                         default:
  2168                                 if(retr) {
  2169                                         *ptr=p;
  2170                                         retp->lc=MIN_COL;
  2171                                         retp->hc=MAX_COL;
  2172                                         if((retr|ROWREL)==(R_CELL|ROWREL))
  2173                                                 return (retr&ROWREL) ? (RANGE|LRREL|HRREL) : RANGE;
  2174                                         else
  2175                                                 return retr;
  2176                                 } else if(retc) {
  2177                                         *ptr=p;
  2178                                         retp->lr=MIN_ROW;
  2179                                         retp->hr=MAX_COL;
  2180                                         if((retc|COLREL)==(R_CELL|COLREL))
  2181                                                 return (retc&COLREL) ? (RANGE|LCREL|HCREL) : RANGE;
  2182                                         else
  2183                                                 return retc;
  2184                                 }
  2185                                 return 0;
  2186                         }
  2187                 }
  2188                 if(!retr || !retc)
  2189                         return 0;
  2190                 *ptr=p;
  2191                 if(retp->lr>retp->hr)
  2192                         tmp=retp->lr,retp->lr=retp->hr,retp->hr=tmp;
  2193                 if(retp->lc>retp->hc)
  2194                         tmp=retp->lc,retp->lc=retp->hc,retp->hc=tmp;
  2195 
  2196                 if((retr|ROWREL)==(R_CELL|ROWREL)) {
  2197                         if((retc|COLREL)==(R_CELL|COLREL))
  2198                                 return retr|retc;
  2199                         return (retr&ROWREL) ? (retc|LRREL|HRREL) : retc;
  2200                 }
  2201                 if((retc|COLREL)==(R_CELL|COLREL))
  2202                         return (retc&COLREL) ? (retr|LCREL|HCREL) : retr;
  2203                 return retr|retc;
  2204         }
  2205 }
  2206 
  2207 int
  2208 str_to_col FUN1(char **,str)
  2209 {
  2210         int ret;
  2211         char c,cc,ccc;
  2212 #if MAX_COL>702
  2213         char cccc;
  2214 #endif
  2215 
  2216         ret=0;
  2217         c=str[0][0];
  2218         if(!isalpha((cc=str[0][1]))) {
  2219                 (*str)++;
  2220                 return MIN_COL + (isupper(c) ? c-'A' : c-'a');
  2221         }
  2222         if(!isalpha((ccc=str[0][2]))) {
  2223                 (*str)+=2;
  2224                 return MIN_COL+26 + (isupper(c) ? c-'A' : c-'a')*26 + (isupper(cc) ? cc-'A' : cc-'a');
  2225         }
  2226 #if MAX_COL>702
  2227         if(!isalpha((cccc=str[0][3]))) {
  2228                 (*str)+=3;
  2229                 return MIN_COL+702 + (isupper(c) ? c-'A' : c-'a')*26*26 + (isupper(cc) ? cc-'A' : cc-'a')*26 + (isupper(ccc) ? ccc-'A' : ccc-'a');
  2230         }
  2231         if(!isalpha(str[0][4])) {
  2232                 (*str)+=4;
  2233                 return MIN_COL+18278 + (isupper(c) ? c-'A' : c-'a')*26*26*26 + (isupper(cc) ? cc-'A' : cc-'a')*26*26 + (isupper(ccc) ? ccc-'A' : ccc-'a')*26 + (isupper(cccc) ? cccc-'A' : cccc-'a');
  2234         }
  2235 #endif
  2236         return 0;
  2237 }

/* [<][>][^][v][top][bottom][index][help] */