LCOV - code coverage report
Current view: directory - ogr - swq_parser.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 131 109 83.2 %
Date: 2012-12-26 Functions: 2 2 100.0 %

       1                 : 
       2                 : /* A Bison parser, made by GNU Bison 2.4.1.  */
       3                 : 
       4                 : /* Skeleton implementation for Bison's Yacc-like parsers in C
       5                 :    
       6                 :       Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
       7                 :    Free Software Foundation, Inc.
       8                 :    
       9                 :    This program is free software: you can redistribute it and/or modify
      10                 :    it under the terms of the GNU General Public License as published by
      11                 :    the Free Software Foundation, either version 3 of the License, or
      12                 :    (at your option) any later version.
      13                 :    
      14                 :    This program is distributed in the hope that it will be useful,
      15                 :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      16                 :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17                 :    GNU General Public License for more details.
      18                 :    
      19                 :    You should have received a copy of the GNU General Public License
      20                 :    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
      21                 : 
      22                 : /* As a special exception, you may create a larger work that contains
      23                 :    part or all of the Bison parser skeleton and distribute that work
      24                 :    under terms of your choice, so long as that work isn't itself a
      25                 :    parser generator using the skeleton or a modified version thereof
      26                 :    as a parser skeleton.  Alternatively, if you modify or redistribute
      27                 :    the parser skeleton itself, you may (at your option) remove this
      28                 :    special exception, which will cause the skeleton and the resulting
      29                 :    Bison output files to be licensed under the GNU General Public
      30                 :    License without this special exception.
      31                 :    
      32                 :    This special exception was added by the Free Software Foundation in
      33                 :    version 2.2 of Bison.  */
      34                 : 
      35                 : /* C LALR(1) parser skeleton written by Richard Stallman, by
      36                 :    simplifying the original so-called "semantic" parser.  */
      37                 : 
      38                 : /* All symbols defined below should begin with yy or YY, to avoid
      39                 :    infringing on user name space.  This should be done even for local
      40                 :    variables, as they might otherwise be expanded by user macros.
      41                 :    There are some unavoidable exceptions within include files to
      42                 :    define necessary library symbols; they are noted "INFRINGES ON
      43                 :    USER NAME SPACE" below.  */
      44                 : 
      45                 : /* Identify Bison output.  */
      46                 : #define YYBISON 1
      47                 : 
      48                 : /* Bison version.  */
      49                 : #define YYBISON_VERSION "2.4.1"
      50                 : 
      51                 : /* Skeleton name.  */
      52                 : #define YYSKELETON_NAME "yacc.c"
      53                 : 
      54                 : /* Pure parsers.  */
      55                 : #define YYPURE 1
      56                 : 
      57                 : /* Push parsers.  */
      58                 : #define YYPUSH 0
      59                 : 
      60                 : /* Pull parsers.  */
      61                 : #define YYPULL 1
      62                 : 
      63                 : /* Using locations.  */
      64                 : #define YYLSP_NEEDED 0
      65                 : 
      66                 : /* Substitute the variable and function names.  */
      67                 : #define yyparse         swqparse
      68                 : #define yylex           swqlex
      69                 : #define yyerror         swqerror
      70                 : #define yylval          swqlval
      71                 : #define yychar          swqchar
      72                 : #define yydebug         swqdebug
      73                 : #define yynerrs         swqnerrs
      74                 : 
      75                 : 
      76                 : /* Copy the first part of user declarations.  */
      77                 : 
      78                 : /* Line 189 of yacc.c  */
      79                 : #line 1 "swq_parser.y"
      80                 : 
      81                 : /******************************************************************************
      82                 :  *
      83                 :  * Component: OGR SQL Engine
      84                 :  * Purpose: expression and select parser grammar.
      85                 :  *          Requires Bison 2.4.0 or newer to process.  Use "make parser" target.
      86                 :  * Author: Frank Warmerdam <warmerdam@pobox.com>
      87                 :  * 
      88                 :  ******************************************************************************
      89                 :  * Copyright (C) 2010 Frank Warmerdam <warmerdam@pobox.com>
      90                 :  *
      91                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      92                 :  * copy of this software and associated documentation files (the "Software"),
      93                 :  * to deal in the Software without restriction, including without limitation
      94                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      95                 :  * and/or sell copies of the Software, and to permit persons to whom the
      96                 :  * Software is furnished to do so, subject to the following conditions:
      97                 :  *
      98                 :  * The above copyright notice and this permission notice shall be included
      99                 :  * in all copies or substantial portions of the Software.
     100                 :  *
     101                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     102                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     103                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
     104                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     105                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     106                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     107                 :  * DEALINGS IN THE SOFTWARE.
     108                 :  ****************************************************************************/
     109                 : 
     110                 : 
     111                 : #include "cpl_conv.h"
     112                 : #include "cpl_string.h"
     113                 : #include "swq.h"
     114                 : 
     115                 : #define YYSTYPE  swq_expr_node*
     116                 : 
     117                 : /* Defining YYSTYPE_IS_TRIVIAL is needed because the parser is generated as a C++ file. */ 
     118                 : /* See http://www.gnu.org/s/bison/manual/html_node/Memory-Management.html that suggests */ 
     119                 : /* increase YYINITDEPTH instead, but this will consume memory. */ 
     120                 : /* Setting YYSTYPE_IS_TRIVIAL overcomes this limitation, but might be fragile because */ 
     121                 : /* it appears to be a non documented feature of Bison */ 
     122                 : #define YYSTYPE_IS_TRIVIAL 1
     123                 : 
     124                 : static void swqerror( swq_parse_context *context, const char *msg )
     125                 : {
     126                 :     CPLError( CE_Failure, CPLE_AppDefined, 
     127                 :               "SQL Expression Parsing Error: %s", msg );
     128                 : }
     129                 : 
     130                 : 
     131                 : 
     132                 : /* Line 189 of yacc.c  */
     133                 : #line 134 "swq_parser.cpp"
     134                 : 
     135                 : /* Enabling traces.  */
     136                 : #ifndef YYDEBUG
     137                 : # define YYDEBUG 0
     138                 : #endif
     139                 : 
     140                 : /* Enabling verbose error messages.  */
     141                 : #ifdef YYERROR_VERBOSE
     142                 : # undef YYERROR_VERBOSE
     143                 : # define YYERROR_VERBOSE 1
     144                 : #else
     145                 : # define YYERROR_VERBOSE 0
     146                 : #endif
     147                 : 
     148                 : /* Enabling the token table.  */
     149                 : #ifndef YYTOKEN_TABLE
     150                 : # define YYTOKEN_TABLE 0
     151                 : #endif
     152                 : 
     153                 : 
     154                 : /* Tokens.  */
     155                 : #ifndef YYTOKENTYPE
     156                 : # define YYTOKENTYPE
     157                 :    /* Put the tokens into the symbol table, so that GDB and other debuggers
     158                 :       know about them.  */
     159                 :    enum yytokentype {
     160                 :      SWQT_NUMBER = 258,
     161                 :      SWQT_STRING = 259,
     162                 :      SWQT_IDENTIFIER = 260,
     163                 :      SWQT_IN = 261,
     164                 :      SWQT_LIKE = 262,
     165                 :      SWQT_ESCAPE = 263,
     166                 :      SWQT_BETWEEN = 264,
     167                 :      SWQT_NULL = 265,
     168                 :      SWQT_IS = 266,
     169                 :      SWQT_SELECT = 267,
     170                 :      SWQT_LEFT = 268,
     171                 :      SWQT_JOIN = 269,
     172                 :      SWQT_WHERE = 270,
     173                 :      SWQT_ON = 271,
     174                 :      SWQT_ORDER = 272,
     175                 :      SWQT_BY = 273,
     176                 :      SWQT_FROM = 274,
     177                 :      SWQT_AS = 275,
     178                 :      SWQT_ASC = 276,
     179                 :      SWQT_DESC = 277,
     180                 :      SWQT_DISTINCT = 278,
     181                 :      SWQT_CAST = 279,
     182                 :      SWQT_UNION = 280,
     183                 :      SWQT_ALL = 281,
     184                 :      SWQT_LOGICAL_START = 282,
     185                 :      SWQT_VALUE_START = 283,
     186                 :      SWQT_SELECT_START = 284,
     187                 :      SWQT_NOT = 285,
     188                 :      SWQT_OR = 286,
     189                 :      SWQT_AND = 287,
     190                 :      SWQT_UMINUS = 288
     191                 :    };
     192                 : #endif
     193                 : 
     194                 : 
     195                 : 
     196                 : #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
     197                 : typedef int YYSTYPE;
     198                 : # define YYSTYPE_IS_TRIVIAL 1
     199                 : # define yystype YYSTYPE /* obsolescent; will be withdrawn */
     200                 : # define YYSTYPE_IS_DECLARED 1
     201                 : #endif
     202                 : 
     203                 : 
     204                 : /* Copy the second part of user declarations.  */
     205                 : 
     206                 : 
     207                 : /* Line 264 of yacc.c  */
     208                 : #line 209 "swq_parser.cpp"
     209                 : 
     210                 : #ifdef short
     211                 : # undef short
     212                 : #endif
     213                 : 
     214                 : #ifdef YYTYPE_UINT8
     215                 : typedef YYTYPE_UINT8 yytype_uint8;
     216                 : #else
     217                 : typedef unsigned char yytype_uint8;
     218                 : #endif
     219                 : 
     220                 : #ifdef YYTYPE_INT8
     221                 : typedef YYTYPE_INT8 yytype_int8;
     222                 : #elif (defined __STDC__ || defined __C99__FUNC__ \
     223                 :      || defined __cplusplus || defined _MSC_VER)
     224                 : typedef signed char yytype_int8;
     225                 : #else
     226                 : typedef short int yytype_int8;
     227                 : #endif
     228                 : 
     229                 : #ifdef YYTYPE_UINT16
     230                 : typedef YYTYPE_UINT16 yytype_uint16;
     231                 : #else
     232                 : typedef unsigned short int yytype_uint16;
     233                 : #endif
     234                 : 
     235                 : #ifdef YYTYPE_INT16
     236                 : typedef YYTYPE_INT16 yytype_int16;
     237                 : #else
     238                 : typedef short int yytype_int16;
     239                 : #endif
     240                 : 
     241                 : #ifndef YYSIZE_T
     242                 : # ifdef __SIZE_TYPE__
     243                 : #  define YYSIZE_T __SIZE_TYPE__
     244                 : # elif defined size_t
     245                 : #  define YYSIZE_T size_t
     246                 : # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
     247                 :      || defined __cplusplus || defined _MSC_VER)
     248                 : #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
     249                 : #  define YYSIZE_T size_t
     250                 : # else
     251                 : #  define YYSIZE_T unsigned int
     252                 : # endif
     253                 : #endif
     254                 : 
     255                 : #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
     256                 : 
     257                 : #ifndef YY_
     258                 : # if YYENABLE_NLS
     259                 : #  if ENABLE_NLS
     260                 : #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
     261                 : #   define YY_(msgid) dgettext ("bison-runtime", msgid)
     262                 : #  endif
     263                 : # endif
     264                 : # ifndef YY_
     265                 : #  define YY_(msgid) msgid
     266                 : # endif
     267                 : #endif
     268                 : 
     269                 : /* Suppress unused-variable warnings by "using" E.  */
     270                 : #if ! defined lint || defined __GNUC__
     271                 : # define YYUSE(e) ((void) (e))
     272                 : #else
     273                 : # define YYUSE(e) /* empty */
     274                 : #endif
     275                 : 
     276                 : /* Identity function, used to suppress warnings about constant conditions.  */
     277                 : #ifndef lint
     278                 : # define YYID(n) (n)
     279                 : #else
     280                 : #if (defined __STDC__ || defined __C99__FUNC__ \
     281                 :      || defined __cplusplus || defined _MSC_VER)
     282                 : static int
     283                 : YYID (int yyi)
     284                 : #else
     285                 : static int
     286                 : YYID (yyi)
     287                 :     int yyi;
     288                 : #endif
     289                 : {
     290                 :   return yyi;
     291                 : }
     292                 : #endif
     293                 : 
     294                 : #if ! defined yyoverflow || YYERROR_VERBOSE
     295                 : 
     296                 : /* The parser invokes alloca or malloc; define the necessary symbols.  */
     297                 : 
     298                 : # ifdef YYSTACK_USE_ALLOCA
     299                 : #  if YYSTACK_USE_ALLOCA
     300                 : #   ifdef __GNUC__
     301                 : #    define YYSTACK_ALLOC __builtin_alloca
     302                 : #   elif defined __BUILTIN_VA_ARG_INCR
     303                 : #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
     304                 : #   elif defined _AIX
     305                 : #    define YYSTACK_ALLOC __alloca
     306                 : #   elif defined _MSC_VER
     307                 : #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
     308                 : #    define alloca _alloca
     309                 : #   else
     310                 : #    define YYSTACK_ALLOC alloca
     311                 : #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     312                 :      || defined __cplusplus || defined _MSC_VER)
     313                 : #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
     314                 : #     ifndef _STDLIB_H
     315                 : #      define _STDLIB_H 1
     316                 : #     endif
     317                 : #    endif
     318                 : #   endif
     319                 : #  endif
     320                 : # endif
     321                 : 
     322                 : # ifdef YYSTACK_ALLOC
     323                 :    /* Pacify GCC's `empty if-body' warning.  */
     324                 : #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
     325                 : #  ifndef YYSTACK_ALLOC_MAXIMUM
     326                 :     /* The OS might guarantee only one guard page at the bottom of the stack,
     327                 :        and a page size can be as small as 4096 bytes.  So we cannot safely
     328                 :        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
     329                 :        to allow for a few compiler-allocated temporary stack slots.  */
     330                 : #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
     331                 : #  endif
     332                 : # else
     333                 : #  define YYSTACK_ALLOC YYMALLOC
     334                 : #  define YYSTACK_FREE YYFREE
     335                 : #  ifndef YYSTACK_ALLOC_MAXIMUM
     336                 : #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
     337                 : #  endif
     338                 : #  if (defined __cplusplus && ! defined _STDLIB_H \
     339                 :        && ! ((defined YYMALLOC || defined malloc) \
     340                 :        && (defined YYFREE || defined free)))
     341                 : #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
     342                 : #   ifndef _STDLIB_H
     343                 : #    define _STDLIB_H 1
     344                 : #   endif
     345                 : #  endif
     346                 : #  ifndef YYMALLOC
     347                 : #   define YYMALLOC malloc
     348                 : #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     349                 :      || defined __cplusplus || defined _MSC_VER)
     350                 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
     351                 : #   endif
     352                 : #  endif
     353                 : #  ifndef YYFREE
     354                 : #   define YYFREE free
     355                 : #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     356                 :      || defined __cplusplus || defined _MSC_VER)
     357                 : void free (void *); /* INFRINGES ON USER NAME SPACE */
     358                 : #   endif
     359                 : #  endif
     360                 : # endif
     361                 : #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
     362                 : 
     363                 : 
     364                 : #if (! defined yyoverflow \
     365                 :      && (! defined __cplusplus \
     366                 :    || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
     367                 : 
     368                 : /* A type that is properly aligned for any stack member.  */
     369                 : union yyalloc
     370                 : {
     371                 :   yytype_int16 yyss_alloc;
     372                 :   YYSTYPE yyvs_alloc;
     373                 : };
     374                 : 
     375                 : /* The size of the maximum gap between one aligned stack and the next.  */
     376                 : # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
     377                 : 
     378                 : /* The size of an array large to enough to hold all stacks, each with
     379                 :    N elements.  */
     380                 : # define YYSTACK_BYTES(N) \
     381                 :      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
     382                 :       + YYSTACK_GAP_MAXIMUM)
     383                 : 
     384                 : /* Copy COUNT objects from FROM to TO.  The source and destination do
     385                 :    not overlap.  */
     386                 : # ifndef YYCOPY
     387                 : #  if defined __GNUC__ && 1 < __GNUC__
     388                 : #   define YYCOPY(To, From, Count) \
     389                 :       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
     390                 : #  else
     391                 : #   define YYCOPY(To, From, Count)    \
     392                 :       do          \
     393                 :   {         \
     394                 :     YYSIZE_T yyi;       \
     395                 :     for (yyi = 0; yyi < (Count); yyi++)  \
     396                 :       (To)[yyi] = (From)[yyi];    \
     397                 :   }         \
     398                 :       while (YYID (0))
     399                 : #  endif
     400                 : # endif
     401                 : 
     402                 : /* Relocate STACK from its old location to the new one.  The
     403                 :    local variables YYSIZE and YYSTACKSIZE give the old and new number of
     404                 :    elements in the stack, and YYPTR gives the new location of the
     405                 :    stack.  Advance YYPTR to a properly aligned location for the next
     406                 :    stack.  */
     407                 : # define YYSTACK_RELOCATE(Stack_alloc, Stack)       \
     408                 :     do                  \
     409                 :       {                 \
     410                 :   YYSIZE_T yynewbytes;            \
     411                 :   YYCOPY (&yyptr->Stack_alloc, Stack, yysize);     \
     412                 :   Stack = &yyptr->Stack_alloc;         \
     413                 :   yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
     414                 :   yyptr += yynewbytes / sizeof (*yyptr);        \
     415                 :       }                 \
     416                 :     while (YYID (0))
     417                 : 
     418                 : #endif
     419                 : 
     420                 : /* YYFINAL -- State number of the termination state.  */
     421                 : #define YYFINAL  22
     422                 : /* YYLAST -- Last index in YYTABLE.  */
     423                 : #define YYLAST   294
     424                 : 
     425                 : /* YYNTOKENS -- Number of terminals.  */
     426                 : #define YYNTOKENS  47
     427                 : /* YYNNTS -- Number of nonterminals.  */
     428                 : #define YYNNTS  20
     429                 : /* YYNRULES -- Number of rules.  */
     430                 : #define YYNRULES  84
     431                 : /* YYNRULES -- Number of states.  */
     432                 : #define YYNSTATES  186
     433                 : 
     434                 : /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
     435                 : #define YYUNDEFTOK  2
     436                 : #define YYMAXUTOK   288
     437                 : 
     438                 : #define YYTRANSLATE(YYX)            \
     439                 :   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
     440                 : 
     441                 : /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
     442                 : static const yytype_uint8 yytranslate[] =
     443                 : {
     444                 :        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     445                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     446                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     447                 :        2,     2,     2,    44,     2,     2,     2,    37,     2,     2,
     448                 :       39,    40,    35,    33,    45,    34,    46,    36,     2,     2,
     449                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     450                 :       42,    41,    43,     2,     2,     2,     2,     2,     2,     2,
     451                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     452                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     453                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     454                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     455                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     456                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     457                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     458                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     459                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     460                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     461                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     462                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     463                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     464                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     465                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     466                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     467                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     468                 :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     469                 :        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
     470                 :        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
     471                 :       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
     472                 :       25,    26,    27,    28,    29,    30,    31,    32,    38
     473                 : };
     474                 : 
     475                 : #if YYDEBUG
     476                 : /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
     477                 :    YYRHS.  */
     478                 : static const yytype_uint16 yyprhs[] =
     479                 : {
     480                 :        0,     0,     3,     6,     9,    12,    16,    20,    23,    27,
     481                 :       31,    36,    41,    45,    49,    54,    59,    64,    69,    73,
     482                 :       78,    84,    91,    97,   104,   110,   117,   121,   126,   130,
     483                 :      132,   134,   138,   140,   142,   144,   148,   150,   153,   157,
     484                 :      161,   165,   169,   173,   178,   185,   187,   192,   199,   202,
     485                 :      207,   215,   216,   219,   222,   224,   228,   231,   234,   236,
     486                 :      241,   245,   247,   251,   256,   263,   269,   277,   278,   281,
     487                 :      282,   290,   299,   300,   304,   308,   310,   312,   315,   318,
     488                 :      320,   322,   324,   327,   331
     489                 : };
     490                 : 
     491                 : /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
     492                 : static const yytype_int8 yyrhs[] =
     493                 : {
     494                 :       48,     0,    -1,    27,    49,    -1,    28,    52,    -1,    29,
     495                 :       54,    -1,    49,    32,    49,    -1,    49,    31,    49,    -1,
     496                 :       30,    49,    -1,    39,    49,    40,    -1,    52,    41,    52,
     497                 :       -1,    52,    42,    43,    52,    -1,    52,    44,    41,    52,
     498                 :       -1,    52,    42,    52,    -1,    52,    43,    52,    -1,    52,
     499                 :       42,    41,    52,    -1,    52,    41,    42,    52,    -1,    52,
     500                 :       41,    43,    52,    -1,    52,    43,    41,    52,    -1,    52,
     501                 :        7,    52,    -1,    52,    30,     7,    52,    -1,    52,     7,
     502                 :       52,     8,    52,    -1,    52,    30,     7,    52,     8,    52,
     503                 :       -1,    52,     6,    39,    50,    40,    -1,    52,    30,     6,
     504                 :       39,    50,    40,    -1,    52,     9,    52,    32,    52,    -1,
     505                 :       52,    30,     9,    52,    32,    52,    -1,    52,    11,    10,
     506                 :       -1,    52,    11,    30,    10,    -1,    52,    45,    50,    -1,
     507                 :       52,    -1,     5,    -1,     5,    46,     5,    -1,     3,    -1,
     508                 :        4,    -1,    51,    -1,    39,    52,    40,    -1,    10,    -1,
     509                 :       34,    52,    -1,    52,    33,    52,    -1,    52,    34,    52,
     510                 :       -1,    52,    35,    52,    -1,    52,    36,    52,    -1,    52,
     511                 :       37,    52,    -1,     5,    39,    50,    40,    -1,    24,    39,
     512                 :       52,    20,    53,    40,    -1,     5,    -1,     5,    39,     3,
     513                 :       40,    -1,     5,    39,     3,    45,     3,    40,    -1,    55,
     514                 :       56,    -1,    39,    55,    40,    56,    -1,    12,    58,    19,
     515                 :       66,    61,    60,    62,    -1,    -1,    57,    54,    -1,    25,
     516                 :       26,    -1,    59,    -1,    59,    45,    58,    -1,    23,    51,
     517                 :       -1,    23,     4,    -1,    52,    -1,    23,    51,    20,    65,
     518                 :       -1,    52,    20,    65,    -1,    35,    -1,     5,    46,    35,
     519                 :       -1,     5,    39,    35,    40,    -1,     5,    39,    35,    40,
     520                 :       20,    65,    -1,     5,    39,    23,    51,    40,    -1,     5,
     521                 :       39,    23,    51,    40,    20,    65,    -1,    -1,    15,    49,
     522                 :       -1,    -1,    14,    66,    16,    51,    41,    51,    61,    -1,
     523                 :       13,    14,    66,    16,    51,    41,    51,    61,    -1,    -1,
     524                 :       17,    18,    63,    -1,    64,    45,    63,    -1,    64,    -1,
     525                 :       51,    -1,    51,    21,    -1,    51,    22,    -1,     5,    -1,
     526                 :        4,    -1,    65,    -1,    65,     5,    -1,     4,    46,    65,
     527                 :       -1,     4,    46,    65,     5,    -1
     528                 : };
     529                 : 
     530                 : /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
     531                 : static const yytype_uint16 yyrline[] =
     532                 : {
     533                 :        0,   104,   104,   109,   114,   120,   128,   136,   143,   148,
     534                 :      156,   164,   172,   180,   188,   196,   204,   212,   220,   228,
     535                 :      241,   250,   264,   273,   288,   297,   311,   318,   332,   338,
     536                 :      345,   352,   368,   373,   377,   382,   387,   392,   408,   415,
     537                 :      422,   429,   436,   443,   467,   475,   481,   488,   497,   498,
     538                 :      501,   506,   507,   509,   517,   518,   521,   530,   539,   548,
     539                 :      560,   571,   585,   607,   637,   671,   695,   723,   724,   729,
     540                 :      730,   739,   749,   750,   753,   754,   757,   763,   769,   777,
     541                 :      781,   787,   797,   808,   819
     542                 : };
     543                 : #endif
     544                 : 
     545                 : #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
     546                 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
     547                 :    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
     548                 : static const char *const yytname[] =
     549                 : {
     550                 :   "$end", "error", "$undefined", "SWQT_NUMBER", "SWQT_STRING",
     551                 :   "SWQT_IDENTIFIER", "SWQT_IN", "SWQT_LIKE", "SWQT_ESCAPE", "SWQT_BETWEEN",
     552                 :   "SWQT_NULL", "SWQT_IS", "SWQT_SELECT", "SWQT_LEFT", "SWQT_JOIN",
     553                 :   "SWQT_WHERE", "SWQT_ON", "SWQT_ORDER", "SWQT_BY", "SWQT_FROM", "SWQT_AS",
     554                 :   "SWQT_ASC", "SWQT_DESC", "SWQT_DISTINCT", "SWQT_CAST", "SWQT_UNION",
     555                 :   "SWQT_ALL", "SWQT_LOGICAL_START", "SWQT_VALUE_START",
     556                 :   "SWQT_SELECT_START", "SWQT_NOT", "SWQT_OR", "SWQT_AND", "'+'", "'-'",
     557                 :   "'*'", "'/'", "'%'", "SWQT_UMINUS", "'('", "')'", "'='", "'<'", "'>'",
     558                 :   "'!'", "','", "'.'", "$accept", "input", "logical_expr",
     559                 :   "value_expr_list", "field_value", "value_expr", "type_def",
     560                 :   "select_statement", "select_core", "opt_union_all", "union_all",
     561                 :   "select_field_list", "column_spec", "opt_where", "opt_joins",
     562                 :   "opt_order_by", "sort_spec_list", "sort_spec", "string_or_identifier",
     563                 :   "table_def", 0
     564                 : };
     565                 : #endif
     566                 : 
     567                 : # ifdef YYPRINT
     568                 : /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
     569                 :    token YYLEX-NUM.  */
     570                 : static const yytype_uint16 yytoknum[] =
     571                 : {
     572                 :        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     573                 :      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     574                 :      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     575                 :      285,   286,   287,    43,    45,    42,    47,    37,   288,    40,
     576                 :       41,    61,    60,    62,    33,    44,    46
     577                 : };
     578                 : # endif
     579                 : 
     580                 : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
     581                 : static const yytype_uint8 yyr1[] =
     582                 : {
     583                 :        0,    47,    48,    48,    48,    49,    49,    49,    49,    49,
     584                 :       49,    49,    49,    49,    49,    49,    49,    49,    49,    49,
     585                 :       49,    49,    49,    49,    49,    49,    49,    49,    50,    50,
     586                 :       51,    51,    52,    52,    52,    52,    52,    52,    52,    52,
     587                 :       52,    52,    52,    52,    52,    53,    53,    53,    54,    54,
     588                 :       55,    56,    56,    57,    58,    58,    59,    59,    59,    59,
     589                 :       59,    59,    59,    59,    59,    59,    59,    60,    60,    61,
     590                 :       61,    61,    62,    62,    63,    63,    64,    64,    64,    65,
     591                 :       65,    66,    66,    66,    66
     592                 : };
     593                 : 
     594                 : /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
     595                 : static const yytype_uint8 yyr2[] =
     596                 : {
     597                 :        0,     2,     2,     2,     2,     3,     3,     2,     3,     3,
     598                 :        4,     4,     3,     3,     4,     4,     4,     4,     3,     4,
     599                 :        5,     6,     5,     6,     5,     6,     3,     4,     3,     1,
     600                 :        1,     3,     1,     1,     1,     3,     1,     2,     3,     3,
     601                 :        3,     3,     3,     4,     6,     1,     4,     6,     2,     4,
     602                 :        7,     0,     2,     2,     1,     3,     2,     2,     1,     4,
     603                 :        3,     1,     3,     4,     6,     5,     7,     0,     2,     0,
     604                 :        7,     8,     0,     3,     3,     1,     1,     2,     2,     1,
     605                 :        1,     1,     2,     3,     4
     606                 : };
     607                 : 
     608                 : /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
     609                 :    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
     610                 :    means the default is an error.  */
     611                 : static const yytype_uint8 yydefact[] =
     612                 : {
     613                 :        0,     0,     0,     0,     0,    32,    33,    30,    36,     0,
     614                 :        0,     0,     0,     2,    34,     0,     0,     3,     0,     0,
     615                 :        4,    51,     1,     0,     0,     0,     7,    37,     0,     0,
     616                 :        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     617                 :        0,     0,     0,     0,     0,     0,     0,    30,     0,    61,
     618                 :       58,     0,    54,     0,     0,    48,     0,     0,    29,    31,
     619                 :        0,     8,    35,     6,     5,     0,    18,     0,    26,     0,
     620                 :        0,     0,     0,    38,    39,    40,    41,    42,     0,     0,
     621                 :        9,     0,     0,    12,     0,    13,     0,     0,     0,    57,
     622                 :       30,    56,     0,     0,     0,    51,    53,    52,    43,     0,
     623                 :        0,     0,     0,     0,    27,     0,    19,     0,    15,    16,
     624                 :       14,    10,    17,    11,     0,     0,    62,     0,    80,    79,
     625                 :       60,    80,    81,    69,    55,    49,    28,    45,     0,    22,
     626                 :       20,    24,     0,     0,     0,     0,    63,    59,     0,    82,
     627                 :        0,     0,    67,     0,    44,    23,    21,    25,    65,     0,
     628                 :       83,     0,     0,     0,    72,     0,     0,    64,    84,     0,
     629                 :        0,    68,     0,    50,    46,     0,    66,     0,     0,     0,
     630                 :        0,     0,     0,    76,    73,    75,    47,     0,    69,    77,
     631                 :       78,     0,    69,    70,    74,    71
     632                 : };
     633                 : 
     634                 : /* YYDEFGOTO[NTERM-NUM].  */
     635                 : static const yytype_int16 yydefgoto[] =
     636                 : {
     637                 :       -1,     4,    13,    57,    14,    15,   128,    20,    21,    55,
     638                 :       56,    51,    52,   154,   142,   163,   174,   175,   122,   123
     639                 : };
     640                 : 
     641                 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     642                 :    STATE-NUM.  */
     643                 : #define YYPACT_NINF -156
     644                 : static const yytype_int16 yypact[] =
     645                 : {
     646                 :      100,   214,   218,    -1,    10,  -156,  -156,   -30,  -156,   -26,
     647                 :      214,   218,   214,    44,  -156,   151,   218,   257,   173,     3,
     648                 :     -156,    12,  -156,   218,    23,   218,    44,  -156,    26,   112,
     649                 :      214,   214,    13,   218,   218,    -4,    54,   218,   218,   218,
     650                 :      218,   218,    31,    92,   165,     1,   237,   -14,    94,  -156,
     651                 :      200,    37,    19,    28,    60,  -156,    -1,    32,   231,  -156,
     652                 :      226,  -156,  -156,    57,  -156,   218,    46,   246,  -156,    81,
     653                 :       55,   218,   218,   136,   136,  -156,  -156,  -156,   218,   218,
     654                 :      257,   218,   218,   257,   218,   257,   218,   206,    -2,  -156,
     655                 :       64,    97,    99,   102,   173,    12,  -156,  -156,  -156,   218,
     656                 :       96,    72,   218,   218,  -156,   218,   130,   252,   257,   257,
     657                 :      257,   257,   257,   257,   119,   104,  -156,    99,  -156,  -156,
     658                 :     -156,    86,   145,   101,  -156,  -156,  -156,   120,   111,  -156,
     659                 :      257,   257,   121,   218,   218,   134,   159,  -156,    99,  -156,
     660                 :      127,   102,   167,   177,  -156,  -156,   257,   257,   170,    99,
     661                 :      186,   102,   182,   214,   183,   -33,    99,  -156,  -156,   185,
     662                 :      119,    44,   184,  -156,  -156,   202,  -156,   119,   162,   119,
     663                 :      174,   172,   119,   115,  -156,   180,  -156,   119,   101,  -156,
     664                 :     -156,   119,   101,  -156,  -156,  -156
     665                 : };
     666                 : 
     667                 : /* YYPGOTO[NTERM-NUM].  */
     668                 : static const yytype_int16 yypgoto[] =
     669                 : {
     670                 :     -156,  -156,   -10,   -46,   -47,     6,  -156,   171,   196,   131,
     671                 :     -156,   137,  -156,  -156,  -155,  -156,    51,  -156,   -87,  -137
     672                 : };
     673                 : 
     674                 : /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
     675                 :    positive, shift that token.  If negative, reduce the rule which
     676                 :    number is the opposite.  If zero, do what YYDEFACT says.
     677                 :    If YYTABLE_NINF, syntax error.  */
     678                 : #define YYTABLE_NINF -1
     679                 : static const yytype_uint8 yytable[] =
     680                 : {
     681                 :       26,    91,    28,    59,   152,   120,    68,   164,    17,    23,
     682                 :       22,    18,   165,    25,   159,    18,    24,    27,    29,   101,
     683                 :       63,    64,    46,   183,    50,    87,    69,   185,    59,    58,
     684                 :      137,    60,    88,   116,     5,     6,     7,    54,    19,    66,
     685                 :       67,     8,    86,    73,    74,    75,    76,    77,    80,    83,
     686                 :       85,   150,    65,   126,   102,     9,    93,    30,    31,   132,
     687                 :       70,    71,   157,    72,    94,    11,    61,   135,    95,   166,
     688                 :       16,    58,    98,    78,    79,    30,    31,   106,   107,    37,
     689                 :       38,    39,    40,    41,   108,   109,    96,   110,   111,    31,
     690                 :      112,   104,   113,    58,   105,     5,     6,     7,    89,    90,
     691                 :       50,   127,     8,   118,   119,    58,   121,   119,   130,   131,
     692                 :       24,    58,   129,   168,   140,   141,     9,   117,    32,    33,
     693                 :      171,    34,   173,    35,    90,   178,    11,     1,     2,     3,
     694                 :      182,    16,   138,    81,   173,    82,   179,   180,   133,   146,
     695                 :      147,   151,    36,   161,   136,    37,    38,    39,    40,    41,
     696                 :      139,   144,    62,    42,    43,    44,    45,    32,    33,   143,
     697                 :       34,   145,    35,    37,    38,    39,    40,    41,     5,     6,
     698                 :        7,    39,    40,    41,   148,     8,     5,     6,    47,   149,
     699                 :      155,    36,   153,     8,    37,    38,    39,    40,    41,     9,
     700                 :      156,   158,    42,    43,    44,    45,    48,     9,   160,    11,
     701                 :      162,   167,   169,   172,    16,   170,    84,    11,    49,     5,
     702                 :        6,     7,    16,   177,   176,    53,     8,     5,     6,     7,
     703                 :       92,     5,     6,     7,     8,   181,   125,    97,     8,   114,
     704                 :        9,   124,   184,    37,    38,    39,    40,    41,     9,     0,
     705                 :       11,   115,     9,     0,    10,    16,   100,     0,    11,     0,
     706                 :        0,     0,    11,    12,     0,     0,     0,    16,     0,    37,
     707                 :       38,    39,    40,    41,    37,    38,    39,    40,    41,     0,
     708                 :       37,    38,    39,    40,    41,     0,    99,    62,   103,    37,
     709                 :       38,    39,    40,    41,   134,    37,    38,    39,    40,    41,
     710                 :       37,    38,    39,    40,    41
     711                 : };
     712                 : 
     713                 : static const yytype_int16 yycheck[] =
     714                 : {
     715                 :       10,    48,    12,     5,   141,    92,    10,    40,     2,    39,
     716                 :        0,    12,    45,    39,   151,    12,    46,    11,    12,    65,
     717                 :       30,    31,    16,   178,    18,    39,    30,   182,     5,    23,
     718                 :      117,    25,    46,    35,     3,     4,     5,    25,    39,    33,
     719                 :       34,    10,    41,    37,    38,    39,    40,    41,    42,    43,
     720                 :       44,   138,    39,    99,     8,    24,    19,    31,    32,   105,
     721                 :        6,     7,   149,     9,    45,    34,    40,   114,    40,   156,
     722                 :       39,    65,    40,    42,    43,    31,    32,    71,    72,    33,
     723                 :       34,    35,    36,    37,    78,    79,    26,    81,    82,    32,
     724                 :       84,    10,    86,    87,    39,     3,     4,     5,     4,     5,
     725                 :       94,     5,    10,     4,     5,    99,     4,     5,   102,   103,
     726                 :       46,   105,    40,   160,    13,    14,    24,    20,     6,     7,
     727                 :      167,     9,   169,    11,     5,   172,    34,    27,    28,    29,
     728                 :      177,    39,    46,    41,   181,    43,    21,    22,     8,   133,
     729                 :      134,    14,    30,   153,    40,    33,    34,    35,    36,    37,
     730                 :        5,    40,    40,    41,    42,    43,    44,     6,     7,    39,
     731                 :        9,    40,    11,    33,    34,    35,    36,    37,     3,     4,
     732                 :        5,    35,    36,    37,    40,    10,     3,     4,     5,    20,
     733                 :        3,    30,    15,    10,    33,    34,    35,    36,    37,    24,
     734                 :       20,     5,    41,    42,    43,    44,    23,    24,    16,    34,
     735                 :       17,    16,    18,    41,    39,     3,    41,    34,    35,     3,
     736                 :        4,     5,    39,    41,    40,    19,    10,     3,     4,     5,
     737                 :       20,     3,     4,     5,    10,    45,    95,    56,    10,    23,
     738                 :       24,    94,   181,    33,    34,    35,    36,    37,    24,    -1,
     739                 :       34,    35,    24,    -1,    30,    39,    20,    -1,    34,    -1,
     740                 :       -1,    -1,    34,    39,    -1,    -1,    -1,    39,    -1,    33,
     741                 :       34,    35,    36,    37,    33,    34,    35,    36,    37,    -1,
     742                 :       33,    34,    35,    36,    37,    -1,    45,    40,    32,    33,
     743                 :       34,    35,    36,    37,    32,    33,    34,    35,    36,    37,
     744                 :       33,    34,    35,    36,    37
     745                 : };
     746                 : 
     747                 : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
     748                 :    symbol of state STATE-NUM.  */
     749                 : static const yytype_uint8 yystos[] =
     750                 : {
     751                 :        0,    27,    28,    29,    48,     3,     4,     5,    10,    24,
     752                 :       30,    34,    39,    49,    51,    52,    39,    52,    12,    39,
     753                 :       54,    55,     0,    39,    46,    39,    49,    52,    49,    52,
     754                 :       31,    32,     6,     7,     9,    11,    30,    33,    34,    35,
     755                 :       36,    37,    41,    42,    43,    44,    52,     5,    23,    35,
     756                 :       52,    58,    59,    55,    25,    56,    57,    50,    52,     5,
     757                 :       52,    40,    40,    49,    49,    39,    52,    52,    10,    30,
     758                 :        6,     7,     9,    52,    52,    52,    52,    52,    42,    43,
     759                 :       52,    41,    43,    52,    41,    52,    41,    39,    46,     4,
     760                 :        5,    51,    20,    19,    45,    40,    26,    54,    40,    45,
     761                 :       20,    50,     8,    32,    10,    39,    52,    52,    52,    52,
     762                 :       52,    52,    52,    52,    23,    35,    35,    20,     4,     5,
     763                 :       65,     4,    65,    66,    58,    56,    50,     5,    53,    40,
     764                 :       52,    52,    50,     8,    32,    51,    40,    65,    46,     5,
     765                 :       13,    14,    61,    39,    40,    40,    52,    52,    40,    20,
     766                 :       65,    14,    66,    15,    60,     3,    20,    65,     5,    66,
     767                 :       16,    49,    17,    62,    40,    45,    65,    16,    51,    18,
     768                 :        3,    51,    41,    51,    63,    64,    40,    41,    51,    21,
     769                 :       22,    45,    51,    61,    63,    61
     770                 : };
     771                 : 
     772                 : #define yyerrok   (yyerrstatus = 0)
     773                 : #define yyclearin (yychar = YYEMPTY)
     774                 : #define YYEMPTY   (-2)
     775                 : #define YYEOF   0
     776                 : 
     777                 : #define YYACCEPT  goto yyacceptlab
     778                 : #define YYABORT   goto yyabortlab
     779                 : #define YYERROR   goto yyerrorlab
     780                 : 
     781                 : 
     782                 : /* Like YYERROR except do call yyerror.  This remains here temporarily
     783                 :    to ease the transition to the new meaning of YYERROR, for GCC.
     784                 :    Once GCC version 2 has supplanted version 1, this can go.  */
     785                 : 
     786                 : #define YYFAIL    goto yyerrlab
     787                 : 
     788                 : #define YYRECOVERING()  (!!yyerrstatus)
     789                 : 
     790                 : #define YYBACKUP(Token, Value)          \
     791                 : do                \
     792                 :   if (yychar == YYEMPTY && yylen == 1)        \
     793                 :     {               \
     794                 :       yychar = (Token);           \
     795                 :       yylval = (Value);           \
     796                 :       yytoken = YYTRANSLATE (yychar);       \
     797                 :       YYPOPSTACK (1);           \
     798                 :       goto yybackup;            \
     799                 :     }               \
     800                 :   else                \
     801                 :     {               \
     802                 :       yyerror (context, YY_("syntax error: cannot back up")); \
     803                 :       YYERROR;              \
     804                 :     }               \
     805                 : while (YYID (0))
     806                 : 
     807                 : 
     808                 : #define YYTERROR  1
     809                 : #define YYERRCODE 256
     810                 : 
     811                 : 
     812                 : /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
     813                 :    If N is 0, then set CURRENT to the empty location which ends
     814                 :    the previous symbol: RHS[0] (always defined).  */
     815                 : 
     816                 : #define YYRHSLOC(Rhs, K) ((Rhs)[K])
     817                 : #ifndef YYLLOC_DEFAULT
     818                 : # define YYLLOC_DEFAULT(Current, Rhs, N)        \
     819                 :     do                  \
     820                 :       if (YYID (N))                                                    \
     821                 :   {               \
     822                 :     (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;  \
     823                 :     (Current).first_column = YYRHSLOC (Rhs, 1).first_column;  \
     824                 :     (Current).last_line    = YYRHSLOC (Rhs, N).last_line;   \
     825                 :     (Current).last_column  = YYRHSLOC (Rhs, N).last_column; \
     826                 :   }               \
     827                 :       else                \
     828                 :   {               \
     829                 :     (Current).first_line   = (Current).last_line   =    \
     830                 :       YYRHSLOC (Rhs, 0).last_line;        \
     831                 :     (Current).first_column = (Current).last_column =    \
     832                 :       YYRHSLOC (Rhs, 0).last_column;        \
     833                 :   }               \
     834                 :     while (YYID (0))
     835                 : #endif
     836                 : 
     837                 : 
     838                 : /* YY_LOCATION_PRINT -- Print the location on the stream.
     839                 :    This macro was not mandated originally: define only if we know
     840                 :    we won't break user code: when these are the locations we know.  */
     841                 : 
     842                 : #ifndef YY_LOCATION_PRINT
     843                 : # if YYLTYPE_IS_TRIVIAL
     844                 : #  define YY_LOCATION_PRINT(File, Loc)      \
     845                 :      fprintf (File, "%d.%d-%d.%d",      \
     846                 :         (Loc).first_line, (Loc).first_column, \
     847                 :         (Loc).last_line,  (Loc).last_column)
     848                 : # else
     849                 : #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
     850                 : # endif
     851                 : #endif
     852                 : 
     853                 : 
     854                 : /* YYLEX -- calling `yylex' with the right arguments.  */
     855                 : 
     856                 : #ifdef YYLEX_PARAM
     857                 : # define YYLEX yylex (&yylval, YYLEX_PARAM)
     858                 : #else
     859                 : # define YYLEX yylex (&yylval, context)
     860                 : #endif
     861                 : 
     862                 : /* Enable debugging if requested.  */
     863                 : #if YYDEBUG
     864                 : 
     865                 : # ifndef YYFPRINTF
     866                 : #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
     867                 : #  define YYFPRINTF fprintf
     868                 : # endif
     869                 : 
     870                 : # define YYDPRINTF(Args)      \
     871                 : do {            \
     872                 :   if (yydebug)          \
     873                 :     YYFPRINTF Args;       \
     874                 : } while (YYID (0))
     875                 : 
     876                 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)        \
     877                 : do {                    \
     878                 :   if (yydebug)                  \
     879                 :     {                   \
     880                 :       YYFPRINTF (stderr, "%s ", Title);           \
     881                 :       yy_symbol_print (stderr,              \
     882                 :       Type, Value, context); \
     883                 :       YYFPRINTF (stderr, "\n");             \
     884                 :     }                   \
     885                 : } while (YYID (0))
     886                 : 
     887                 : 
     888                 : /*--------------------------------.
     889                 : | Print this symbol on YYOUTPUT.  |
     890                 : `--------------------------------*/
     891                 : 
     892                 : /*ARGSUSED*/
     893                 : #if (defined __STDC__ || defined __C99__FUNC__ \
     894                 :      || defined __cplusplus || defined _MSC_VER)
     895                 : static void
     896                 : yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, swq_parse_context *context)
     897                 : #else
     898                 : static void
     899                 : yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
     900                 :     FILE *yyoutput;
     901                 :     int yytype;
     902                 :     YYSTYPE const * const yyvaluep;
     903                 :     swq_parse_context *context;
     904                 : #endif
     905                 : {
     906                 :   if (!yyvaluep)
     907                 :     return;
     908                 :   YYUSE (context);
     909                 : # ifdef YYPRINT
     910                 :   if (yytype < YYNTOKENS)
     911                 :     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
     912                 : # else
     913                 :   YYUSE (yyoutput);
     914                 : # endif
     915                 :   switch (yytype)
     916                 :     {
     917                 :       default:
     918                 :   break;
     919                 :     }
     920                 : }
     921                 : 
     922                 : 
     923                 : /*--------------------------------.
     924                 : | Print this symbol on YYOUTPUT.  |
     925                 : `--------------------------------*/
     926                 : 
     927                 : #if (defined __STDC__ || defined __C99__FUNC__ \
     928                 :      || defined __cplusplus || defined _MSC_VER)
     929                 : static void
     930                 : yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, swq_parse_context *context)
     931                 : #else
     932                 : static void
     933                 : yy_symbol_print (yyoutput, yytype, yyvaluep, context)
     934                 :     FILE *yyoutput;
     935                 :     int yytype;
     936                 :     YYSTYPE const * const yyvaluep;
     937                 :     swq_parse_context *context;
     938                 : #endif
     939                 : {
     940                 :   if (yytype < YYNTOKENS)
     941                 :     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
     942                 :   else
     943                 :     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
     944                 : 
     945                 :   yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
     946                 :   YYFPRINTF (yyoutput, ")");
     947                 : }
     948                 : 
     949                 : /*------------------------------------------------------------------.
     950                 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
     951                 : | TOP (included).                                                   |
     952                 : `------------------------------------------------------------------*/
     953                 : 
     954                 : #if (defined __STDC__ || defined __C99__FUNC__ \
     955                 :      || defined __cplusplus || defined _MSC_VER)
     956                 : static void
     957                 : yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
     958                 : #else
     959                 : static void
     960                 : yy_stack_print (yybottom, yytop)
     961                 :     yytype_int16 *yybottom;
     962                 :     yytype_int16 *yytop;
     963                 : #endif
     964                 : {
     965                 :   YYFPRINTF (stderr, "Stack now");
     966                 :   for (; yybottom <= yytop; yybottom++)
     967                 :     {
     968                 :       int yybot = *yybottom;
     969                 :       YYFPRINTF (stderr, " %d", yybot);
     970                 :     }
     971                 :   YYFPRINTF (stderr, "\n");
     972                 : }
     973                 : 
     974                 : # define YY_STACK_PRINT(Bottom, Top)        \
     975                 : do {                \
     976                 :   if (yydebug)              \
     977                 :     yy_stack_print ((Bottom), (Top));       \
     978                 : } while (YYID (0))
     979                 : 
     980                 : 
     981                 : /*------------------------------------------------.
     982                 : | Report that the YYRULE is going to be reduced.  |
     983                 : `------------------------------------------------*/
     984                 : 
     985                 : #if (defined __STDC__ || defined __C99__FUNC__ \
     986                 :      || defined __cplusplus || defined _MSC_VER)
     987                 : static void
     988                 : yy_reduce_print (YYSTYPE *yyvsp, int yyrule, swq_parse_context *context)
     989                 : #else
     990                 : static void
     991                 : yy_reduce_print (yyvsp, yyrule, context)
     992                 :     YYSTYPE *yyvsp;
     993                 :     int yyrule;
     994                 :     swq_parse_context *context;
     995                 : #endif
     996                 : {
     997                 :   int yynrhs = yyr2[yyrule];
     998                 :   int yyi;
     999                 :   unsigned long int yylno = yyrline[yyrule];
    1000                 :   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
    1001                 :        yyrule - 1, yylno);
    1002                 :   /* The symbols being reduced.  */
    1003                 :   for (yyi = 0; yyi < yynrhs; yyi++)
    1004                 :     {
    1005                 :       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
    1006                 :       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
    1007                 :            &(yyvsp[(yyi + 1) - (yynrhs)])
    1008                 :                      , context);
    1009                 :       YYFPRINTF (stderr, "\n");
    1010                 :     }
    1011                 : }
    1012                 : 
    1013                 : # define YY_REDUCE_PRINT(Rule)    \
    1014                 : do {          \
    1015                 :   if (yydebug)        \
    1016                 :     yy_reduce_print (yyvsp, Rule, context); \
    1017                 : } while (YYID (0))
    1018                 : 
    1019                 : /* Nonzero means print parse trace.  It is left uninitialized so that
    1020                 :    multiple parsers can coexist.  */
    1021                 : int yydebug;
    1022                 : #else /* !YYDEBUG */
    1023                 : # define YYDPRINTF(Args)
    1024                 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
    1025                 : # define YY_STACK_PRINT(Bottom, Top)
    1026                 : # define YY_REDUCE_PRINT(Rule)
    1027                 : #endif /* !YYDEBUG */
    1028                 : 
    1029                 : 
    1030                 : /* YYINITDEPTH -- initial size of the parser's stacks.  */
    1031                 : #ifndef YYINITDEPTH
    1032                 : # define YYINITDEPTH 200
    1033                 : #endif
    1034                 : 
    1035                 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
    1036                 :    if the built-in stack extension method is used).
    1037                 : 
    1038                 :    Do not make this value too large; the results are undefined if
    1039                 :    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
    1040                 :    evaluated with infinite-precision integer arithmetic.  */
    1041                 : 
    1042                 : #ifndef YYMAXDEPTH
    1043                 : # define YYMAXDEPTH 10000
    1044                 : #endif
    1045                 : 
    1046                 : 
    1047                 : 
    1048                 : #if YYERROR_VERBOSE
    1049                 : 
    1050                 : # ifndef yystrlen
    1051                 : #  if defined __GLIBC__ && defined _STRING_H
    1052                 : #   define yystrlen strlen
    1053                 : #  else
    1054                 : /* Return the length of YYSTR.  */
    1055                 : #if (defined __STDC__ || defined __C99__FUNC__ \
    1056                 :      || defined __cplusplus || defined _MSC_VER)
    1057                 : static YYSIZE_T
    1058                 : yystrlen (const char *yystr)
    1059                 : #else
    1060                 : static YYSIZE_T
    1061                 : yystrlen (yystr)
    1062                 :     const char *yystr;
    1063                 : #endif
    1064                 : {
    1065                 :   YYSIZE_T yylen;
    1066                 :   for (yylen = 0; yystr[yylen]; yylen++)
    1067                 :     continue;
    1068                 :   return yylen;
    1069                 : }
    1070                 : #  endif
    1071                 : # endif
    1072                 : 
    1073                 : # ifndef yystpcpy
    1074                 : #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
    1075                 : #   define yystpcpy stpcpy
    1076                 : #  else
    1077                 : /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    1078                 :    YYDEST.  */
    1079                 : #if (defined __STDC__ || defined __C99__FUNC__ \
    1080                 :      || defined __cplusplus || defined _MSC_VER)
    1081                 : static char *
    1082                 : yystpcpy (char *yydest, const char *yysrc)
    1083                 : #else
    1084                 : static char *
    1085                 : yystpcpy (yydest, yysrc)
    1086                 :     char *yydest;
    1087                 :     const char *yysrc;
    1088                 : #endif
    1089                 : {
    1090                 :   char *yyd = yydest;
    1091                 :   const char *yys = yysrc;
    1092                 : 
    1093                 :   while ((*yyd++ = *yys++) != '\0')
    1094                 :     continue;
    1095                 : 
    1096                 :   return yyd - 1;
    1097                 : }
    1098                 : #  endif
    1099                 : # endif
    1100                 : 
    1101                 : # ifndef yytnamerr
    1102                 : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
    1103                 :    quotes and backslashes, so that it's suitable for yyerror.  The
    1104                 :    heuristic is that double-quoting is unnecessary unless the string
    1105                 :    contains an apostrophe, a comma, or backslash (other than
    1106                 :    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
    1107                 :    null, do not copy; instead, return the length of what the result
    1108                 :    would have been.  */
    1109                 : static YYSIZE_T
    1110                 : yytnamerr (char *yyres, const char *yystr)
    1111                 : {
    1112                 :   if (*yystr == '"')
    1113                 :     {
    1114                 :       YYSIZE_T yyn = 0;
    1115                 :       char const *yyp = yystr;
    1116                 : 
    1117                 :       for (;;)
    1118                 :   switch (*++yyp)
    1119                 :     {
    1120                 :     case '\'':
    1121                 :     case ',':
    1122                 :       goto do_not_strip_quotes;
    1123                 : 
    1124                 :     case '\\':
    1125                 :       if (*++yyp != '\\')
    1126                 :         goto do_not_strip_quotes;
    1127                 :       /* Fall through.  */
    1128                 :     default:
    1129                 :       if (yyres)
    1130                 :         yyres[yyn] = *yyp;
    1131                 :       yyn++;
    1132                 :       break;
    1133                 : 
    1134                 :     case '"':
    1135                 :       if (yyres)
    1136                 :         yyres[yyn] = '\0';
    1137                 :       return yyn;
    1138                 :     }
    1139                 :     do_not_strip_quotes: ;
    1140                 :     }
    1141                 : 
    1142                 :   if (! yyres)
    1143                 :     return yystrlen (yystr);
    1144                 : 
    1145                 :   return yystpcpy (yyres, yystr) - yyres;
    1146                 : }
    1147                 : # endif
    1148                 : 
    1149                 : /* Copy into YYRESULT an error message about the unexpected token
    1150                 :    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
    1151                 :    including the terminating null byte.  If YYRESULT is null, do not
    1152                 :    copy anything; just return the number of bytes that would be
    1153                 :    copied.  As a special case, return 0 if an ordinary "syntax error"
    1154                 :    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
    1155                 :    size calculation.  */
    1156                 : static YYSIZE_T
    1157                 : yysyntax_error (char *yyresult, int yystate, int yychar)
    1158                 : {
    1159                 :   int yyn = yypact[yystate];
    1160                 : 
    1161                 :   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
    1162                 :     return 0;
    1163                 :   else
    1164                 :     {
    1165                 :       int yytype = YYTRANSLATE (yychar);
    1166                 :       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
    1167                 :       YYSIZE_T yysize = yysize0;
    1168                 :       YYSIZE_T yysize1;
    1169                 :       int yysize_overflow = 0;
    1170                 :       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
    1171                 :       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
    1172                 :       int yyx;
    1173                 : 
    1174                 : # if 0
    1175                 :       /* This is so xgettext sees the translatable formats that are
    1176                 :    constructed on the fly.  */
    1177                 :       YY_("syntax error, unexpected %s");
    1178                 :       YY_("syntax error, unexpected %s, expecting %s");
    1179                 :       YY_("syntax error, unexpected %s, expecting %s or %s");
    1180                 :       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
    1181                 :       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
    1182                 : # endif
    1183                 :       char *yyfmt;
    1184                 :       char const *yyf;
    1185                 :       static char const yyunexpected[] = "syntax error, unexpected %s";
    1186                 :       static char const yyexpecting[] = ", expecting %s";
    1187                 :       static char const yyor[] = " or %s";
    1188                 :       char yyformat[sizeof yyunexpected
    1189                 :         + sizeof yyexpecting - 1
    1190                 :         + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
    1191                 :            * (sizeof yyor - 1))];
    1192                 :       char const *yyprefix = yyexpecting;
    1193                 : 
    1194                 :       /* Start YYX at -YYN if negative to avoid negative indexes in
    1195                 :    YYCHECK.  */
    1196                 :       int yyxbegin = yyn < 0 ? -yyn : 0;
    1197                 : 
    1198                 :       /* Stay within bounds of both yycheck and yytname.  */
    1199                 :       int yychecklim = YYLAST - yyn + 1;
    1200                 :       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
    1201                 :       int yycount = 1;
    1202                 : 
    1203                 :       yyarg[0] = yytname[yytype];
    1204                 :       yyfmt = yystpcpy (yyformat, yyunexpected);
    1205                 : 
    1206                 :       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
    1207                 :   if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
    1208                 :     {
    1209                 :       if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
    1210                 :         {
    1211                 :     yycount = 1;
    1212                 :     yysize = yysize0;
    1213                 :     yyformat[sizeof yyunexpected - 1] = '\0';
    1214                 :     break;
    1215                 :         }
    1216                 :       yyarg[yycount++] = yytname[yyx];
    1217                 :       yysize1 = yysize + yytnamerr (0, yytname[yyx]);
    1218                 :       yysize_overflow |= (yysize1 < yysize);
    1219                 :       yysize = yysize1;
    1220                 :       yyfmt = yystpcpy (yyfmt, yyprefix);
    1221                 :       yyprefix = yyor;
    1222                 :     }
    1223                 : 
    1224                 :       yyf = YY_(yyformat);
    1225                 :       yysize1 = yysize + yystrlen (yyf);
    1226                 :       yysize_overflow |= (yysize1 < yysize);
    1227                 :       yysize = yysize1;
    1228                 : 
    1229                 :       if (yysize_overflow)
    1230                 :   return YYSIZE_MAXIMUM;
    1231                 : 
    1232                 :       if (yyresult)
    1233                 :   {
    1234                 :     /* Avoid sprintf, as that infringes on the user's name space.
    1235                 :        Don't have undefined behavior even if the translation
    1236                 :        produced a string with the wrong number of "%s"s.  */
    1237                 :     char *yyp = yyresult;
    1238                 :     int yyi = 0;
    1239                 :     while ((*yyp = *yyf) != '\0')
    1240                 :       {
    1241                 :         if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
    1242                 :     {
    1243                 :       yyp += yytnamerr (yyp, yyarg[yyi++]);
    1244                 :       yyf += 2;
    1245                 :     }
    1246                 :         else
    1247                 :     {
    1248                 :       yyp++;
    1249                 :       yyf++;
    1250                 :     }
    1251                 :       }
    1252                 :   }
    1253                 :       return yysize;
    1254                 :     }
    1255                 : }
    1256                 : #endif /* YYERROR_VERBOSE */
    1257                 : 
    1258                 : 
    1259                 : /*-----------------------------------------------.
    1260                 : | Release the memory associated to this symbol.  |
    1261                 : `-----------------------------------------------*/
    1262                 : 
    1263                 : /*ARGSUSED*/
    1264                 : #if (defined __STDC__ || defined __C99__FUNC__ \
    1265                 :      || defined __cplusplus || defined _MSC_VER)
    1266                 : static void
    1267            3305 : yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, swq_parse_context *context)
    1268                 : #else
    1269                 : static void
    1270                 : yydestruct (yymsg, yytype, yyvaluep, context)
    1271                 :     const char *yymsg;
    1272                 :     int yytype;
    1273                 :     YYSTYPE *yyvaluep;
    1274                 :     swq_parse_context *context;
    1275                 : #endif
    1276                 : {
    1277                 :   YYUSE (yyvaluep);
    1278                 :   YYUSE (context);
    1279                 : 
    1280            3305 :   if (!yymsg)
    1281               0 :     yymsg = "Deleting";
    1282                 :   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
    1283                 : 
    1284            3305 :   switch (yytype)
    1285                 :     {
    1286                 :       case 3: /* "SWQT_NUMBER" */
    1287                 : 
    1288                 : /* Line 1000 of yacc.c  */
    1289                 : #line 98 "swq_parser.y"
    1290                 :   { delete (*yyvaluep); };
    1291                 : 
    1292                 : /* Line 1000 of yacc.c  */
    1293                 : #line 1294 "swq_parser.cpp"
    1294               4 :   break;
    1295                 :       case 4: /* "SWQT_STRING" */
    1296                 : 
    1297                 : /* Line 1000 of yacc.c  */
    1298                 : #line 98 "swq_parser.y"
    1299                 :   { delete (*yyvaluep); };
    1300                 : 
    1301                 : /* Line 1000 of yacc.c  */
    1302                 : #line 1303 "swq_parser.cpp"
    1303               2 :   break;
    1304                 :       case 5: /* "SWQT_IDENTIFIER" */
    1305                 : 
    1306                 : /* Line 1000 of yacc.c  */
    1307                 : #line 98 "swq_parser.y"
    1308                 :   { delete (*yyvaluep); };
    1309                 : 
    1310                 : /* Line 1000 of yacc.c  */
    1311                 : #line 1312 "swq_parser.cpp"
    1312              41 :   break;
    1313                 :       case 49: /* "logical_expr" */
    1314                 : 
    1315                 : /* Line 1000 of yacc.c  */
    1316                 : #line 99 "swq_parser.y"
    1317                 :   { delete (*yyvaluep); };
    1318                 : 
    1319                 : /* Line 1000 of yacc.c  */
    1320                 : #line 1321 "swq_parser.cpp"
    1321               2 :   break;
    1322                 :       case 50: /* "value_expr_list" */
    1323                 : 
    1324                 : /* Line 1000 of yacc.c  */
    1325                 : #line 99 "swq_parser.y"
    1326                 :   { delete (*yyvaluep); };
    1327                 : 
    1328                 : /* Line 1000 of yacc.c  */
    1329                 : #line 1330 "swq_parser.cpp"
    1330               3 :   break;
    1331                 :       case 51: /* "field_value" */
    1332                 : 
    1333                 : /* Line 1000 of yacc.c  */
    1334                 : #line 99 "swq_parser.y"
    1335                 :   { delete (*yyvaluep); };
    1336                 : 
    1337                 : /* Line 1000 of yacc.c  */
    1338                 : #line 1339 "swq_parser.cpp"
    1339               2 :   break;
    1340                 :       case 52: /* "value_expr" */
    1341                 : 
    1342                 : /* Line 1000 of yacc.c  */
    1343                 : #line 99 "swq_parser.y"
    1344                 :   { delete (*yyvaluep); };
    1345                 : 
    1346                 : /* Line 1000 of yacc.c  */
    1347                 : #line 1348 "swq_parser.cpp"
    1348              35 :   break;
    1349                 :       case 53: /* "type_def" */
    1350                 : 
    1351                 : /* Line 1000 of yacc.c  */
    1352                 : #line 99 "swq_parser.y"
    1353                 :   { delete (*yyvaluep); };
    1354                 : 
    1355                 : /* Line 1000 of yacc.c  */
    1356                 : #line 1357 "swq_parser.cpp"
    1357               3 :   break;
    1358                 :       case 65: /* "string_or_identifier" */
    1359                 : 
    1360                 : /* Line 1000 of yacc.c  */
    1361                 : #line 99 "swq_parser.y"
    1362                 :   { delete (*yyvaluep); };
    1363                 : 
    1364                 : /* Line 1000 of yacc.c  */
    1365                 : #line 1366 "swq_parser.cpp"
    1366               0 :   break;
    1367                 :       case 66: /* "table_def" */
    1368                 : 
    1369                 : /* Line 1000 of yacc.c  */
    1370                 : #line 99 "swq_parser.y"
    1371                 :   { delete (*yyvaluep); };
    1372                 : 
    1373                 : /* Line 1000 of yacc.c  */
    1374                 : #line 1375 "swq_parser.cpp"
    1375                 :   break;
    1376                 : 
    1377                 :       default:
    1378                 :   break;
    1379                 :     }
    1380            3305 : }
    1381                 : 
    1382                 : /* Prevent warnings from -Wmissing-prototypes.  */
    1383                 : #ifdef YYPARSE_PARAM
    1384                 : #if defined __STDC__ || defined __cplusplus
    1385                 : int yyparse (void *YYPARSE_PARAM);
    1386                 : #else
    1387                 : int yyparse ();
    1388                 : #endif
    1389                 : #else /* ! YYPARSE_PARAM */
    1390                 : #if defined __STDC__ || defined __cplusplus
    1391                 : int yyparse (swq_parse_context *context);
    1392                 : #else
    1393                 : int yyparse ();
    1394                 : #endif
    1395                 : #endif /* ! YYPARSE_PARAM */
    1396                 : 
    1397                 : 
    1398                 : 
    1399                 : 
    1400                 : 
    1401                 : /*-------------------------.
    1402                 : | yyparse or yypush_parse.  |
    1403                 : `-------------------------*/
    1404                 : 
    1405                 : #ifdef YYPARSE_PARAM
    1406                 : #if (defined __STDC__ || defined __C99__FUNC__ \
    1407                 :      || defined __cplusplus || defined _MSC_VER)
    1408                 : int
    1409                 : yyparse (void *YYPARSE_PARAM)
    1410                 : #else
    1411                 : int
    1412                 : yyparse (YYPARSE_PARAM)
    1413                 :     void *YYPARSE_PARAM;
    1414                 : #endif
    1415                 : #else /* ! YYPARSE_PARAM */
    1416                 : #if (defined __STDC__ || defined __C99__FUNC__ \
    1417                 :      || defined __cplusplus || defined _MSC_VER)
    1418                 : int
    1419            1463 : yyparse (swq_parse_context *context)
    1420                 : #else
    1421                 : int
    1422                 : yyparse (context)
    1423                 :     swq_parse_context *context;
    1424                 : #endif
    1425                 : #endif
    1426                 : {
    1427                 : /* The lookahead symbol.  */
    1428                 : int yychar;
    1429                 : 
    1430                 : /* The semantic value of the lookahead symbol.  */
    1431                 : YYSTYPE yylval;
    1432                 : 
    1433                 :     /* Number of syntax errors so far.  */
    1434                 :     int yynerrs;
    1435                 : 
    1436                 :     int yystate;
    1437                 :     /* Number of tokens to shift before error messages enabled.  */
    1438                 :     int yyerrstatus;
    1439                 : 
    1440                 :     /* The stacks and their tools:
    1441                 :        `yyss': related to states.
    1442                 :        `yyvs': related to semantic values.
    1443                 : 
    1444                 :        Refer to the stacks thru separate pointers, to allow yyoverflow
    1445                 :        to reallocate them elsewhere.  */
    1446                 : 
    1447                 :     /* The state stack.  */
    1448            1463 :     yytype_int16 yyssa[YYINITDEPTH]; /* workaround bug with gcc 4.1 -O2 */ memset(yyssa, 0, sizeof(yyssa));
    1449                 :     yytype_int16 *yyss;
    1450                 :     yytype_int16 *yyssp;
    1451                 : 
    1452                 :     /* The semantic value stack.  */
    1453                 :     YYSTYPE yyvsa[YYINITDEPTH];
    1454                 :     YYSTYPE *yyvs;
    1455                 :     YYSTYPE *yyvsp;
    1456                 : 
    1457                 :     YYSIZE_T yystacksize;
    1458                 : 
    1459                 :   int yyn;
    1460                 :   int yyresult;
    1461                 :   /* Lookahead token as an internal (translated) token number.  */
    1462                 :   int yytoken;
    1463                 :   /* The variables used to return semantic value and location from the
    1464                 :      action routines.  */
    1465                 :   YYSTYPE yyval;
    1466                 : 
    1467                 : #if YYERROR_VERBOSE
    1468                 :   /* Buffer for error messages, and its allocated size.  */
    1469                 :   char yymsgbuf[128];
    1470                 :   char *yymsg = yymsgbuf;
    1471                 :   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
    1472                 : #endif
    1473                 : 
    1474                 : #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
    1475                 : 
    1476                 :   /* The number of symbols on the RHS of the reduced rule.
    1477                 :      Keep to zero when no symbol should be popped.  */
    1478            1463 :   int yylen = 0;
    1479                 : 
    1480            1463 :   yytoken = 0;
    1481            1463 :   yyss = yyssa;
    1482            1463 :   yyvs = yyvsa;
    1483            1463 :   yystacksize = YYINITDEPTH;
    1484                 : 
    1485                 :   YYDPRINTF ((stderr, "Starting parse\n"));
    1486                 : 
    1487            1463 :   yystate = 0;
    1488            1463 :   yyerrstatus = 0;
    1489            1463 :   yynerrs = 0;
    1490            1463 :   yychar = YYEMPTY; /* Cause a token to be read.  */
    1491                 : 
    1492                 :   /* Initialize stack pointers.
    1493                 :      Waste one element of value and location stack
    1494                 :      so that they stay on the same level as the state stack.
    1495                 :      The wasted elements are never initialized.  */
    1496            1463 :   yyssp = yyss;
    1497            1463 :   yyvsp = yyvs;
    1498                 : 
    1499            1463 :   goto yysetstate;
    1500                 : 
    1501                 : /*------------------------------------------------------------.
    1502                 : | yynewstate -- Push a new state, which is found in yystate.  |
    1503                 : `------------------------------------------------------------*/
    1504                 :  yynewstate:
    1505                 :   /* In all cases, when you get here, the value and location stacks
    1506                 :      have just been pushed.  So pushing a state here evens the stacks.  */
    1507           32240 :   yyssp++;
    1508                 : 
    1509                 :  yysetstate:
    1510           33703 :   *yyssp = yystate;
    1511                 : 
    1512           33703 :   if (yyss + yystacksize - 1 <= yyssp)
    1513                 :     {
    1514                 :       /* Get the current used size of the three stacks, in elements.  */
    1515               4 :       YYSIZE_T yysize = yyssp - yyss + 1;
    1516                 : 
    1517                 : #ifdef yyoverflow
    1518                 :       {
    1519                 :   /* Give user a chance to reallocate the stack.  Use copies of
    1520                 :      these so that the &'s don't force the real ones into
    1521                 :      memory.  */
    1522                 :   YYSTYPE *yyvs1 = yyvs;
    1523                 :   yytype_int16 *yyss1 = yyss;
    1524                 : 
    1525                 :   /* Each stack pointer address is followed by the size of the
    1526                 :      data in use in that stack, in bytes.  This used to be a
    1527                 :      conditional around just the two extra args, but that might
    1528                 :      be undefined if yyoverflow is a macro.  */
    1529                 :   yyoverflow (YY_("memory exhausted"),
    1530                 :         &yyss1, yysize * sizeof (*yyssp),
    1531                 :         &yyvs1, yysize * sizeof (*yyvsp),
    1532                 :         &yystacksize);
    1533                 : 
    1534                 :   yyss = yyss1;
    1535                 :   yyvs = yyvs1;
    1536                 :       }
    1537                 : #else /* no yyoverflow */
    1538                 : # ifndef YYSTACK_RELOCATE
    1539                 :       goto yyexhaustedlab;
    1540                 : # else
    1541                 :       /* Extend the stack our own way.  */
    1542               4 :       if (YYMAXDEPTH <= yystacksize)
    1543               0 :   goto yyexhaustedlab;
    1544               4 :       yystacksize *= 2;
    1545               4 :       if (YYMAXDEPTH < yystacksize)
    1546               0 :   yystacksize = YYMAXDEPTH;
    1547                 : 
    1548                 :       {
    1549               4 :   yytype_int16 *yyss1 = yyss;
    1550                 :   union yyalloc *yyptr =
    1551               4 :     (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
    1552               4 :   if (! yyptr)
    1553               0 :     goto yyexhaustedlab;
    1554               4 :   YYSTACK_RELOCATE (yyss_alloc, yyss);
    1555               4 :   YYSTACK_RELOCATE (yyvs_alloc, yyvs);
    1556                 : #  undef YYSTACK_RELOCATE
    1557               4 :   if (yyss1 != yyssa)
    1558               3 :     YYSTACK_FREE (yyss1);
    1559                 :       }
    1560                 : # endif
    1561                 : #endif /* no yyoverflow */
    1562                 : 
    1563               4 :       yyssp = yyss + yysize - 1;
    1564               4 :       yyvsp = yyvs + yysize - 1;
    1565                 : 
    1566                 :       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
    1567                 :       (unsigned long int) yystacksize));
    1568                 : 
    1569               4 :       if (yyss + yystacksize - 1 <= yyssp)
    1570               0 :   YYABORT;
    1571                 :     }
    1572                 : 
    1573                 :   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
    1574                 : 
    1575           33703 :   if (yystate == YYFINAL)
    1576            1342 :     YYACCEPT;
    1577                 : 
    1578                 :   goto yybackup;
    1579                 : 
    1580                 : /*-----------.
    1581                 : | yybackup.  |
    1582                 : `-----------*/
    1583                 : yybackup:
    1584                 : 
    1585                 :   /* Do appropriate processing given the current state.  Read a
    1586                 :      lookahead token if we need one and don't already have one.  */
    1587                 : 
    1588                 :   /* First try to decide what to do without reference to lookahead token.  */
    1589           32361 :   yyn = yypact[yystate];
    1590           32361 :   if (yyn == YYPACT_NINF)
    1591            8551 :     goto yydefault;
    1592                 : 
    1593                 :   /* Not known => get a lookahead token if don't already have one.  */
    1594                 : 
    1595                 :   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
    1596           23810 :   if (yychar == YYEMPTY)
    1597                 :     {
    1598                 :       YYDPRINTF ((stderr, "Reading a token: "));
    1599           14738 :       yychar = YYLEX;
    1600                 :     }
    1601                 : 
    1602           23810 :   if (yychar <= YYEOF)
    1603                 :     {
    1604            5094 :       yychar = yytoken = YYEOF;
    1605                 :       YYDPRINTF ((stderr, "Now at end of input.\n"));
    1606                 :     }
    1607                 :   else
    1608                 :     {
    1609           18716 :       yytoken = YYTRANSLATE (yychar);
    1610                 :       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    1611                 :     }
    1612                 : 
    1613                 :   /* If the proper action on seeing token YYTOKEN is to reduce or to
    1614                 :      detect an error, take that action.  */
    1615           23810 :   yyn += yytoken;
    1616           23810 :   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    1617                 :     goto yydefault;
    1618           14619 :   yyn = yytable[yyn];
    1619           14619 :   if (yyn <= 0)
    1620                 :     {
    1621               0 :       if (yyn == 0 || yyn == YYTABLE_NINF)
    1622                 :   goto yyerrlab;
    1623               0 :       yyn = -yyn;
    1624               0 :       goto yyreduce;
    1625                 :     }
    1626                 : 
    1627                 :   /* Count tokens shifted since error; after three, turn off error
    1628                 :      status.  */
    1629           14619 :   if (yyerrstatus)
    1630               0 :     yyerrstatus--;
    1631                 : 
    1632                 :   /* Shift the lookahead token.  */
    1633                 :   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
    1634                 : 
    1635                 :   /* Discard the shifted token.  */
    1636           14619 :   yychar = YYEMPTY;
    1637                 : 
    1638           14619 :   yystate = yyn;
    1639           14619 :   *++yyvsp = yylval;
    1640                 : 
    1641           14619 :   goto yynewstate;
    1642                 : 
    1643                 : 
    1644                 : /*-----------------------------------------------------------.
    1645                 : | yydefault -- do the default action for the current state.  |
    1646                 : `-----------------------------------------------------------*/
    1647                 : yydefault:
    1648           17742 :   yyn = yydefact[yystate];
    1649           17742 :   if (yyn == 0)
    1650             112 :     goto yyerrlab;
    1651                 :   goto yyreduce;
    1652                 : 
    1653                 : 
    1654                 : /*-----------------------------.
    1655                 : | yyreduce -- Do a reduction.  |
    1656                 : `-----------------------------*/
    1657                 : yyreduce:
    1658                 :   /* yyn is the number of a rule to reduce with.  */
    1659           17630 :   yylen = yyr2[yyn];
    1660                 : 
    1661                 :   /* If YYLEN is nonzero, implement the default value of the action:
    1662                 :      `$$ = $1'.
    1663                 : 
    1664                 :      Otherwise, the following line sets YYVAL to garbage.
    1665                 :      This behavior is undocumented and Bison
    1666                 :      users should not rely upon it.  Assigning to YYVAL
    1667                 :      unconditionally makes the parser a bit smaller, and it avoids a
    1668                 :      GCC warning that YYVAL may be used uninitialized.  */
    1669           17630 :   yyval = yyvsp[1-yylen];
    1670                 : 
    1671                 : 
    1672                 :   YY_REDUCE_PRINT (yyn);
    1673           17630 :   switch (yyn)
    1674                 :     {
    1675                 :         case 2:
    1676                 : 
    1677                 : /* Line 1455 of yacc.c  */
    1678                 : #line 105 "swq_parser.y"
    1679                 :     {
    1680                 :       context->poRoot = (yyvsp[(2) - (2)]);
    1681                 :     ;}
    1682                 :     break;
    1683                 : 
    1684                 :   case 3:
    1685                 : 
    1686                 : /* Line 1455 of yacc.c  */
    1687                 : #line 110 "swq_parser.y"
    1688                 :     {
    1689                 :       context->poRoot = (yyvsp[(2) - (2)]);
    1690                 :     ;}
    1691                 :     break;
    1692                 : 
    1693                 :   case 4:
    1694                 : 
    1695                 : /* Line 1455 of yacc.c  */
    1696                 : #line 115 "swq_parser.y"
    1697                 :     {
    1698                 :       context->poRoot = (yyvsp[(2) - (2)]);
    1699                 :     ;}
    1700                 :     break;
    1701                 : 
    1702                 :   case 5:
    1703                 : 
    1704                 : /* Line 1455 of yacc.c  */
    1705                 : #line 121 "swq_parser.y"
    1706                 :     {
    1707                 :       (yyval) = new swq_expr_node( SWQ_AND );
    1708                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1709                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    1710                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    1711                 :          ;}
    1712                 :     break;
    1713                 : 
    1714                 :   case 6:
    1715                 : 
    1716                 : /* Line 1455 of yacc.c  */
    1717                 : #line 129 "swq_parser.y"
    1718                 :     {
    1719                 :       (yyval) = new swq_expr_node( SWQ_OR );
    1720                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1721                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    1722                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    1723                 :          ;}
    1724                 :     break;
    1725                 : 
    1726                 :   case 7:
    1727                 : 
    1728                 : /* Line 1455 of yacc.c  */
    1729                 : #line 137 "swq_parser.y"
    1730                 :     {
    1731                 :       (yyval) = new swq_expr_node( SWQ_NOT );
    1732                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1733                 :       (yyval)->PushSubExpression( (yyvsp[(2) - (2)]) );
    1734                 :          ;}
    1735                 :     break;
    1736                 : 
    1737                 :   case 8:
    1738                 : 
    1739                 : /* Line 1455 of yacc.c  */
    1740                 : #line 144 "swq_parser.y"
    1741                 :     {
    1742                 :       (yyval) = (yyvsp[(2) - (3)]);
    1743                 :          ;}
    1744                 :     break;
    1745                 : 
    1746                 :   case 9:
    1747                 : 
    1748                 : /* Line 1455 of yacc.c  */
    1749                 : #line 149 "swq_parser.y"
    1750                 :     {
    1751                 :       (yyval) = new swq_expr_node( SWQ_EQ );
    1752                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1753                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    1754                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    1755                 :          ;}
    1756                 :     break;
    1757                 : 
    1758                 :   case 10:
    1759                 : 
    1760                 : /* Line 1455 of yacc.c  */
    1761                 : #line 157 "swq_parser.y"
    1762                 :     {
    1763                 :       (yyval) = new swq_expr_node( SWQ_NE );
    1764                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1765                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
    1766                 :       (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
    1767                 :          ;}
    1768                 :     break;
    1769                 : 
    1770                 :   case 11:
    1771                 : 
    1772                 : /* Line 1455 of yacc.c  */
    1773                 : #line 165 "swq_parser.y"
    1774                 :     {
    1775                 :       (yyval) = new swq_expr_node( SWQ_NE );
    1776                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1777                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
    1778                 :       (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
    1779                 :          ;}
    1780                 :     break;
    1781                 : 
    1782                 :   case 12:
    1783                 : 
    1784                 : /* Line 1455 of yacc.c  */
    1785                 : #line 173 "swq_parser.y"
    1786                 :     {
    1787                 :       (yyval) = new swq_expr_node( SWQ_LT );
    1788                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1789                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    1790                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    1791                 :          ;}
    1792                 :     break;
    1793                 : 
    1794                 :   case 13:
    1795                 : 
    1796                 : /* Line 1455 of yacc.c  */
    1797                 : #line 181 "swq_parser.y"
    1798                 :     {
    1799                 :       (yyval) = new swq_expr_node( SWQ_GT );
    1800                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1801                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    1802                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    1803                 :          ;}
    1804                 :     break;
    1805                 : 
    1806                 :   case 14:
    1807                 : 
    1808                 : /* Line 1455 of yacc.c  */
    1809                 : #line 189 "swq_parser.y"
    1810                 :     {
    1811                 :       (yyval) = new swq_expr_node( SWQ_LE );
    1812                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1813                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
    1814                 :       (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
    1815                 :          ;}
    1816                 :     break;
    1817                 : 
    1818                 :   case 15:
    1819                 : 
    1820                 : /* Line 1455 of yacc.c  */
    1821                 : #line 197 "swq_parser.y"
    1822                 :     {
    1823                 :       (yyval) = new swq_expr_node( SWQ_LE );
    1824                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1825                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
    1826                 :       (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
    1827                 :          ;}
    1828                 :     break;
    1829                 : 
    1830                 :   case 16:
    1831                 : 
    1832                 : /* Line 1455 of yacc.c  */
    1833                 : #line 205 "swq_parser.y"
    1834                 :     {
    1835                 :       (yyval) = new swq_expr_node( SWQ_LE );
    1836                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1837                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
    1838                 :       (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
    1839                 :          ;}
    1840                 :     break;
    1841                 : 
    1842                 :   case 17:
    1843                 : 
    1844                 : /* Line 1455 of yacc.c  */
    1845                 : #line 213 "swq_parser.y"
    1846                 :     {
    1847                 :       (yyval) = new swq_expr_node( SWQ_GE );
    1848                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1849                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
    1850                 :       (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
    1851                 :          ;}
    1852                 :     break;
    1853                 : 
    1854                 :   case 18:
    1855                 : 
    1856                 : /* Line 1455 of yacc.c  */
    1857                 : #line 221 "swq_parser.y"
    1858                 :     {
    1859                 :       (yyval) = new swq_expr_node( SWQ_LIKE );
    1860                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1861                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    1862                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    1863                 :          ;}
    1864                 :     break;
    1865                 : 
    1866                 :   case 19:
    1867                 : 
    1868                 : /* Line 1455 of yacc.c  */
    1869                 : #line 229 "swq_parser.y"
    1870                 :     {
    1871                 :             swq_expr_node *like;
    1872                 :       like = new swq_expr_node( SWQ_LIKE );
    1873                 :       like->field_type = SWQ_BOOLEAN;
    1874                 :       like->PushSubExpression( (yyvsp[(1) - (4)]) );
    1875                 :       like->PushSubExpression( (yyvsp[(4) - (4)]) );
    1876                 : 
    1877                 :       (yyval) = new swq_expr_node( SWQ_NOT );
    1878                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1879                 :       (yyval)->PushSubExpression( like );
    1880                 :          ;}
    1881                 :     break;
    1882                 : 
    1883                 :   case 20:
    1884                 : 
    1885                 : /* Line 1455 of yacc.c  */
    1886                 : #line 242 "swq_parser.y"
    1887                 :     {
    1888                 :             (yyval) = new swq_expr_node( SWQ_LIKE );
    1889                 :             (yyval)->field_type = SWQ_BOOLEAN;
    1890                 :             (yyval)->PushSubExpression( (yyvsp[(1) - (5)]) );
    1891                 :             (yyval)->PushSubExpression( (yyvsp[(3) - (5)]) );
    1892                 :             (yyval)->PushSubExpression( (yyvsp[(5) - (5)]) );
    1893                 :        ;}
    1894                 :     break;
    1895                 : 
    1896                 :   case 21:
    1897                 : 
    1898                 : /* Line 1455 of yacc.c  */
    1899                 : #line 251 "swq_parser.y"
    1900                 :     {
    1901                 :                 swq_expr_node *like;
    1902                 :             like = new swq_expr_node( SWQ_LIKE );
    1903                 :             like->field_type = SWQ_BOOLEAN;
    1904                 :             like->PushSubExpression( (yyvsp[(1) - (6)]) );
    1905                 :             like->PushSubExpression( (yyvsp[(4) - (6)]) );
    1906                 :             like->PushSubExpression( (yyvsp[(6) - (6)]) );
    1907                 : 
    1908                 :             (yyval) = new swq_expr_node( SWQ_NOT );
    1909                 :             (yyval)->field_type = SWQ_BOOLEAN;
    1910                 :             (yyval)->PushSubExpression( like );
    1911                 :       ;}
    1912                 :     break;
    1913                 : 
    1914                 :   case 22:
    1915                 : 
    1916                 : /* Line 1455 of yacc.c  */
    1917                 : #line 265 "swq_parser.y"
    1918                 :     {
    1919                 :       (yyval) = (yyvsp[(4) - (5)]);
    1920                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1921                 :       (yyval)->nOperation = SWQ_IN;
    1922                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (5)]) );
    1923                 :       (yyval)->ReverseSubExpressions();
    1924                 :          ;}
    1925                 :     break;
    1926                 : 
    1927                 :   case 23:
    1928                 : 
    1929                 : /* Line 1455 of yacc.c  */
    1930                 : #line 274 "swq_parser.y"
    1931                 :     {
    1932                 :             swq_expr_node *in;
    1933                 : 
    1934                 :       in = (yyvsp[(5) - (6)]);
    1935                 :       in->field_type = SWQ_BOOLEAN;
    1936                 :       in->nOperation = SWQ_IN;
    1937                 :       in->PushSubExpression( (yyvsp[(1) - (6)]) );
    1938                 :       in->ReverseSubExpressions();
    1939                 :       
    1940                 :       (yyval) = new swq_expr_node( SWQ_NOT );
    1941                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1942                 :       (yyval)->PushSubExpression( in );
    1943                 :          ;}
    1944                 :     break;
    1945                 : 
    1946                 :   case 24:
    1947                 : 
    1948                 : /* Line 1455 of yacc.c  */
    1949                 : #line 289 "swq_parser.y"
    1950                 :     {
    1951                 :             (yyval) = new swq_expr_node( SWQ_BETWEEN );
    1952                 :             (yyval)->field_type = SWQ_BOOLEAN;
    1953                 :             (yyval)->PushSubExpression( (yyvsp[(1) - (5)]) );
    1954                 :             (yyval)->PushSubExpression( (yyvsp[(3) - (5)]) );
    1955                 :             (yyval)->PushSubExpression( (yyvsp[(5) - (5)]) );
    1956                 :              ;}
    1957                 :     break;
    1958                 : 
    1959                 :   case 25:
    1960                 : 
    1961                 : /* Line 1455 of yacc.c  */
    1962                 : #line 298 "swq_parser.y"
    1963                 :     {
    1964                 :             swq_expr_node *between;
    1965                 :             between = new swq_expr_node( SWQ_BETWEEN );
    1966                 :             between->field_type = SWQ_BOOLEAN;
    1967                 :             between->PushSubExpression( (yyvsp[(1) - (6)]) );
    1968                 :             between->PushSubExpression( (yyvsp[(4) - (6)]) );
    1969                 :             between->PushSubExpression( (yyvsp[(6) - (6)]) );
    1970                 : 
    1971                 :             (yyval) = new swq_expr_node( SWQ_NOT );
    1972                 :             (yyval)->field_type = SWQ_BOOLEAN;
    1973                 :             (yyval)->PushSubExpression( between );
    1974                 :              ;}
    1975                 :     break;
    1976                 : 
    1977                 :   case 26:
    1978                 : 
    1979                 : /* Line 1455 of yacc.c  */
    1980                 : #line 312 "swq_parser.y"
    1981                 :     {
    1982                 :       (yyval) = new swq_expr_node( SWQ_ISNULL );
    1983                 :       (yyval)->field_type = SWQ_BOOLEAN;
    1984                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    1985                 :          ;}
    1986                 :     break;
    1987                 : 
    1988                 :   case 27:
    1989                 : 
    1990                 : /* Line 1455 of yacc.c  */
    1991                 : #line 319 "swq_parser.y"
    1992                 :     {
    1993                 :             swq_expr_node *isnull;
    1994                 : 
    1995                 :       isnull = new swq_expr_node( SWQ_ISNULL );
    1996                 :       isnull->field_type = SWQ_BOOLEAN;
    1997                 :       isnull->PushSubExpression( (yyvsp[(1) - (4)]) );
    1998                 : 
    1999                 :       (yyval) = new swq_expr_node( SWQ_NOT );
    2000                 :       (yyval)->field_type = SWQ_BOOLEAN;
    2001                 :       (yyval)->PushSubExpression( isnull );
    2002                 :          ;}
    2003                 :     break;
    2004                 : 
    2005                 :   case 28:
    2006                 : 
    2007                 : /* Line 1455 of yacc.c  */
    2008                 : #line 333 "swq_parser.y"
    2009                 :     {
    2010                 :       (yyval) = (yyvsp[(3) - (3)]);
    2011                 :       (yyvsp[(3) - (3)])->PushSubExpression( (yyvsp[(1) - (3)]) );
    2012                 :     ;}
    2013                 :     break;
    2014                 : 
    2015                 :   case 29:
    2016                 : 
    2017                 : /* Line 1455 of yacc.c  */
    2018                 : #line 339 "swq_parser.y"
    2019                 :     {
    2020                 :       (yyval) = new swq_expr_node( SWQ_UNKNOWN ); /* list */
    2021                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (1)]) );
    2022                 :     ;}
    2023                 :     break;
    2024                 : 
    2025                 :   case 30:
    2026                 : 
    2027                 : /* Line 1455 of yacc.c  */
    2028                 : #line 346 "swq_parser.y"
    2029                 :     {
    2030                 :             (yyval) = (yyvsp[(1) - (1)]);  // validation deferred.
    2031                 :       (yyval)->eNodeType = SNT_COLUMN;
    2032                 :       (yyval)->field_index = (yyval)->table_index = -1;
    2033                 :     ;}
    2034                 :     break;
    2035                 : 
    2036                 :   case 31:
    2037                 : 
    2038                 : /* Line 1455 of yacc.c  */
    2039                 : #line 353 "swq_parser.y"
    2040                 :     {
    2041                 :             (yyval) = (yyvsp[(1) - (3)]);  // validation deferred.
    2042                 :       (yyval)->eNodeType = SNT_COLUMN;
    2043                 :       (yyval)->field_index = (yyval)->table_index = -1;
    2044                 :       (yyval)->string_value = (char *) 
    2045                 :                             CPLRealloc( (yyval)->string_value, 
    2046                 :                                         strlen((yyval)->string_value) 
    2047                 :                                         + strlen((yyvsp[(3) - (3)])->string_value) + 2 );
    2048                 :       strcat( (yyval)->string_value, "." );
    2049                 :       strcat( (yyval)->string_value, (yyvsp[(3) - (3)])->string_value );
    2050                 :       delete (yyvsp[(3) - (3)]);
    2051                 :       (yyvsp[(3) - (3)]) = NULL;
    2052                 :     ;}
    2053                 :     break;
    2054                 : 
    2055                 :   case 32:
    2056                 : 
    2057                 : /* Line 1455 of yacc.c  */
    2058                 : #line 369 "swq_parser.y"
    2059                 :     {
    2060                 :       (yyval) = (yyvsp[(1) - (1)]);
    2061                 :     ;}
    2062                 :     break;
    2063                 : 
    2064                 :   case 33:
    2065                 : 
    2066                 : /* Line 1455 of yacc.c  */
    2067                 : #line 374 "swq_parser.y"
    2068                 :     {
    2069                 :       (yyval) = (yyvsp[(1) - (1)]);
    2070                 :     ;}
    2071                 :     break;
    2072                 : 
    2073                 :   case 34:
    2074                 : 
    2075                 : /* Line 1455 of yacc.c  */
    2076                 : #line 378 "swq_parser.y"
    2077                 :     {
    2078                 :       (yyval) = (yyvsp[(1) - (1)]);
    2079                 :     ;}
    2080                 :     break;
    2081                 : 
    2082                 :   case 35:
    2083                 : 
    2084                 : /* Line 1455 of yacc.c  */
    2085                 : #line 383 "swq_parser.y"
    2086                 :     {
    2087                 :       (yyval) = (yyvsp[(2) - (3)]);
    2088                 :     ;}
    2089                 :     break;
    2090                 : 
    2091                 :   case 36:
    2092                 : 
    2093                 : /* Line 1455 of yacc.c  */
    2094                 : #line 388 "swq_parser.y"
    2095                 :     {
    2096                 :             (yyval) = new swq_expr_node((const char*)NULL);
    2097                 :         ;}
    2098                 :     break;
    2099                 : 
    2100                 :   case 37:
    2101                 : 
    2102                 : /* Line 1455 of yacc.c  */
    2103                 : #line 393 "swq_parser.y"
    2104                 :     {
    2105                 :             if ((yyvsp[(2) - (2)])->eNodeType == SNT_CONSTANT)
    2106                 :             {
    2107                 :                 (yyval) = (yyvsp[(2) - (2)]);
    2108                 :                 (yyval)->int_value *= -1;
    2109                 :                 (yyval)->float_value *= -1;
    2110                 :             }
    2111                 :             else
    2112                 :             {
    2113                 :                 (yyval) = new swq_expr_node( SWQ_MULTIPLY );
    2114                 :                 (yyval)->PushSubExpression( new swq_expr_node(-1) );
    2115                 :                 (yyval)->PushSubExpression( (yyvsp[(2) - (2)]) );
    2116                 :             }
    2117                 :         ;}
    2118                 :     break;
    2119                 : 
    2120                 :   case 38:
    2121                 : 
    2122                 : /* Line 1455 of yacc.c  */
    2123                 : #line 409 "swq_parser.y"
    2124                 :     {
    2125                 :       (yyval) = new swq_expr_node( SWQ_ADD );
    2126                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    2127                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    2128                 :     ;}
    2129                 :     break;
    2130                 : 
    2131                 :   case 39:
    2132                 : 
    2133                 : /* Line 1455 of yacc.c  */
    2134                 : #line 416 "swq_parser.y"
    2135                 :     {
    2136                 :       (yyval) = new swq_expr_node( SWQ_SUBTRACT );
    2137                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    2138                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    2139                 :     ;}
    2140                 :     break;
    2141                 : 
    2142                 :   case 40:
    2143                 : 
    2144                 : /* Line 1455 of yacc.c  */
    2145                 : #line 423 "swq_parser.y"
    2146                 :     {
    2147                 :       (yyval) = new swq_expr_node( SWQ_MULTIPLY );
    2148                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    2149                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    2150                 :     ;}
    2151                 :     break;
    2152                 : 
    2153                 :   case 41:
    2154                 : 
    2155                 : /* Line 1455 of yacc.c  */
    2156                 : #line 430 "swq_parser.y"
    2157                 :     {
    2158                 :       (yyval) = new swq_expr_node( SWQ_DIVIDE );
    2159                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    2160                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    2161                 :     ;}
    2162                 :     break;
    2163                 : 
    2164                 :   case 42:
    2165                 : 
    2166                 : /* Line 1455 of yacc.c  */
    2167                 : #line 437 "swq_parser.y"
    2168                 :     {
    2169                 :       (yyval) = new swq_expr_node( SWQ_MODULUS );
    2170                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
    2171                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
    2172                 :     ;}
    2173                 :     break;
    2174                 : 
    2175                 :   case 43:
    2176                 : 
    2177                 : /* Line 1455 of yacc.c  */
    2178                 : #line 444 "swq_parser.y"
    2179                 :     {
    2180                 :         const swq_operation *poOp = 
    2181                 :                       swq_op_registrar::GetOperator( (yyvsp[(1) - (4)])->string_value );
    2182                 : 
    2183                 :         if( poOp == NULL )
    2184                 :         {
    2185                 :             CPLError( CE_Failure, CPLE_AppDefined, 
    2186                 :                                   "Undefined function '%s' used.",
    2187                 :                                   (yyvsp[(1) - (4)])->string_value );
    2188                 :                 delete (yyvsp[(1) - (4)]);
    2189                 :                 delete (yyvsp[(3) - (4)]);
    2190                 :             YYERROR;
    2191                 :         }
    2192                 :         else
    2193                 :         {
    2194                 :       (yyval) = (yyvsp[(3) - (4)]);
    2195                 :                         (yyval)->eNodeType = SNT_OPERATION;
    2196                 :                         (yyval)->nOperation = poOp->eOperation;
    2197                 :       (yyval)->ReverseSubExpressions();
    2198                 :       delete (yyvsp[(1) - (4)]);
    2199                 :         }
    2200                 :     ;}
    2201                 :     break;
    2202                 : 
    2203                 :   case 44:
    2204                 : 
    2205                 : /* Line 1455 of yacc.c  */
    2206                 : #line 468 "swq_parser.y"
    2207                 :     {
    2208                 :         (yyval) = (yyvsp[(5) - (6)]);
    2209                 :         (yyval)->PushSubExpression( (yyvsp[(3) - (6)]) );
    2210                 :         (yyval)->ReverseSubExpressions();
    2211                 :     ;}
    2212                 :     break;
    2213                 : 
    2214                 :   case 45:
    2215                 : 
    2216                 : /* Line 1455 of yacc.c  */
    2217                 : #line 476 "swq_parser.y"
    2218                 :     {
    2219                 :       (yyval) = new swq_expr_node( SWQ_CAST );
    2220                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (1)]) );
    2221                 :   ;}
    2222                 :     break;
    2223                 : 
    2224                 :   case 46:
    2225                 : 
    2226                 : /* Line 1455 of yacc.c  */
    2227                 : #line 482 "swq_parser.y"
    2228                 :     {
    2229                 :       (yyval) = new swq_expr_node( SWQ_CAST );
    2230                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (4)]) );
    2231                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
    2232                 :   ;}
    2233                 :     break;
    2234                 : 
    2235                 :   case 47:
    2236                 : 
    2237                 : /* Line 1455 of yacc.c  */
    2238                 : #line 489 "swq_parser.y"
    2239                 :     {
    2240                 :       (yyval) = new swq_expr_node( SWQ_CAST );
    2241                 :       (yyval)->PushSubExpression( (yyvsp[(5) - (6)]) );
    2242                 :       (yyval)->PushSubExpression( (yyvsp[(3) - (6)]) );
    2243                 :       (yyval)->PushSubExpression( (yyvsp[(1) - (6)]) );
    2244                 :   ;}
    2245                 :     break;
    2246                 : 
    2247                 :   case 50:
    2248                 : 
    2249                 : /* Line 1455 of yacc.c  */
    2250                 : #line 502 "swq_parser.y"
    2251                 :     {
    2252                 :         delete (yyvsp[(4) - (7)]);
    2253                 :     ;}
    2254                 :     break;
    2255                 : 
    2256                 :   case 53:
    2257                 : 
    2258                 : /* Line 1455 of yacc.c  */
    2259                 : #line 510 "swq_parser.y"
    2260                 :     {
    2261                 :         swq_select* poNewSelect = new swq_select();
    2262                 :         context->poCurSelect->PushUnionAll(poNewSelect);
    2263                 :         context->poCurSelect = poNewSelect;
    2264                 :     ;}
    2265                 :     break;
    2266                 : 
    2267                 :   case 56:
    2268                 : 
    2269                 : /* Line 1455 of yacc.c  */
    2270                 : #line 522 "swq_parser.y"
    2271                 :     {
    2272                 :     if( !context->poCurSelect->PushField( (yyvsp[(2) - (2)]), NULL, TRUE ) )
    2273                 :         {
    2274                 :             delete (yyvsp[(2) - (2)]);
    2275                 :         YYERROR;
    2276                 :         }
    2277                 :       ;}
    2278                 :     break;
    2279                 : 
    2280                 :   case 57:
    2281                 : 
    2282                 : /* Line 1455 of yacc.c  */
    2283                 : #line 531 "swq_parser.y"
    2284                 :     {
    2285                 :         if( !context->poCurSelect->PushField( (yyvsp[(2) - (2)]), NULL, TRUE ) )
    2286                 :         {
    2287                 :             delete (yyvsp[(2) - (2)]);
    2288                 :             YYERROR;
    2289                 :         }
    2290                 :         ;}
    2291                 :     break;
    2292                 : 
    2293                 :   case 58:
    2294                 : 
    2295                 : /* Line 1455 of yacc.c  */
    2296                 : #line 540 "swq_parser.y"
    2297                 :     {
    2298                 :     if( !context->poCurSelect->PushField( (yyvsp[(1) - (1)]) ) )
    2299                 :         {
    2300                 :             delete (yyvsp[(1) - (1)]);
    2301                 :         YYERROR;
    2302                 :         }
    2303                 :       ;}
    2304                 :     break;
    2305                 : 
    2306                 :   case 59:
    2307                 : 
    2308                 : /* Line 1455 of yacc.c  */
    2309                 : #line 549 "swq_parser.y"
    2310                 :     {
    2311                 :     if( !context->poCurSelect->PushField( (yyvsp[(2) - (4)]), (yyvsp[(4) - (4)])->string_value, TRUE ))
    2312                 :         {
    2313                 :             delete (yyvsp[(2) - (4)]);
    2314                 :             delete (yyvsp[(4) - (4)]);
    2315                 :         YYERROR;
    2316                 :         }
    2317                 : 
    2318                 :     delete (yyvsp[(4) - (4)]);
    2319                 :       ;}
    2320                 :     break;
    2321                 : 
    2322                 :   case 60:
    2323                 : 
    2324                 : /* Line 1455 of yacc.c  */
    2325                 : #line 561 "swq_parser.y"
    2326                 :     {
    2327                 :     if( !context->poCurSelect->PushField( (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])->string_value ) )
    2328                 :         {
    2329                 :             delete (yyvsp[(1) - (3)]);
    2330                 :             delete (yyvsp[(3) - (3)]);
    2331                 :         YYERROR;
    2332                 :         }
    2333                 :     delete (yyvsp[(3) - (3)]);
    2334                 :       ;}
    2335                 :     break;
    2336                 : 
    2337                 :   case 61:
    2338                 : 
    2339                 : /* Line 1455 of yacc.c  */
    2340                 : #line 572 "swq_parser.y"
    2341                 :     {
    2342                 :           swq_expr_node *poNode = new swq_expr_node();
    2343                 :     poNode->eNodeType = SNT_COLUMN;
    2344                 :     poNode->string_value = CPLStrdup( "*" );
    2345                 :     poNode->table_index = poNode->field_index = -1;
    2346                 : 
    2347                 :     if( !context->poCurSelect->PushField( poNode ) )
    2348                 :         {
    2349                 :             delete poNode;
    2350                 :         YYERROR;
    2351                 :         }
    2352                 :       ;}
    2353                 :     break;
    2354                 : 
    2355                 :   case 62:
    2356                 : 
    2357                 : /* Line 1455 of yacc.c  */
    2358                 : #line 586 "swq_parser.y"
    2359                 :     {
    2360                 :                 CPLString osQualifiedField;
    2361                 : 
    2362                 :                 osQualifiedField = (yyvsp[(1) - (3)])->string_value;
    2363                 :                 osQualifiedField += ".*";
    2364                 : 
    2365                 :                 delete (yyvsp[(1) - (3)]);
    2366                 :                 (yyvsp[(1) - (3)]) = NULL;
    2367                 : 
    2368                 :           swq_expr_node *poNode = new swq_expr_node();
    2369                 :     poNode->eNodeType = SNT_COLUMN;
    2370                 :     poNode->string_value = CPLStrdup( osQualifiedField );
    2371                 :     poNode->table_index = poNode->field_index = -1;
    2372                 : 
    2373                 :     if( !context->poCurSelect->PushField( poNode ) )
    2374                 :         {
    2375                 :             delete poNode;
    2376                 :         YYERROR;
    2377                 :         }
    2378                 :       ;}
    2379                 :     break;
    2380                 : 
    2381                 :   case 63:
    2382                 : 
    2383                 : /* Line 1455 of yacc.c  */
    2384                 : #line 608 "swq_parser.y"
    2385                 :     {
    2386                 :           // special case for COUNT(*), confirm it.
    2387                 :     if( !EQUAL((yyvsp[(1) - (4)])->string_value,"COUNT") )
    2388                 :     {
    2389                 :         CPLError( CE_Failure, CPLE_AppDefined,
    2390                 :                 "Syntax Error with %s(*).", 
    2391                 :             (yyvsp[(1) - (4)])->string_value );
    2392                 :             delete (yyvsp[(1) - (4)]);
    2393                 :               YYERROR;
    2394                 :     }
    2395                 : 
    2396                 :         delete (yyvsp[(1) - (4)]);
    2397                 :         (yyvsp[(1) - (4)]) = NULL;
    2398                 :                 
    2399                 :     swq_expr_node *poNode = new swq_expr_node();
    2400                 :     poNode->eNodeType = SNT_COLUMN;
    2401                 :     poNode->string_value = CPLStrdup( "*" );
    2402                 :     poNode->table_index = poNode->field_index = -1;
    2403                 : 
    2404                 :     swq_expr_node *count = new swq_expr_node( (swq_op)SWQ_COUNT );
    2405                 :     count->PushSubExpression( poNode );
    2406                 : 
    2407                 :     if( !context->poCurSelect->PushField( count ) )
    2408                 :         {
    2409                 :             delete count;
    2410                 :         YYERROR;
    2411                 :         }
    2412                 :       ;}
    2413                 :     break;
    2414                 : 
    2415                 :   case 64:
    2416                 : 
    2417                 : /* Line 1455 of yacc.c  */
    2418                 : #line 638 "swq_parser.y"
    2419                 :     {
    2420                 :           // special case for COUNT(*), confirm it.
    2421                 :     if( !EQUAL((yyvsp[(1) - (6)])->string_value,"COUNT") )
    2422                 :     {
    2423                 :         CPLError( CE_Failure, CPLE_AppDefined,
    2424                 :                 "Syntax Error with %s(*).", 
    2425                 :             (yyvsp[(1) - (6)])->string_value );
    2426                 :             delete (yyvsp[(1) - (6)]);
    2427                 :             delete (yyvsp[(6) - (6)]);
    2428                 :               YYERROR;
    2429                 :     }
    2430                 : 
    2431                 :         delete (yyvsp[(1) - (6)]);
    2432                 :         (yyvsp[(1) - (6)]) = NULL;
    2433                 : 
    2434                 :     swq_expr_node *poNode = new swq_expr_node();
    2435                 :     poNode->eNodeType = SNT_COLUMN;
    2436                 :     poNode->string_value = CPLStrdup( "*" );
    2437                 :     poNode->table_index = poNode->field_index = -1;
    2438                 : 
    2439                 :     swq_expr_node *count = new swq_expr_node( (swq_op)SWQ_COUNT );
    2440                 :     count->PushSubExpression( poNode );
    2441                 : 
    2442                 :     if( !context->poCurSelect->PushField( count, (yyvsp[(6) - (6)])->string_value ) )
    2443                 :         {
    2444                 :             delete count;
    2445                 :             delete (yyvsp[(6) - (6)]);
    2446                 :         YYERROR;
    2447                 :         }
    2448                 : 
    2449                 :                 delete (yyvsp[(6) - (6)]);
    2450                 :       ;}
    2451                 :     break;
    2452                 : 
    2453                 :   case 65:
    2454                 : 
    2455                 : /* Line 1455 of yacc.c  */
    2456                 : #line 672 "swq_parser.y"
    2457                 :     {
    2458                 :           // special case for COUNT(DISTINCT x), confirm it.
    2459                 :     if( !EQUAL((yyvsp[(1) - (5)])->string_value,"COUNT") )
    2460                 :     {
    2461                 :         CPLError( CE_Failure, CPLE_AppDefined,
    2462                 :                 "DISTINCT keyword can only be used in COUNT() operator." );
    2463                 :             delete (yyvsp[(1) - (5)]);
    2464                 :             delete (yyvsp[(4) - (5)]);
    2465                 :               YYERROR;
    2466                 :     }
    2467                 : 
    2468                 :                 delete (yyvsp[(1) - (5)]);
    2469                 :                 
    2470                 :                 swq_expr_node *count = new swq_expr_node( SWQ_COUNT );
    2471                 :                 count->PushSubExpression( (yyvsp[(4) - (5)]) );
    2472                 :                 
    2473                 :     if( !context->poCurSelect->PushField( count, NULL, TRUE ) )
    2474                 :         {
    2475                 :             delete count;
    2476                 :         YYERROR;
    2477                 :         }
    2478                 :       ;}
    2479                 :     break;
    2480                 : 
    2481                 :   case 66:
    2482                 : 
    2483                 : /* Line 1455 of yacc.c  */
    2484                 : #line 696 "swq_parser.y"
    2485                 :     {
    2486                 :           // special case for COUNT(DISTINCT x), confirm it.
    2487                 :     if( !EQUAL((yyvsp[(1) - (7)])->string_value,"COUNT") )
    2488                 :     {
    2489                 :         CPLError( CE_Failure, CPLE_AppDefined,
    2490                 :                 "DISTINCT keyword can only be used in COUNT() operator." );
    2491                 :             delete (yyvsp[(1) - (7)]);
    2492                 :             delete (yyvsp[(4) - (7)]);
    2493                 :             delete (yyvsp[(7) - (7)]);
    2494                 :               YYERROR;
    2495                 :     }
    2496                 : 
    2497                 :                 swq_expr_node *count = new swq_expr_node( SWQ_COUNT );
    2498                 :                 count->PushSubExpression( (yyvsp[(4) - (7)]) );
    2499                 :                 
    2500                 :     if( !context->poCurSelect->PushField( count, (yyvsp[(7) - (7)])->string_value, TRUE ) )
    2501                 :         {
    2502                 :             delete (yyvsp[(1) - (7)]);
    2503                 :             delete count;
    2504                 :             delete (yyvsp[(7) - (7)]);
    2505                 :         YYERROR;
    2506                 :         }
    2507                 : 
    2508                 :                 delete (yyvsp[(1) - (7)]);
    2509                 :                 delete (yyvsp[(7) - (7)]);
    2510                 :       ;}
    2511                 :     break;
    2512                 : 
    2513                 :   case 68:
    2514                 : 
    2515                 : /* Line 1455 of yacc.c  */
    2516                 : #line 725 "swq_parser.y"
    2517                 :     {      
    2518                 :          context->poCurSelect->where_expr = (yyvsp[(2) - (2)]);
    2519                 :       ;}
    2520                 :     break;
    2521                 : 
    2522                 :   case 70:
    2523                 : 
    2524                 : /* Line 1455 of yacc.c  */
    2525                 : #line 731 "swq_parser.y"
    2526                 :     {
    2527                 :           context->poCurSelect->PushJoin( (yyvsp[(2) - (7)])->int_value,
    2528                 :                (yyvsp[(4) - (7)])->string_value, 
    2529                 :                (yyvsp[(6) - (7)])->string_value );
    2530                 :                 delete (yyvsp[(2) - (7)]);
    2531                 :           delete (yyvsp[(4) - (7)]);
    2532                 :           delete (yyvsp[(6) - (7)]);
    2533                 :       ;}
    2534                 :     break;
    2535                 : 
    2536                 :   case 71:
    2537                 : 
    2538                 : /* Line 1455 of yacc.c  */
    2539                 : #line 740 "swq_parser.y"
    2540                 :     {
    2541                 :           context->poCurSelect->PushJoin( (yyvsp[(3) - (8)])->int_value,
    2542                 :                (yyvsp[(5) - (8)])->string_value, 
    2543                 :                (yyvsp[(7) - (8)])->string_value );
    2544                 :                 delete (yyvsp[(3) - (8)]);
    2545                 :           delete (yyvsp[(5) - (8)]);
    2546                 :           delete (yyvsp[(7) - (8)]);
    2547                 :       ;}
    2548                 :     break;
    2549                 : 
    2550                 :   case 76:
    2551                 : 
    2552                 : /* Line 1455 of yacc.c  */
    2553                 : #line 758 "swq_parser.y"
    2554                 :     {
    2555                 :                 context->poCurSelect->PushOrderBy( (yyvsp[(1) - (1)])->string_value, TRUE );
    2556                 :                 delete (yyvsp[(1) - (1)]);
    2557                 :                 (yyvsp[(1) - (1)]) = NULL;
    2558                 :             ;}
    2559                 :     break;
    2560                 : 
    2561                 :   case 77:
    2562                 : 
    2563                 : /* Line 1455 of yacc.c  */
    2564                 : #line 764 "swq_parser.y"
    2565                 :     {
    2566                 :                 context->poCurSelect->PushOrderBy( (yyvsp[(1) - (2)])->string_value, TRUE );
    2567                 :                 delete (yyvsp[(1) - (2)]);
    2568                 :                 (yyvsp[(1) - (2)]) = NULL;
    2569                 :             ;}
    2570                 :     break;
    2571                 : 
    2572                 :   case 78:
    2573                 : 
    2574                 : /* Line 1455 of yacc.c  */
    2575                 : #line 770 "swq_parser.y"
    2576                 :     {
    2577                 :                 context->poCurSelect->PushOrderBy( (yyvsp[(1) - (2)])->string_value, FALSE );
    2578                 :                 delete (yyvsp[(1) - (2)]);
    2579                 :                 (yyvsp[(1) - (2)]) = NULL;
    2580                 :             ;}
    2581                 :     break;
    2582                 : 
    2583                 :   case 79:
    2584                 : 
    2585                 : /* Line 1455 of yacc.c  */
    2586                 : #line 778 "swq_parser.y"
    2587                 :     {
    2588                 :             (yyval) = (yyvsp[(1) - (1)]);
    2589                 :         ;}
    2590                 :     break;
    2591                 : 
    2592                 :   case 80:
    2593                 : 
    2594                 : /* Line 1455 of yacc.c  */
    2595                 : #line 782 "swq_parser.y"
    2596                 :     {
    2597                 :             (yyval) = (yyvsp[(1) - (1)]);
    2598                 :         ;}
    2599                 :     break;
    2600                 : 
    2601                 :   case 81:
    2602                 : 
    2603                 : /* Line 1455 of yacc.c  */
    2604                 : #line 788 "swq_parser.y"
    2605                 :     {
    2606                 :       int iTable;
    2607                 :       iTable =context->poCurSelect->PushTableDef( NULL, (yyvsp[(1) - (1)])->string_value,
    2608                 :                            NULL );
    2609                 :       delete (yyvsp[(1) - (1)]);
    2610                 : 
    2611                 :       (yyval) = new swq_expr_node( iTable );
    2612                 :   ;}
    2613                 :     break;
    2614                 : 
    2615                 :   case 82:
    2616                 : 
    2617                 : /* Line 1455 of yacc.c  */
    2618                 : #line 798 "swq_parser.y"
    2619                 :     {
    2620                 :       int iTable;
    2621                 :       iTable = context->poCurSelect->PushTableDef( NULL, (yyvsp[(1) - (2)])->string_value,
    2622                 :                       (yyvsp[(2) - (2)])->string_value );
    2623                 :       delete (yyvsp[(1) - (2)]);
    2624                 :       delete (yyvsp[(2) - (2)]);
    2625                 : 
    2626                 :       (yyval) = new swq_expr_node( iTable );
    2627                 :   ;}
    2628                 :     break;
    2629                 : 
    2630                 :   case 83:
    2631                 : 
    2632                 : /* Line 1455 of yacc.c  */
    2633                 : #line 809 "swq_parser.y"
    2634                 :     {
    2635                 :       int iTable;
    2636                 :       iTable = context->poCurSelect->PushTableDef( (yyvsp[(1) - (3)])->string_value,
    2637                 :                       (yyvsp[(3) - (3)])->string_value, NULL );
    2638                 :       delete (yyvsp[(1) - (3)]);
    2639                 :       delete (yyvsp[(3) - (3)]);
    2640                 : 
    2641                 :       (yyval) = new swq_expr_node( iTable );
    2642                 :   ;}
    2643                 :     break;
    2644                 : 
    2645                 :   case 84:
    2646                 : 
    2647                 : /* Line 1455 of yacc.c  */
    2648                 : #line 820 "swq_parser.y"
    2649                 :     {
    2650                 :       int iTable;
    2651                 :       iTable = context->poCurSelect->PushTableDef( (yyvsp[(1) - (4)])->string_value,
    2652                 :                           (yyvsp[(3) - (4)])->string_value, 
    2653                 :                       (yyvsp[(4) - (4)])->string_value );
    2654                 :       delete (yyvsp[(1) - (4)]);
    2655                 :       delete (yyvsp[(3) - (4)]);
    2656                 :       delete (yyvsp[(4) - (4)]);
    2657                 : 
    2658                 :       (yyval) = new swq_expr_node( iTable );
    2659                 :   ;}
    2660                 :     break;
    2661                 : 
    2662                 : 
    2663                 : 
    2664                 : /* Line 1455 of yacc.c  */
    2665                 : #line 2666 "swq_parser.cpp"
    2666                 :       default: break;
    2667                 :     }
    2668                 :   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
    2669                 : 
    2670           17621 :   YYPOPSTACK (yylen);
    2671           17621 :   yylen = 0;
    2672                 :   YY_STACK_PRINT (yyss, yyssp);
    2673                 : 
    2674           17621 :   *++yyvsp = yyval;
    2675                 : 
    2676                 :   /* Now `shift' the result of the reduction.  Determine what state
    2677                 :      that goes to, based on the state we popped back to and the rule
    2678                 :      number reduced by.  */
    2679                 : 
    2680           17621 :   yyn = yyr1[yyn];
    2681                 : 
    2682           17621 :   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
    2683           23066 :   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    2684            5445 :     yystate = yytable[yystate];
    2685                 :   else
    2686           12176 :     yystate = yydefgoto[yyn - YYNTOKENS];
    2687                 : 
    2688           17621 :   goto yynewstate;
    2689                 : 
    2690                 : 
    2691                 : /*------------------------------------.
    2692                 : | yyerrlab -- here on detecting error |
    2693                 : `------------------------------------*/
    2694                 : yyerrlab:
    2695                 :   /* If not already recovering from an error, report this error.  */
    2696             112 :   if (!yyerrstatus)
    2697                 :     {
    2698             112 :       ++yynerrs;
    2699                 : #if ! YYERROR_VERBOSE
    2700             112 :       yyerror (context, YY_("syntax error"));
    2701                 : #else
    2702                 :       {
    2703                 :   YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
    2704                 :   if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
    2705                 :     {
    2706                 :       YYSIZE_T yyalloc = 2 * yysize;
    2707                 :       if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
    2708                 :         yyalloc = YYSTACK_ALLOC_MAXIMUM;
    2709                 :       if (yymsg != yymsgbuf)
    2710                 :         YYSTACK_FREE (yymsg);
    2711                 :       yymsg = (char *) YYSTACK_ALLOC (yyalloc);
    2712                 :       if (yymsg)
    2713                 :         yymsg_alloc = yyalloc;
    2714                 :       else
    2715                 :         {
    2716                 :     yymsg = yymsgbuf;
    2717                 :     yymsg_alloc = sizeof yymsgbuf;
    2718                 :         }
    2719                 :     }
    2720                 : 
    2721                 :   if (0 < yysize && yysize <= yymsg_alloc)
    2722                 :     {
    2723                 :       (void) yysyntax_error (yymsg, yystate, yychar);
    2724                 :       yyerror (context, yymsg);
    2725                 :     }
    2726                 :   else
    2727                 :     {
    2728                 :       yyerror (context, YY_("syntax error"));
    2729                 :       if (yysize != 0)
    2730                 :         goto yyexhaustedlab;
    2731                 :     }
    2732                 :       }
    2733                 : #endif
    2734                 :     }
    2735                 : 
    2736                 : 
    2737                 : 
    2738             112 :   if (yyerrstatus == 3)
    2739                 :     {
    2740                 :       /* If just tried and failed to reuse lookahead token after an
    2741                 :    error, discard it.  */
    2742                 : 
    2743               0 :       if (yychar <= YYEOF)
    2744                 :   {
    2745                 :     /* Return failure if at end of input.  */
    2746               0 :     if (yychar == YYEOF)
    2747               0 :       YYABORT;
    2748                 :   }
    2749                 :       else
    2750                 :   {
    2751                 :     yydestruct ("Error: discarding",
    2752               0 :           yytoken, &yylval, context);
    2753               0 :     yychar = YYEMPTY;
    2754                 :   }
    2755                 :     }
    2756                 : 
    2757                 :   /* Else will try to reuse lookahead token after shifting the error
    2758                 :      token.  */
    2759             112 :   goto yyerrlab1;
    2760                 : 
    2761                 : 
    2762                 : /*---------------------------------------------------.
    2763                 : | yyerrorlab -- error raised explicitly by YYERROR.  |
    2764                 : `---------------------------------------------------*/
    2765                 : yyerrorlab:
    2766                 : 
    2767                 :   /* Pacify compilers like GCC when the user code never invokes
    2768                 :      YYERROR and the label yyerrorlab therefore never appears in user
    2769                 :      code.  */
    2770                 :   if (/*CONSTCOND*/ 0)
    2771                 :      goto yyerrorlab;
    2772                 : 
    2773                 :   /* Do not reclaim the symbols of the rule which action triggered
    2774                 :      this YYERROR.  */
    2775               9 :   YYPOPSTACK (yylen);
    2776               9 :   yylen = 0;
    2777                 :   YY_STACK_PRINT (yyss, yyssp);
    2778               9 :   yystate = *yyssp;
    2779                 :   goto yyerrlab1;
    2780                 : 
    2781                 : 
    2782                 : /*-------------------------------------------------------------.
    2783                 : | yyerrlab1 -- common code for both syntax error and YYERROR.  |
    2784                 : `-------------------------------------------------------------*/
    2785                 : yyerrlab1:
    2786             121 :   yyerrstatus = 3;  /* Each real token shifted decrements this.  */
    2787                 : 
    2788             502 :   for (;;)
    2789                 :     {
    2790             623 :       yyn = yypact[yystate];
    2791             623 :       if (yyn != YYPACT_NINF)
    2792                 :   {
    2793             623 :     yyn += YYTERROR;
    2794             623 :     if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
    2795                 :       {
    2796               0 :         yyn = yytable[yyn];
    2797               0 :         if (0 < yyn)
    2798                 :     break;
    2799                 :       }
    2800                 :   }
    2801                 : 
    2802                 :       /* Pop the current state because it cannot handle the error token.  */
    2803             623 :       if (yyssp == yyss)
    2804             121 :   YYABORT;
    2805                 : 
    2806                 : 
    2807                 :       yydestruct ("Error: popping",
    2808             502 :       yystos[yystate], yyvsp, context);
    2809             502 :       YYPOPSTACK (1);
    2810             502 :       yystate = *yyssp;
    2811                 :       YY_STACK_PRINT (yyss, yyssp);
    2812                 :     }
    2813                 : 
    2814               0 :   *++yyvsp = yylval;
    2815                 : 
    2816                 : 
    2817                 :   /* Shift the error token.  */
    2818                 :   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
    2819                 : 
    2820               0 :   yystate = yyn;
    2821               0 :   goto yynewstate;
    2822                 : 
    2823                 : 
    2824                 : /*-------------------------------------.
    2825                 : | yyacceptlab -- YYACCEPT comes here.  |
    2826                 : `-------------------------------------*/
    2827                 : yyacceptlab:
    2828            1342 :   yyresult = 0;
    2829            1342 :   goto yyreturn;
    2830                 : 
    2831                 : /*-----------------------------------.
    2832                 : | yyabortlab -- YYABORT comes here.  |
    2833                 : `-----------------------------------*/
    2834                 : yyabortlab:
    2835             121 :   yyresult = 1;
    2836             121 :   goto yyreturn;
    2837                 : 
    2838                 : #if !defined(yyoverflow) || YYERROR_VERBOSE
    2839                 : /*-------------------------------------------------.
    2840                 : | yyexhaustedlab -- memory exhaustion comes here.  |
    2841                 : `-------------------------------------------------*/
    2842                 : yyexhaustedlab:
    2843               0 :   yyerror (context, YY_("memory exhausted"));
    2844               0 :   yyresult = 2;
    2845                 :   /* Fall through.  */
    2846                 : #endif
    2847                 : 
    2848                 : yyreturn:
    2849            1463 :   if (yychar != YYEMPTY)
    2850                 :      yydestruct ("Cleanup: discarding lookahead",
    2851             119 :      yytoken, &yylval, context);
    2852                 :   /* Do not reclaim the symbols of the rule which action triggered
    2853                 :      this YYABORT or YYACCEPT.  */
    2854            1463 :   YYPOPSTACK (yylen);
    2855                 :   YY_STACK_PRINT (yyss, yyssp);
    2856            5610 :   while (yyssp != yyss)
    2857                 :     {
    2858                 :       yydestruct ("Cleanup: popping",
    2859            2684 :       yystos[*yyssp], yyvsp, context);
    2860            2684 :       YYPOPSTACK (1);
    2861                 :     }
    2862                 : #ifndef yyoverflow
    2863            1463 :   if (yyss != yyssa)
    2864               1 :     YYSTACK_FREE (yyss);
    2865                 : #endif
    2866                 : #if YYERROR_VERBOSE
    2867                 :   if (yymsg != yymsgbuf)
    2868                 :     YYSTACK_FREE (yymsg);
    2869                 : #endif
    2870                 :   /* Make sure YYID is used.  */
    2871            1463 :   return YYID (yyresult);
    2872                 : }
    2873                 : 
    2874                 : 
    2875                 : 

Generated by: LCOV version 1.7