Back to index

lightning-sunbird  0.9+nobinonly
icalssyacc.c
Go to the documentation of this file.
00001 /* A Bison parser, made from icalssyacc.y
00002    by GNU bison 1.34.  */
00003 
00004 #define YYBISON 1  /* Identify Bison output.  */
00005 
00006 #define yyparse ssparse
00007 #define yylex sslex
00008 #define yyerror sserror
00009 #define yylval sslval
00010 #define yychar sschar
00011 #define yydebug ssdebug
00012 #define yynerrs ssnerrs
00013 # define      STRING 257
00014 # define      SELECT 258
00015 # define      FROM   259
00016 # define      WHERE  260
00017 # define      COMMA  261
00018 # define      QUOTE  262
00019 # define      EQUALS 263
00020 # define      NOTEQUALS     264
00021 # define      LESS   265
00022 # define      GREATER       266
00023 # define      LESSEQUALS    267
00024 # define      GREATEREQUALS 268
00025 # define      AND    269
00026 # define      OR     270
00027 # define      EOL    271
00028 # define      END    272
00029 # define      IS     273
00030 # define      NOT    274
00031 # define      SQLNULL       275
00032 
00033 #line 3 "icalssyacc.y"
00034 
00035 /* -*- Mode: C -*-
00036   ======================================================================
00037   FILE: icalssyacc.y
00038   CREATOR: eric 08 Aug 2000
00039   
00040   DESCRIPTION:
00041   
00042   $Id: icalssyacc.c,v 1.7 2002/07/21 17:18:15 lindner Exp $
00043   $Locker:  $
00044 
00045 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
00046 
00047  This program is free software; you can redistribute it and/or modify
00048  it under the terms of either: 
00049 
00050     The LGPL as published by the Free Software Foundation, version
00051     2.1, available at: http://www.fsf.org/copyleft/lesser.html
00052 
00053   Or:
00054 
00055     The Mozilla Public License Version 1.0. You may obtain a copy of
00056     the License at http://www.mozilla.org/MPL/
00057 
00058  The Original Code is eric. The Initial Developer of the Original
00059  Code is Eric Busboom
00060 
00061   ======================================================================*/
00062 /*#define YYDEBUG 1*/
00063 #include <stdlib.h>
00064 #include <string.h> /* for strdup() */
00065 #include <limits.h> /* for SHRT_MAX*/
00066 #include "ical.h"
00067 #include "icalgauge.h"
00068 #include "icalgaugeimpl.h"
00069 
00070 
00071 #define YYPARSE_PARAM yy_globals
00072 #define YYLEX_PARAM yy_globals
00073 #define YY_EXTRA_TYPE  icalgauge_impl*
00074   /* ick...*/
00075 #define yyextra ((struct icalgauge_impl*)ssget_extra(yy_globals))
00076 
00077 
00078 static void ssyacc_add_where(struct icalgauge_impl* impl, char* prop, 
00079                      icalgaugecompare compare , char* value);
00080 static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
00081 static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
00082 static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
00083 void sserror(char *s); /* Don't know why I need this.... */
00084 
00085 
00086 #line 56 "icalssyacc.y"
00087 #ifndef YYSTYPE
00088 typedef union {
00089        char* v_string;
00090 } yystype;
00091 # define YYSTYPE yystype
00092 #endif
00093 #ifndef YYDEBUG
00094 # define YYDEBUG 0
00095 #endif
00096 
00097 
00098 
00099 #define       YYFINAL              38
00100 #define       YYFLAG        -32768
00101 #define       YYNTBASE      22
00102 
00103 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
00104 #define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 27)
00105 
00106 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
00107 static const char yytranslate[] =
00108 {
00109        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00110        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00111        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00112        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00113        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00114        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00115        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00116        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00117        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00118        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00119        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00120        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00121        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00122        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00123        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00124        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00125        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00126        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00127        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00128        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00129        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00130        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00131        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00132        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00133        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00134        2,     2,     2,     2,     2,     2,     1,     3,     4,     5,
00135        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
00136       16,    17,    18,    19,    20,    21
00137 };
00138 
00139 #if YYDEBUG
00140 static const short yyprhs[] =
00141 {
00142        0,     0,     7,    12,    14,    16,    20,    22,    26,    27,
00143       31,    35,    40,    44,    48,    52,    56,    60,    62,    66
00144 };
00145 static const short yyrhs[] =
00146 {
00147        4,    23,     5,    24,     6,    26,     0,     4,    23,     5,
00148       24,     0,     1,     0,     3,     0,    23,     7,     3,     0,
00149        3,     0,    24,     7,     3,     0,     0,     3,     9,     3,
00150        0,     3,    19,    21,     0,     3,    19,    20,    21,     0,
00151        3,    10,     3,     0,     3,    11,     3,     0,     3,    12,
00152        3,     0,     3,    13,     3,     0,     3,    14,     3,     0,
00153       25,     0,    26,    15,    25,     0,    26,    16,    25,     0
00154 };
00155 
00156 #endif
00157 
00158 #if YYDEBUG
00159 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
00160 static const short yyrline[] =
00161 {
00162        0,    67,    68,    69,    75,    77,    81,    83,    86,    88,
00163       89,    90,    91,    92,    93,    94,    95,    98,   100,   101
00164 };
00165 #endif
00166 
00167 
00168 #if (YYDEBUG) || defined YYERROR_VERBOSE
00169 
00170 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
00171 static const char *const yytname[] =
00172 {
00173   "$", "error", "$undefined.", "STRING", "SELECT", "FROM", "WHERE", "COMMA", 
00174   "QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS", 
00175   "GREATEREQUALS", "AND", "OR", "EOL", "END", "IS", "NOT", "SQLNULL", 
00176   "query_min", "select_list", "from_list", "where_clause", "where_list", 0
00177 };
00178 #endif
00179 
00180 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
00181 static const short yyr1[] =
00182 {
00183        0,    22,    22,    22,    23,    23,    24,    24,    25,    25,
00184       25,    25,    25,    25,    25,    25,    25,    26,    26,    26
00185 };
00186 
00187 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
00188 static const short yyr2[] =
00189 {
00190        0,     6,     4,     1,     1,     3,     1,     3,     0,     3,
00191        3,     4,     3,     3,     3,     3,     3,     1,     3,     3
00192 };
00193 
00194 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
00195    doesn't specify something else to do.  Zero means the default is an
00196    error. */
00197 static const short yydefact[] =
00198 {
00199        0,     3,     0,     4,     0,     0,     0,     6,     2,     5,
00200        8,     0,     0,    17,     1,     7,     0,     0,     0,     0,
00201        0,     0,     0,     8,     8,     9,    12,    13,    14,    15,
00202       16,     0,    10,    18,    19,    11,     0,     0,     0
00203 };
00204 
00205 static const short yydefgoto[] =
00206 {
00207       36,     4,     8,    13,    14
00208 };
00209 
00210 static const short yypact[] =
00211 {
00212        5,-32768,     9,-32768,     6,    17,    18,-32768,     1,-32768,
00213       19,    20,    -9,-32768,    -1,-32768,    21,    22,    23,    24,
00214       25,    26,    -4,    19,    19,-32768,-32768,-32768,-32768,-32768,
00215   -32768,    10,-32768,-32768,-32768,-32768,    30,    32,-32768
00216 };
00217 
00218 static const short yypgoto[] =
00219 {
00220   -32768,-32768,-32768,    -5,-32768
00221 };
00222 
00223 
00224 #define       YYLAST        32
00225 
00226 
00227 static const short yytable[] =
00228 {
00229       16,    17,    18,    19,    20,    21,     1,    10,    11,     2,
00230       22,     5,     3,     6,    23,    24,    31,    32,    33,    34,
00231        7,     9,    12,    15,    25,    26,    27,    28,    29,    30,
00232       37,    35,    38
00233 };
00234 
00235 static const short yycheck[] =
00236 {
00237        9,    10,    11,    12,    13,    14,     1,     6,     7,     4,
00238       19,     5,     3,     7,    15,    16,    20,    21,    23,    24,
00239        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
00240        0,    21,     0
00241 };
00242 #define YYPURE 1
00243 
00244 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
00245 #line 3 "/usr/local/share/bison/bison.simple"
00246 
00247 /* Skeleton output parser for bison,
00248 
00249    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
00250    Foundation, Inc.
00251 
00252    This program is free software; you can redistribute it and/or modify
00253    it under the terms of the GNU General Public License as published by
00254    the Free Software Foundation; either version 2, or (at your option)
00255    any later version.
00256 
00257    This program is distributed in the hope that it will be useful,
00258    but WITHOUT ANY WARRANTY; without even the implied warranty of
00259    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00260    GNU General Public License for more details.
00261 
00262    You should have received a copy of the GNU General Public License
00263    along with this program; if not, write to the Free Software
00264    Foundation, Inc., 59 Temple Place - Suite 330,
00265    Boston, MA 02111-1307, USA.  */
00266 
00267 /* As a special exception, when this file is copied by Bison into a
00268    Bison output file, you may use that output file without restriction.
00269    This special exception was added by the Free Software Foundation
00270    in version 1.24 of Bison.  */
00271 
00272 /* This is the parser code that is written into each bison parser when
00273    the %semantic_parser declaration is not specified in the grammar.
00274    It was written by Richard Stallman by simplifying the hairy parser
00275    used when %semantic_parser is specified.  */
00276 
00277 /* All symbols defined below should begin with yy or YY, to avoid
00278    infringing on user name space.  This should be done even for local
00279    variables, as they might otherwise be expanded by user macros.
00280    There are some unavoidable exceptions within include files to
00281    define necessary library symbols; they are noted "INFRINGES ON
00282    USER NAME SPACE" below.  */
00283 
00284 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
00285 
00286 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00287 
00288 # if YYSTACK_USE_ALLOCA
00289 #  define YYSTACK_ALLOC alloca
00290 # else
00291 #  ifndef YYSTACK_USE_ALLOCA
00292 #   if defined (alloca) || defined (_ALLOCA_H)
00293 #    define YYSTACK_ALLOC alloca
00294 #   else
00295 #    ifdef __GNUC__
00296 #     define YYSTACK_ALLOC __builtin_alloca
00297 #    endif
00298 #   endif
00299 #  endif
00300 # endif
00301 
00302 # ifdef YYSTACK_ALLOC
00303    /* Pacify GCC's `empty if-body' warning. */
00304 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
00305 # else
00306 #  if defined (__STDC__) || defined (__cplusplus)
00307 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00308 #   define YYSIZE_T size_t
00309 #  endif
00310 #  define YYSTACK_ALLOC malloc
00311 #  define YYSTACK_FREE free
00312 # endif
00313 
00314 /* A type that is properly aligned for any stack member.  */
00315 union yyalloc
00316 {
00317   short yyss;
00318   YYSTYPE yyvs;
00319 # if YYLSP_NEEDED
00320   YYLTYPE yyls;
00321 # endif
00322 };
00323 
00324 /* The size of the maximum gap between one aligned stack and the next.  */
00325 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
00326 
00327 /* The size of an array large to enough to hold all stacks, each with
00328    N elements.  */
00329 # if YYLSP_NEEDED
00330 #  define YYSTACK_BYTES(N) \
00331      ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))    \
00332       + 2 * YYSTACK_GAP_MAX)
00333 # else
00334 #  define YYSTACK_BYTES(N) \
00335      ((N) * (sizeof (short) + sizeof (YYSTYPE))                       \
00336       + YYSTACK_GAP_MAX)
00337 # endif
00338 
00339 /* Relocate the TYPE STACK from its old location to the new one.  The
00340    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00341    elements in the stack, and YYPTR gives the new location of the
00342    stack.  Advance YYPTR to a properly aligned location for the next
00343    stack.  */
00344 # define YYSTACK_RELOCATE(Type, Stack)                                \
00345     do                                                         \
00346       {                                                               \
00347        YYSIZE_T yynewbytes;                                    \
00348        yymemcpy ((char *) yyptr, (char *) (Stack),                    \
00349                 yysize * (YYSIZE_T) sizeof (Type));                   \
00350        Stack = &yyptr->Stack;                                         \
00351        yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX;    \
00352        yyptr += yynewbytes / sizeof (*yyptr);                         \
00353       }                                                               \
00354     while (0)
00355 
00356 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
00357 
00358 
00359 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
00360 # define YYSIZE_T __SIZE_TYPE__
00361 #endif
00362 #if ! defined (YYSIZE_T) && defined (size_t)
00363 # define YYSIZE_T size_t
00364 #endif
00365 #if ! defined (YYSIZE_T)
00366 # if defined (__STDC__) || defined (__cplusplus)
00367 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00368 #  define YYSIZE_T size_t
00369 # endif
00370 #endif
00371 #if ! defined (YYSIZE_T)
00372 # define YYSIZE_T unsigned int
00373 #endif
00374 
00375 #define yyerrok             (yyerrstatus = 0)
00376 #define yyclearin    (yychar = YYEMPTY)
00377 #define YYEMPTY             -2
00378 #define YYEOF        0
00379 #define YYACCEPT     goto yyacceptlab
00380 #define YYABORT      goto yyabortlab
00381 #define YYERROR             goto yyerrlab1
00382 /* Like YYERROR except do call yyerror.  This remains here temporarily
00383    to ease the transition to the new meaning of YYERROR, for GCC.
00384    Once GCC version 2 has supplanted version 1, this can go.  */
00385 #define YYFAIL              goto yyerrlab
00386 #define YYRECOVERING()  (!!yyerrstatus)
00387 #define YYBACKUP(Token, Value)                                 \
00388 do                                                      \
00389   if (yychar == YYEMPTY && yylen == 1)                         \
00390     {                                                   \
00391       yychar = (Token);                                        \
00392       yylval = (Value);                                        \
00393       yychar1 = YYTRANSLATE (yychar);                          \
00394       YYPOPSTACK;                                       \
00395       goto yybackup;                                    \
00396     }                                                   \
00397   else                                                  \
00398     {                                                   \
00399       yyerror ("syntax error: cannot back up");                \
00400       YYERROR;                                                 \
00401     }                                                   \
00402 while (0)
00403 
00404 #define YYTERROR     1
00405 #define YYERRCODE    256
00406 
00407 
00408 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
00409    are run).
00410 
00411    When YYLLOC_DEFAULT is run, CURRENT is set the location of the
00412    first token.  By default, to implement support for ranges, extend
00413    its range to the last symbol.  */
00414 
00415 #ifndef YYLLOC_DEFAULT
00416 # define YYLLOC_DEFAULT(Current, Rhs, N)         \
00417    Current.last_line   = Rhs[N].last_line;       \
00418    Current.last_column = Rhs[N].last_column;
00419 #endif
00420 
00421 
00422 /* YYLEX -- calling `yylex' with the right arguments.  */
00423 
00424 #if YYPURE
00425 # if YYLSP_NEEDED
00426 #  ifdef YYLEX_PARAM
00427 #   define YYLEX            yylex (&yylval, &yylloc, YYLEX_PARAM)
00428 #  else
00429 #   define YYLEX            yylex (&yylval, &yylloc)
00430 #  endif
00431 # else /* !YYLSP_NEEDED */
00432 #  ifdef YYLEX_PARAM
00433 #   define YYLEX            yylex (&yylval, YYLEX_PARAM)
00434 #  else
00435 #   define YYLEX            yylex (&yylval)
00436 #  endif
00437 # endif /* !YYLSP_NEEDED */
00438 #else /* !YYPURE */
00439 # define YYLEX                     yylex ()
00440 #endif /* !YYPURE */
00441 
00442 
00443 /* Enable debugging if requested.  */
00444 #if YYDEBUG
00445 
00446 # ifndef YYFPRINTF
00447 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00448 #  define YYFPRINTF fprintf
00449 # endif
00450 
00451 # define YYDPRINTF(Args)                  \
00452 do {                                      \
00453   if (yydebug)                                   \
00454     YYFPRINTF Args;                       \
00455 } while (0)
00456 /* Nonzero means print parse trace.  It is left uninitialized so that
00457    multiple parsers can coexist.  */
00458 int yydebug;
00459 #else /* !YYDEBUG */
00460 # define YYDPRINTF(Args)
00461 #endif /* !YYDEBUG */
00462 
00463 /* YYINITDEPTH -- initial size of the parser's stacks.  */
00464 #ifndef       YYINITDEPTH
00465 # define YYINITDEPTH 200
00466 #endif
00467 
00468 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
00469    if the built-in stack extension method is used).
00470 
00471    Do not make this value too large; the results are undefined if
00472    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
00473    evaluated with infinite-precision integer arithmetic.  */
00474 
00475 #if YYMAXDEPTH == 0
00476 # undef YYMAXDEPTH
00477 #endif
00478 
00479 #ifndef YYMAXDEPTH
00480 # define YYMAXDEPTH 10000
00481 #endif
00482 
00483 #if ! defined (yyoverflow) && ! defined (yymemcpy)
00484 # if __GNUC__ > 1           /* GNU C and GNU C++ define this.  */
00485 #  define yymemcpy __builtin_memcpy
00486 # else                      /* not GNU C or C++ */
00487 
00488 /* This is the most reliable way to avoid incompatibilities
00489    in available built-in functions on various systems.  */
00490 static void
00491 #  if defined (__STDC__) || defined (__cplusplus)
00492 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
00493 #  else
00494 yymemcpy (yyto, yyfrom, yycount)
00495      char *yyto;
00496      const char *yyfrom;
00497      YYSIZE_T yycount;
00498 #  endif
00499 {
00500   register const char *yyf = yyfrom;
00501   register char *yyt = yyto;
00502   register YYSIZE_T yyi = yycount;
00503 
00504   while (yyi-- != 0)
00505     *yyt++ = *yyf++;
00506 }
00507 # endif
00508 #endif
00509 
00510 #ifdef YYERROR_VERBOSE
00511 
00512 # ifndef yystrlen
00513 #  if defined (__GLIBC__) && defined (_STRING_H)
00514 #   define yystrlen strlen
00515 #  else
00516 /* Return the length of YYSTR.  */
00517 static YYSIZE_T
00518 #   if defined (__STDC__) || defined (__cplusplus)
00519 yystrlen (const char *yystr)
00520 #   else
00521 yystrlen (yystr)
00522      const char *yystr;
00523 #   endif
00524 {
00525   register const char *yys = yystr;
00526 
00527   while (*yys++ != '\0')
00528     continue;
00529 
00530   return yys - yystr - 1;
00531 }
00532 #  endif
00533 # endif
00534 
00535 # ifndef yystpcpy
00536 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
00537 #   define yystpcpy stpcpy
00538 #  else
00539 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
00540    YYDEST.  */
00541 static char *
00542 #   if defined (__STDC__) || defined (__cplusplus)
00543 yystpcpy (char *yydest, const char *yysrc)
00544 #   else
00545 yystpcpy (yydest, yysrc)
00546      char *yydest;
00547      const char *yysrc;
00548 #   endif
00549 {
00550   register char *yyd = yydest;
00551   register const char *yys = yysrc;
00552 
00553   while ((*yyd++ = *yys++) != '\0')
00554     continue;
00555 
00556   return yyd - 1;
00557 }
00558 #  endif
00559 # endif
00560 #endif
00561 
00562 #line 319 "/usr/local/share/bison/bison.simple"
00563 
00564 
00565 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
00566    into yyparse.  The argument should have type void *.
00567    It should actually point to an object.
00568    Grammar actions can access the variable by casting it
00569    to the proper pointer type.  */
00570 
00571 #ifdef YYPARSE_PARAM
00572 # if defined (__STDC__) || defined (__cplusplus)
00573 #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
00574 #  define YYPARSE_PARAM_DECL
00575 # else
00576 #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
00577 #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
00578 # endif
00579 #else /* !YYPARSE_PARAM */
00580 # define YYPARSE_PARAM_ARG
00581 # define YYPARSE_PARAM_DECL
00582 #endif /* !YYPARSE_PARAM */
00583 
00584 /* Prevent warning if -Wstrict-prototypes.  */
00585 #ifdef __GNUC__
00586 # ifdef YYPARSE_PARAM
00587 int yyparse (void *);
00588 # else
00589 int yyparse (void);
00590 # endif
00591 #endif
00592 
00593 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
00594    variables are global, or local to YYPARSE.  */
00595 
00596 #define YY_DECL_NON_LSP_VARIABLES                \
00597 /* The lookahead symbol.  */                            \
00598 int yychar;                                      \
00599                                                  \
00600 /* The semantic value of the lookahead symbol. */       \
00601 YYSTYPE yylval;                                         \
00602                                                  \
00603 /* Number of parse errors so far.  */                   \
00604 int yynerrs;
00605 
00606 #if YYLSP_NEEDED
00607 # define YY_DECL_VARIABLES                \
00608 YY_DECL_NON_LSP_VARIABLES                 \
00609                                           \
00610 /* Location data for the lookahead symbol.  */   \
00611 YYLTYPE yylloc;
00612 #else
00613 # define YY_DECL_VARIABLES                \
00614 YY_DECL_NON_LSP_VARIABLES
00615 #endif
00616 
00617 
00618 /* If nonreentrant, generate the variables here. */
00619 
00620 #if !YYPURE
00621 YY_DECL_VARIABLES
00622 #endif  /* !YYPURE */
00623 
00624 int
00625 yyparse (YYPARSE_PARAM_ARG)
00626      YYPARSE_PARAM_DECL
00627 {
00628   /* If reentrant, generate the variables here. */
00629 #if YYPURE
00630   YY_DECL_VARIABLES
00631 #endif  /* !YYPURE */
00632 
00633   register int yystate;
00634   register int yyn;
00635   int yyresult;
00636   /* Number of tokens to shift before error messages enabled.  */
00637   int yyerrstatus;
00638   /* Lookahead token as an internal (translated) token number.  */
00639   int yychar1 = 0;
00640 
00641   /* Three stacks and their tools:
00642      `yyss': related to states,
00643      `yyvs': related to semantic values,
00644      `yyls': related to locations.
00645 
00646      Refer to the stacks thru separate pointers, to allow yyoverflow
00647      to reallocate them elsewhere.  */
00648 
00649   /* The state stack. */
00650   short       yyssa[YYINITDEPTH];
00651   short *yyss = yyssa;
00652   register short *yyssp;
00653 
00654   /* The semantic value stack.  */
00655   YYSTYPE yyvsa[YYINITDEPTH];
00656   YYSTYPE *yyvs = yyvsa;
00657   register YYSTYPE *yyvsp;
00658 
00659 #if YYLSP_NEEDED
00660   /* The location stack.  */
00661   YYLTYPE yylsa[YYINITDEPTH];
00662   YYLTYPE *yyls = yylsa;
00663   YYLTYPE *yylsp;
00664 #endif
00665 
00666 #if YYLSP_NEEDED
00667 # define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
00668 #else
00669 # define YYPOPSTACK   (yyvsp--, yyssp--)
00670 #endif
00671 
00672   YYSIZE_T yystacksize = YYINITDEPTH;
00673 
00674 
00675   /* The variables used to return semantic value and location from the
00676      action routines.  */
00677   YYSTYPE yyval;
00678 #if YYLSP_NEEDED
00679   YYLTYPE yyloc;
00680 #endif
00681 
00682   /* When reducing, the number of symbols on the RHS of the reduced
00683      rule. */
00684   int yylen;
00685 
00686   YYDPRINTF ((stderr, "Starting parse\n"));
00687 
00688   yystate = 0;
00689   yyerrstatus = 0;
00690   yynerrs = 0;
00691   yychar = YYEMPTY;         /* Cause a token to be read.  */
00692 
00693   /* Initialize stack pointers.
00694      Waste one element of value and location stack
00695      so that they stay on the same level as the state stack.
00696      The wasted elements are never initialized.  */
00697 
00698   yyssp = yyss;
00699   yyvsp = yyvs;
00700 #if YYLSP_NEEDED
00701   yylsp = yyls;
00702 #endif
00703   goto yysetstate;
00704 
00705 /*------------------------------------------------------------.
00706 | yynewstate -- Push a new state, which is found in yystate.  |
00707 `------------------------------------------------------------*/
00708  yynewstate:
00709   /* In all cases, when you get here, the value and location stacks
00710      have just been pushed. so pushing a state here evens the stacks.
00711      */
00712   yyssp++;
00713 
00714  yysetstate:
00715   *yyssp = yystate;
00716 
00717   if (yyssp >= yyss + yystacksize - 1)
00718     {
00719       /* Get the current used size of the three stacks, in elements.  */
00720       YYSIZE_T yysize = yyssp - yyss + 1;
00721 
00722 #ifdef yyoverflow
00723       {
00724        /* Give user a chance to reallocate the stack. Use copies of
00725           these so that the &'s don't force the real ones into
00726           memory.  */
00727        YYSTYPE *yyvs1 = yyvs;
00728        short *yyss1 = yyss;
00729 
00730        /* Each stack pointer address is followed by the size of the
00731           data in use in that stack, in bytes.  */
00732 # if YYLSP_NEEDED
00733        YYLTYPE *yyls1 = yyls;
00734        /* This used to be a conditional around just the two extra args,
00735           but that might be undefined if yyoverflow is a macro.  */
00736        yyoverflow ("parser stack overflow",
00737                   &yyss1, yysize * sizeof (*yyssp),
00738                   &yyvs1, yysize * sizeof (*yyvsp),
00739                   &yyls1, yysize * sizeof (*yylsp),
00740                   &yystacksize);
00741        yyls = yyls1;
00742 # else
00743        yyoverflow ("parser stack overflow",
00744                   &yyss1, yysize * sizeof (*yyssp),
00745                   &yyvs1, yysize * sizeof (*yyvsp),
00746                   &yystacksize);
00747 # endif
00748        yyss = yyss1;
00749        yyvs = yyvs1;
00750       }
00751 #else /* no yyoverflow */
00752       /* Extend the stack our own way.  */
00753       if (yystacksize >= YYMAXDEPTH)
00754        goto yyoverflowlab;
00755       yystacksize *= 2;
00756       if (yystacksize > YYMAXDEPTH)
00757        yystacksize = YYMAXDEPTH;
00758 
00759       {
00760        short *yyss1 = yyss;
00761        union yyalloc *yyptr =
00762          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
00763        if (! yyptr)
00764          goto yyoverflowlab;
00765        YYSTACK_RELOCATE (short, yyss);
00766        YYSTACK_RELOCATE (YYSTYPE, yyvs);
00767 # if YYLSP_NEEDED
00768        YYSTACK_RELOCATE (YYLTYPE, yyls);
00769 # endif
00770 # undef YYSTACK_RELOCATE
00771        if (yyss1 != yyssa)
00772          YYSTACK_FREE (yyss1);
00773       }
00774 #endif /* no yyoverflow */
00775 
00776       yyssp = yyss + yysize - 1;
00777       yyvsp = yyvs + yysize - 1;
00778 #if YYLSP_NEEDED
00779       yylsp = yyls + yysize - 1;
00780 #endif
00781 
00782       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
00783                 (unsigned long int) yystacksize));
00784 
00785       if (yyssp >= yyss + yystacksize - 1)
00786        YYABORT;
00787     }
00788 
00789   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
00790 
00791   goto yybackup;
00792 
00793 
00794 /*-----------.
00795 | yybackup.  |
00796 `-----------*/
00797 yybackup:
00798 
00799 /* Do appropriate processing given the current state.  */
00800 /* Read a lookahead token if we need one and don't already have one.  */
00801 /* yyresume: */
00802 
00803   /* First try to decide what to do without reference to lookahead token.  */
00804 
00805   yyn = yypact[yystate];
00806   if (yyn == YYFLAG)
00807     goto yydefault;
00808 
00809   /* Not known => get a lookahead token if don't already have one.  */
00810 
00811   /* yychar is either YYEMPTY or YYEOF
00812      or a valid token in external form.  */
00813 
00814   if (yychar == YYEMPTY)
00815     {
00816       YYDPRINTF ((stderr, "Reading a token: "));
00817       yychar = YYLEX;
00818     }
00819 
00820   /* Convert token to internal form (in yychar1) for indexing tables with */
00821 
00822   if (yychar <= 0)          /* This means end of input. */
00823     {
00824       yychar1 = 0;
00825       yychar = YYEOF;              /* Don't call YYLEX any more */
00826 
00827       YYDPRINTF ((stderr, "Now at end of input.\n"));
00828     }
00829   else
00830     {
00831       yychar1 = YYTRANSLATE (yychar);
00832 
00833 #if YYDEBUG
00834      /* We have to keep this `#if YYDEBUG', since we use variables
00835        which are defined only if `YYDEBUG' is set.  */
00836       if (yydebug)
00837        {
00838          YYFPRINTF (stderr, "Next token is %d (%s",
00839                    yychar, yytname[yychar1]);
00840          /* Give the individual parser a way to print the precise
00841             meaning of a token, for further debugging info.  */
00842 # ifdef YYPRINT
00843          YYPRINT (stderr, yychar, yylval);
00844 # endif
00845          YYFPRINTF (stderr, ")\n");
00846        }
00847 #endif
00848     }
00849 
00850   yyn += yychar1;
00851   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00852     goto yydefault;
00853 
00854   yyn = yytable[yyn];
00855 
00856   /* yyn is what to do for this token type in this state.
00857      Negative => reduce, -yyn is rule number.
00858      Positive => shift, yyn is new state.
00859        New state is final state => don't bother to shift,
00860        just return success.
00861      0, or most negative number => error.  */
00862 
00863   if (yyn < 0)
00864     {
00865       if (yyn == YYFLAG)
00866        goto yyerrlab;
00867       yyn = -yyn;
00868       goto yyreduce;
00869     }
00870   else if (yyn == 0)
00871     goto yyerrlab;
00872 
00873   if (yyn == YYFINAL)
00874     YYACCEPT;
00875 
00876   /* Shift the lookahead token.  */
00877   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
00878              yychar, yytname[yychar1]));
00879 
00880   /* Discard the token being shifted unless it is eof.  */
00881   if (yychar != YYEOF)
00882     yychar = YYEMPTY;
00883 
00884   *++yyvsp = yylval;
00885 #if YYLSP_NEEDED
00886   *++yylsp = yylloc;
00887 #endif
00888 
00889   /* Count tokens shifted since error; after three, turn off error
00890      status.  */
00891   if (yyerrstatus)
00892     yyerrstatus--;
00893 
00894   yystate = yyn;
00895   goto yynewstate;
00896 
00897 
00898 /*-----------------------------------------------------------.
00899 | yydefault -- do the default action for the current state.  |
00900 `-----------------------------------------------------------*/
00901 yydefault:
00902   yyn = yydefact[yystate];
00903   if (yyn == 0)
00904     goto yyerrlab;
00905   goto yyreduce;
00906 
00907 
00908 /*-----------------------------.
00909 | yyreduce -- Do a reduction.  |
00910 `-----------------------------*/
00911 yyreduce:
00912   /* yyn is the number of a rule to reduce with.  */
00913   yylen = yyr2[yyn];
00914 
00915   /* If YYLEN is nonzero, implement the default value of the action:
00916      `$$ = $1'.
00917 
00918      Otherwise, the following line sets YYVAL to the semantic value of
00919      the lookahead token.  This behavior is undocumented and Bison
00920      users should not rely upon it.  Assigning to YYVAL
00921      unconditionally makes the parser a bit smaller, and it avoids a
00922      GCC warning that YYVAL may be used uninitialized.  */
00923   yyval = yyvsp[1-yylen];
00924 
00925 #if YYLSP_NEEDED
00926   /* Similarly for the default location.  Let the user run additional
00927      commands if for instance locations are ranges.  */
00928   yyloc = yylsp[1-yylen];
00929   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
00930 #endif
00931 
00932 #if YYDEBUG
00933   /* We have to keep this `#if YYDEBUG', since we use variables which
00934      are defined only if `YYDEBUG' is set.  */
00935   if (yydebug)
00936     {
00937       int yyi;
00938 
00939       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
00940                yyn, yyrline[yyn]);
00941 
00942       /* Print the symbols being reduced, and their result.  */
00943       for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
00944        YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
00945       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
00946     }
00947 #endif
00948 
00949   switch (yyn) {
00950 
00951 case 3:
00952 #line 69 "icalssyacc.y"
00953 { 
00954                  yyclearin;
00955                YYABORT;
00956            }
00957     break;
00958 case 4:
00959 #line 76 "icalssyacc.y"
00960 {ssyacc_add_select(yyextra,yyvsp[0].v_string);}
00961     break;
00962 case 5:
00963 #line 77 "icalssyacc.y"
00964 {ssyacc_add_select(yyextra,yyvsp[0].v_string);}
00965     break;
00966 case 6:
00967 #line 82 "icalssyacc.y"
00968 {ssyacc_add_from(yyextra,yyvsp[0].v_string);}
00969     break;
00970 case 7:
00971 #line 83 "icalssyacc.y"
00972 {ssyacc_add_from(yyextra,yyvsp[0].v_string);}
00973     break;
00974 case 9:
00975 #line 88 "icalssyacc.y"
00976 {ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
00977     break;
00978 case 10:
00979 #line 89 "icalssyacc.y"
00980 {ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_ISNULL,""); }
00981     break;
00982 case 11:
00983 #line 90 "icalssyacc.y"
00984 {ssyacc_add_where(yyextra,yyvsp[-3].v_string,ICALGAUGECOMPARE_ISNOTNULL,""); }
00985     break;
00986 case 12:
00987 #line 91 "icalssyacc.y"
00988 {ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
00989     break;
00990 case 13:
00991 #line 92 "icalssyacc.y"
00992 {ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
00993     break;
00994 case 14:
00995 #line 93 "icalssyacc.y"
00996 {ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
00997     break;
00998 case 15:
00999 #line 94 "icalssyacc.y"
01000 {ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
01001     break;
01002 case 16:
01003 #line 95 "icalssyacc.y"
01004 {ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
01005     break;
01006 case 17:
01007 #line 99 "icalssyacc.y"
01008 {set_logic(yyextra,ICALGAUGELOGIC_NONE);}
01009     break;
01010 case 18:
01011 #line 100 "icalssyacc.y"
01012 {set_logic(yyextra,ICALGAUGELOGIC_AND);}
01013     break;
01014 case 19:
01015 #line 101 "icalssyacc.y"
01016 {set_logic(yyextra,ICALGAUGELOGIC_OR);}
01017     break;
01018 }
01019 
01020 #line 705 "/usr/local/share/bison/bison.simple"
01021 
01022 
01023   yyvsp -= yylen;
01024   yyssp -= yylen;
01025 #if YYLSP_NEEDED
01026   yylsp -= yylen;
01027 #endif
01028 
01029 #if YYDEBUG
01030   if (yydebug)
01031     {
01032       short *yyssp1 = yyss - 1;
01033       YYFPRINTF (stderr, "state stack now");
01034       while (yyssp1 != yyssp)
01035        YYFPRINTF (stderr, " %d", *++yyssp1);
01036       YYFPRINTF (stderr, "\n");
01037     }
01038 #endif
01039 
01040   *++yyvsp = yyval;
01041 #if YYLSP_NEEDED
01042   *++yylsp = yyloc;
01043 #endif
01044 
01045   /* Now `shift' the result of the reduction.  Determine what state
01046      that goes to, based on the state we popped back to and the rule
01047      number reduced by.  */
01048 
01049   yyn = yyr1[yyn];
01050 
01051   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01052   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01053     yystate = yytable[yystate];
01054   else
01055     yystate = yydefgoto[yyn - YYNTBASE];
01056 
01057   goto yynewstate;
01058 
01059 
01060 /*------------------------------------.
01061 | yyerrlab -- here on detecting error |
01062 `------------------------------------*/
01063 yyerrlab:
01064   /* If not already recovering from an error, report this error.  */
01065   if (!yyerrstatus)
01066     {
01067       ++yynerrs;
01068 
01069 #ifdef YYERROR_VERBOSE
01070       yyn = yypact[yystate];
01071 
01072       if (yyn > YYFLAG && yyn < YYLAST)
01073        {
01074          YYSIZE_T yysize = 0;
01075          char *yymsg;
01076          int yyx, yycount;
01077 
01078          yycount = 0;
01079          /* Start YYX at -YYN if negative to avoid negative indexes in
01080             YYCHECK.  */
01081          for (yyx = yyn < 0 ? -yyn : 0;
01082               yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
01083            if (yycheck[yyx + yyn] == yyx)
01084              yysize += yystrlen (yytname[yyx]) + 15, yycount++;
01085          yysize += yystrlen ("parse error, unexpected ") + 1;
01086          yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
01087          yymsg = (char *) YYSTACK_ALLOC (yysize);
01088          if (yymsg != 0)
01089            {
01090              char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
01091              yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
01092 
01093              if (yycount < 5)
01094               {
01095                 yycount = 0;
01096                 for (yyx = yyn < 0 ? -yyn : 0;
01097                      yyx < (int) (sizeof (yytname) / sizeof (char *));
01098                      yyx++)
01099                   if (yycheck[yyx + yyn] == yyx)
01100                     {
01101                      const char *yyq = ! yycount ? ", expecting " : " or ";
01102                      yyp = yystpcpy (yyp, yyq);
01103                      yyp = yystpcpy (yyp, yytname[yyx]);
01104                      yycount++;
01105                     }
01106               }
01107              yyerror (yymsg);
01108              YYSTACK_FREE (yymsg);
01109            }
01110          else
01111            yyerror ("parse error; also virtual memory exhausted");
01112        }
01113       else
01114 #endif /* defined (YYERROR_VERBOSE) */
01115        yyerror ("parse error");
01116     }
01117   goto yyerrlab1;
01118 
01119 
01120 /*--------------------------------------------------.
01121 | yyerrlab1 -- error raised explicitly by an action |
01122 `--------------------------------------------------*/
01123 yyerrlab1:
01124   if (yyerrstatus == 3)
01125     {
01126       /* If just tried and failed to reuse lookahead token after an
01127         error, discard it.  */
01128 
01129       /* return failure if at end of input */
01130       if (yychar == YYEOF)
01131        YYABORT;
01132       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
01133                 yychar, yytname[yychar1]));
01134       yychar = YYEMPTY;
01135     }
01136 
01137   /* Else will try to reuse lookahead token after shifting the error
01138      token.  */
01139 
01140   yyerrstatus = 3;          /* Each real token shifted decrements this */
01141 
01142   goto yyerrhandle;
01143 
01144 
01145 /*-------------------------------------------------------------------.
01146 | yyerrdefault -- current state does not do anything special for the |
01147 | error token.                                                       |
01148 `-------------------------------------------------------------------*/
01149 yyerrdefault:
01150 #if 0
01151   /* This is wrong; only states that explicitly want error tokens
01152      should shift them.  */
01153 
01154   /* If its default is to accept any token, ok.  Otherwise pop it.  */
01155   yyn = yydefact[yystate];
01156   if (yyn)
01157     goto yydefault;
01158 #endif
01159 
01160 
01161 /*---------------------------------------------------------------.
01162 | yyerrpop -- pop the current state because it cannot handle the |
01163 | error token                                                    |
01164 `---------------------------------------------------------------*/
01165 yyerrpop:
01166   if (yyssp == yyss)
01167     YYABORT;
01168   yyvsp--;
01169   yystate = *--yyssp;
01170 #if YYLSP_NEEDED
01171   yylsp--;
01172 #endif
01173 
01174 #if YYDEBUG
01175   if (yydebug)
01176     {
01177       short *yyssp1 = yyss - 1;
01178       YYFPRINTF (stderr, "Error: state stack now");
01179       while (yyssp1 != yyssp)
01180        YYFPRINTF (stderr, " %d", *++yyssp1);
01181       YYFPRINTF (stderr, "\n");
01182     }
01183 #endif
01184 
01185 /*--------------.
01186 | yyerrhandle.  |
01187 `--------------*/
01188 yyerrhandle:
01189   yyn = yypact[yystate];
01190   if (yyn == YYFLAG)
01191     goto yyerrdefault;
01192 
01193   yyn += YYTERROR;
01194   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01195     goto yyerrdefault;
01196 
01197   yyn = yytable[yyn];
01198   if (yyn < 0)
01199     {
01200       if (yyn == YYFLAG)
01201        goto yyerrpop;
01202       yyn = -yyn;
01203       goto yyreduce;
01204     }
01205   else if (yyn == 0)
01206     goto yyerrpop;
01207 
01208   if (yyn == YYFINAL)
01209     YYACCEPT;
01210 
01211   YYDPRINTF ((stderr, "Shifting error token, "));
01212 
01213   *++yyvsp = yylval;
01214 #if YYLSP_NEEDED
01215   *++yylsp = yylloc;
01216 #endif
01217 
01218   yystate = yyn;
01219   goto yynewstate;
01220 
01221 
01222 /*-------------------------------------.
01223 | yyacceptlab -- YYACCEPT comes here.  |
01224 `-------------------------------------*/
01225 yyacceptlab:
01226   yyresult = 0;
01227   goto yyreturn;
01228 
01229 /*-----------------------------------.
01230 | yyabortlab -- YYABORT comes here.  |
01231 `-----------------------------------*/
01232 yyabortlab:
01233   yyresult = 1;
01234   goto yyreturn;
01235 
01236 /*---------------------------------------------.
01237 | yyoverflowab -- parser overflow comes here.  |
01238 `---------------------------------------------*/
01239 yyoverflowlab:
01240   yyerror ("parser stack overflow");
01241   yyresult = 2;
01242   /* Fall through.  */
01243 
01244 yyreturn:
01245 #ifndef yyoverflow
01246   if (yyss != yyssa)
01247     YYSTACK_FREE (yyss);
01248 #endif
01249   return yyresult;
01250 }
01251 #line 105 "icalssyacc.y"
01252 
01253 
01254 static void ssyacc_add_where(struct icalgauge_impl* impl, char* str1, 
01255        icalgaugecompare compare , char* value_str)
01256 {
01257 
01258     struct icalgauge_where *where;
01259     char *compstr, *propstr, *c, *s,*l;
01260     
01261     if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){
01262        icalerror_set_errno(ICAL_NEWFAILED_ERROR);
01263        return;
01264     }
01265 
01266     memset(where,0,sizeof(struct icalgauge_where));
01267     where->logic = ICALGAUGELOGIC_NONE;
01268     where->compare = ICALGAUGECOMPARE_NONE;
01269     where->comp = ICAL_NO_COMPONENT;
01270     where->prop = ICAL_NO_PROPERTY;
01271 
01272     /* remove enclosing quotes */
01273     s = value_str;
01274     if(*s == '\''){
01275        s++;
01276     }
01277     l = s+strlen(s)-1;
01278     if(*l == '\''){
01279        *l=0;
01280     }
01281        
01282     where->value = strdup(s);
01283 
01284     /* Is there a period in str1 ? If so, the string specified both a
01285        component and a property*/
01286     if( (c = strrchr(str1,'.')) != 0){
01287        compstr = str1;
01288        propstr = c+1;
01289        *c = '\0';
01290     } else {
01291        compstr = 0;
01292        propstr = str1;
01293     }
01294 
01295 
01296     /* Handle the case where a component was specified */
01297     if(compstr != 0){
01298        where->comp = icalenum_string_to_component_kind(compstr);
01299     } else {
01300        where->comp = ICAL_NO_COMPONENT;
01301     }
01302 
01303     where->prop = icalenum_string_to_property_kind(propstr);    
01304 
01305     where->compare = compare;
01306 
01307     if(where->value == 0){
01308        icalerror_set_errno(ICAL_NEWFAILED_ERROR);
01309        free(where->value);
01310        return;
01311     }
01312 
01313     pvl_push(impl->where,where);
01314 }
01315 
01316 static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
01317 {
01318     pvl_elem e = pvl_tail(impl->where);
01319     struct icalgauge_where *where = pvl_data(e);
01320 
01321     where->logic = l;
01322    
01323 }
01324 
01325 
01326 
01327 static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
01328 {
01329     char *c, *compstr, *propstr;
01330     struct icalgauge_where *where;
01331     
01332     /* Uses only the prop and comp fields of the where structure */
01333     if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){
01334        icalerror_set_errno(ICAL_NEWFAILED_ERROR);
01335        return;
01336     }
01337 
01338     memset(where,0,sizeof(struct icalgauge_where));
01339     where->logic = ICALGAUGELOGIC_NONE;
01340     where->compare = ICALGAUGECOMPARE_NONE;
01341     where->comp = ICAL_NO_COMPONENT;
01342     where->prop = ICAL_NO_PROPERTY;
01343 
01344     /* Is there a period in str1 ? If so, the string specified both a
01345        component and a property*/
01346     if( (c = strrchr(str1,'.')) != 0){
01347        compstr = str1;
01348        propstr = c+1;
01349        *c = '\0';
01350     } else {
01351        compstr = 0;
01352        propstr = str1;
01353     }
01354 
01355 
01356     /* Handle the case where a component was specified */
01357     if(compstr != 0){
01358        where->comp = icalenum_string_to_component_kind(compstr);
01359     } else {
01360        where->comp = ICAL_NO_COMPONENT;
01361     }
01362 
01363 
01364     /* If the property was '*', then accept all properties */
01365     if(strcmp("*",propstr) == 0) {
01366        where->prop = ICAL_ANY_PROPERTY;       
01367     } else {
01368        where->prop = icalenum_string_to_property_kind(propstr);    
01369     }
01370     
01371 
01372     if(where->prop == ICAL_NO_PROPERTY){
01373       free(where);
01374       icalerror_set_errno(ICAL_BADARG_ERROR);
01375       return;
01376     }
01377 
01378     pvl_push(impl->select,where);
01379 }
01380 
01381 static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
01382 {
01383     icalcomponent_kind ckind;
01384 
01385     ckind = icalenum_string_to_component_kind(str1);
01386 
01387     if(ckind == ICAL_NO_COMPONENT){
01388        assert(0);
01389     }
01390 
01391     pvl_push(impl->from,(void*)ckind);
01392 
01393 }
01394 
01395 
01396 void sserror(char *s){
01397   fprintf(stderr,"Parse error \'%s\'\n", s);
01398   icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
01399 }