summaryrefslogtreecommitdiffabout
path: root/libical/src/libicalss/icalssyacc.c
Unidiff
Diffstat (limited to 'libical/src/libicalss/icalssyacc.c') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libicalss/icalssyacc.c1381
1 files changed, 1381 insertions, 0 deletions
diff --git a/libical/src/libicalss/icalssyacc.c b/libical/src/libicalss/icalssyacc.c
new file mode 100644
index 0000000..943123e
--- a/dev/null
+++ b/libical/src/libicalss/icalssyacc.c
@@ -0,0 +1,1381 @@
1/* A Bison parser, made from icalssyacc.y
2 by GNU bison 1.35. */
3
4#define YYBISON 1 /* Identify Bison output. */
5
6#define yyparse ssparse
7#define yylex sslex
8#define yyerror sserror
9#define yylval sslval
10#define yychar sschar
11#define yydebug ssdebug
12#define yynerrs ssnerrs
13 # define STRING257
14 # define SELECT258
15 # define FROM259
16 # define WHERE260
17 # define COMMA261
18 # define QUOTE262
19 # define EQUALS263
20 # define NOTEQUALS264
21 # define LESS265
22 # define GREATER266
23 # define LESSEQUALS267
24 # define GREATEREQUALS268
25 # define AND269
26 # define OR270
27 # define EOL271
28 # define END272
29
30#line 1 "icalssyacc.y"
31
32/* -*- Mode: C -*-
33 ======================================================================
34 FILE: icalssyacc.y
35 CREATOR: eric 08 Aug 2000
36
37 DESCRIPTION:
38
39 $Id$
40 $Locker$
41
42(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
43
44 This program is free software; you can redistribute it and/or modify
45 it under the terms of either:
46
47 The LGPL as published by the Free Software Foundation, version
48 2.1, available at: http://www.fsf.org/copyleft/lesser.html
49
50 Or:
51
52 The Mozilla Public License Version 1.0. You may obtain a copy of
53 the License at http://www.mozilla.org/MPL/
54
55 The Original Code is eric. The Initial Developer of the Original
56 Code is Eric Busboom
57
58 ======================================================================*/
59
60#include <stdlib.h>
61#include <string.h> /* for strdup() */
62#include <limits.h> /* for SHRT_MAX*/
63#include "ical.h"
64#include "pvl.h"
65#include "icalgauge.h"
66#include "icalgaugeimpl.h"
67
68
69extern struct icalgauge_impl *icalss_yy_gauge;
70
71void ssyacc_add_where(struct icalgauge_impl* impl, char* prop,
72 icalgaugecompare compare , char* value);
73void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
74void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
75void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
76void sserror(char *s); /* Don't know why I need this.... */
77
78
79
80
81#line 52 "icalssyacc.y"
82#ifndef YYSTYPE
83typedef union {
84 char* v_string;
85} yystype;
86# define YYSTYPE yystype
87# define YYSTYPE_IS_TRIVIAL 1
88#endif
89#ifndef YYDEBUG
90# define YYDEBUG 0
91#endif
92
93
94
95 #define YYFINAL 34
96 #define YYFLAG -32768
97 #define YYNTBASE19
98
99/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
100#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 24)
101
102/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
103static const char yytranslate[] =
104{
105 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
111 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
112 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
113 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
114 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
115 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
117 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
118 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
119 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
126 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
127 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
131 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
132 16, 17, 18
133};
134
135#if YYDEBUG
136static const short yyprhs[] =
137{
138 0, 0, 7, 9, 11, 15, 17, 21, 22, 26,
139 30, 34, 38, 42, 46, 48, 52
140};
141static const short yyrhs[] =
142{
143 4, 20, 5, 21, 6, 23, 0, 1, 0, 3,
144 0, 20, 7, 3, 0, 3, 0, 21, 7, 3,
145 0, 0, 3, 9, 3, 0, 3, 10, 3, 0,
146 3, 11, 3, 0, 3, 12, 3, 0, 3, 13,
147 3, 0, 3, 14, 3, 0, 22, 0, 23, 15,
148 22, 0, 23, 16, 22, 0
149};
150
151#endif
152
153#if YYDEBUG
154/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
155static const short yyrline[] =
156{
157 0, 63, 64, 70, 72, 76, 78, 81, 83, 85,
158 86, 87, 88, 89, 92, 94, 95
159};
160#endif
161
162
163#if (YYDEBUG) || defined YYERROR_VERBOSE
164
165/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
166static const char *const yytname[] =
167{
168 "$", "error", "$undefined.", "STRING", "SELECT", "FROM", "WHERE", "COMMA",
169 "QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS",
170 "GREATEREQUALS", "AND", "OR", "EOL", "END", "query_min", "select_list",
171 "from_list", "where_clause", "where_list", 0
172};
173#endif
174
175/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
176static const short yyr1[] =
177{
178 0, 19, 19, 20, 20, 21, 21, 22, 22, 22,
179 22, 22, 22, 22, 23, 23, 23
180};
181
182/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
183static const short yyr2[] =
184{
185 0, 6, 1, 1, 3, 1, 3, 0, 3, 3,
186 3, 3, 3, 3, 1, 3, 3
187};
188
189/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
190 doesn't specify something else to do. Zero means the default is an
191 error. */
192static const short yydefact[] =
193{
194 0, 2, 0, 3, 0, 0, 0, 5, 0, 4,
195 7, 0, 0, 14, 1, 6, 0, 0, 0, 0,
196 0, 0, 7, 7, 8, 9, 10, 11, 12, 13,
197 15, 16, 0, 0, 0
198};
199
200static const short yydefgoto[] =
201{
202 32, 4, 8, 13, 14
203};
204
205static const short yypact[] =
206{
207 5,-32768, 4,-32768, 3, 8, 15,-32768, 6,-32768,
208 16, 17, -9,-32768, -1,-32768, 18, 19, 20, 21,
209 22, 23, 16, 16,-32768,-32768,-32768,-32768,-32768,-32768,
210 -32768,-32768, 27, 28,-32768
211};
212
213static const short yypgoto[] =
214{
215 -32768,-32768,-32768, -6,-32768
216};
217
218
219 #define YYLAST 28
220
221
222static const short yytable[] =
223{
224 16, 17, 18, 19, 20, 21, 1, 3, 5, 2,
225 6, 7, 10, 11, 22, 23, 30, 31, 9, 12,
226 15, 24, 25, 26, 27, 28, 29, 33, 34
227};
228
229static const short yycheck[] =
230{
231 9, 10, 11, 12, 13, 14, 1, 3, 5, 4,
232 7, 3, 6, 7, 15, 16, 22, 23, 3, 3,
233 3, 3, 3, 3, 3, 3, 3, 0, 0
234};
235/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
236#line 3 "/usr/share/bison/bison.simple"
237
238/* Skeleton output parser for bison,
239
240 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
241 Foundation, Inc.
242
243 This program is free software; you can redistribute it and/or modify
244 it under the terms of the GNU General Public License as published by
245 the Free Software Foundation; either version 2, or (at your option)
246 any later version.
247
248 This program is distributed in the hope that it will be useful,
249 but WITHOUT ANY WARRANTY; without even the implied warranty of
250 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
251 GNU General Public License for more details.
252
253 You should have received a copy of the GNU General Public License
254 along with this program; if not, write to the Free Software
255 Foundation, Inc., 59 Temple Place - Suite 330,
256 Boston, MA 02111-1307, USA. */
257
258/* As a special exception, when this file is copied by Bison into a
259 Bison output file, you may use that output file without restriction.
260 This special exception was added by the Free Software Foundation
261 in version 1.24 of Bison. */
262
263/* This is the parser code that is written into each bison parser when
264 the %semantic_parser declaration is not specified in the grammar.
265 It was written by Richard Stallman by simplifying the hairy parser
266 used when %semantic_parser is specified. */
267
268/* All symbols defined below should begin with yy or YY, to avoid
269 infringing on user name space. This should be done even for local
270 variables, as they might otherwise be expanded by user macros.
271 There are some unavoidable exceptions within include files to
272 define necessary library symbols; they are noted "INFRINGES ON
273 USER NAME SPACE" below. */
274
275#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
276
277/* The parser invokes alloca or malloc; define the necessary symbols. */
278
279# if YYSTACK_USE_ALLOCA
280# define YYSTACK_ALLOC alloca
281# else
282# ifndef YYSTACK_USE_ALLOCA
283# if defined (alloca) || defined (_ALLOCA_H)
284# define YYSTACK_ALLOC alloca
285# else
286# ifdef __GNUC__
287# define YYSTACK_ALLOC __builtin_alloca
288# endif
289# endif
290# endif
291# endif
292
293# ifdef YYSTACK_ALLOC
294 /* Pacify GCC's `empty if-body' warning. */
295# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
296# else
297# if defined (__STDC__) || defined (__cplusplus)
298# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
299# define YYSIZE_T size_t
300# endif
301# define YYSTACK_ALLOC malloc
302# define YYSTACK_FREE free
303# endif
304#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
305
306
307#if (! defined (yyoverflow) \
308 && (! defined (__cplusplus) \
309 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
310
311/* A type that is properly aligned for any stack member. */
312union yyalloc
313{
314 short yyss;
315 YYSTYPE yyvs;
316# if YYLSP_NEEDED
317 YYLTYPE yyls;
318# endif
319};
320
321/* The size of the maximum gap between one aligned stack and the next. */
322# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
323
324/* The size of an array large to enough to hold all stacks, each with
325 N elements. */
326# if YYLSP_NEEDED
327# define YYSTACK_BYTES(N) \
328 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))\
329 + 2 * YYSTACK_GAP_MAX)
330# else
331# define YYSTACK_BYTES(N) \
332 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
333 + YYSTACK_GAP_MAX)
334# endif
335
336/* Copy COUNT objects from FROM to TO. The source and destination do
337 not overlap. */
338# ifndef YYCOPY
339# if 1 < __GNUC__
340# define YYCOPY(To, From, Count) \
341 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
342# else
343 # define YYCOPY(To, From, Count) \
344 do \
345 { \
346 register YYSIZE_T yyi; \
347 for (yyi = 0; yyi < (Count); yyi++)\
348 (To)[yyi] = (From)[yyi]; \
349 } \
350 while (0)
351# endif
352# endif
353
354/* Relocate STACK from its old location to the new one. The
355 local variables YYSIZE and YYSTACKSIZE give the old and new number of
356 elements in the stack, and YYPTR gives the new location of the
357 stack. Advance YYPTR to a properly aligned location for the next
358 stack. */
359 # define YYSTACK_RELOCATE(Stack) \
360 do \
361 { \
362 YYSIZE_T yynewbytes; \
363 YYCOPY (&yyptr->Stack, Stack, yysize); \
364 Stack = &yyptr->Stack; \
365 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;\
366 yyptr += yynewbytes / sizeof (*yyptr); \
367 } \
368 while (0)
369
370#endif
371
372
373#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
374# define YYSIZE_T __SIZE_TYPE__
375#endif
376#if ! defined (YYSIZE_T) && defined (size_t)
377# define YYSIZE_T size_t
378#endif
379#if ! defined (YYSIZE_T)
380# if defined (__STDC__) || defined (__cplusplus)
381# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
382# define YYSIZE_T size_t
383# endif
384#endif
385#if ! defined (YYSIZE_T)
386# define YYSIZE_T unsigned int
387#endif
388
389 #define yyerrok (yyerrstatus = 0)
390 #define yyclearin(yychar = YYEMPTY)
391 #define YYEMPTY -2
392 #define YYEOF 0
393 #define YYACCEPTgoto yyacceptlab
394 #define YYABORT goto yyabortlab
395 #define YYERROR goto yyerrlab1
396/* Like YYERROR except do call yyerror. This remains here temporarily
397 to ease the transition to the new meaning of YYERROR, for GCC.
398 Once GCC version 2 has supplanted version 1, this can go. */
399 #define YYFAIL goto yyerrlab
400#define YYRECOVERING() (!!yyerrstatus)
401 #define YYBACKUP(Token, Value) \
402 do \
403 if (yychar == YYEMPTY && yylen == 1) \
404 { \
405 yychar = (Token); \
406 yylval = (Value); \
407 yychar1 = YYTRANSLATE (yychar); \
408 YYPOPSTACK; \
409 goto yybackup; \
410 } \
411 else \
412 { \
413 yyerror ("syntax error: cannot back up"); \
414 YYERROR; \
415 } \
416while (0)
417
418 #define YYTERROR1
419 #define YYERRCODE256
420
421
422/* YYLLOC_DEFAULT -- Compute the default location (before the actions
423 are run).
424
425 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
426 first token. By default, to implement support for ranges, extend
427 its range to the last symbol. */
428
429#ifndef YYLLOC_DEFAULT
430 # define YYLLOC_DEFAULT(Current, Rhs, N) \
431 Current.last_line = Rhs[N].last_line;\
432 Current.last_column = Rhs[N].last_column;
433#endif
434
435
436/* YYLEX -- calling `yylex' with the right arguments. */
437
438#if YYPURE
439# if YYLSP_NEEDED
440# ifdef YYLEX_PARAM
441 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
442# else
443 # define YYLEX yylex (&yylval, &yylloc)
444# endif
445# else /* !YYLSP_NEEDED */
446# ifdef YYLEX_PARAM
447 # define YYLEX yylex (&yylval, YYLEX_PARAM)
448# else
449 # define YYLEX yylex (&yylval)
450# endif
451# endif /* !YYLSP_NEEDED */
452#else /* !YYPURE */
453 # define YYLEX yylex ()
454#endif /* !YYPURE */
455
456
457/* Enable debugging if requested. */
458#if YYDEBUG
459
460# ifndef YYFPRINTF
461# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
462# define YYFPRINTF fprintf
463# endif
464
465 # define YYDPRINTF(Args) \
466 do { \
467 if (yydebug) \
468 YYFPRINTF Args; \
469} while (0)
470/* Nonzero means print parse trace. It is left uninitialized so that
471 multiple parsers can coexist. */
472int yydebug;
473#else /* !YYDEBUG */
474# define YYDPRINTF(Args)
475#endif /* !YYDEBUG */
476
477/* YYINITDEPTH -- initial size of the parser's stacks. */
478 #ifndefYYINITDEPTH
479# define YYINITDEPTH 200
480#endif
481
482/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
483 if the built-in stack extension method is used).
484
485 Do not make this value too large; the results are undefined if
486 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
487 evaluated with infinite-precision integer arithmetic. */
488
489#if YYMAXDEPTH == 0
490# undef YYMAXDEPTH
491#endif
492
493#ifndef YYMAXDEPTH
494# define YYMAXDEPTH 10000
495#endif
496
497#ifdef YYERROR_VERBOSE
498
499# ifndef yystrlen
500# if defined (__GLIBC__) && defined (_STRING_H)
501# define yystrlen strlen
502# else
503/* Return the length of YYSTR. */
504static YYSIZE_T
505# if defined (__STDC__) || defined (__cplusplus)
506yystrlen (const char *yystr)
507# else
508yystrlen (yystr)
509 const char *yystr;
510# endif
511{
512 register const char *yys = yystr;
513
514 while (*yys++ != '\0')
515 continue;
516
517 return yys - yystr - 1;
518}
519# endif
520# endif
521
522# ifndef yystpcpy
523# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
524# define yystpcpy stpcpy
525# else
526/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
527 YYDEST. */
528static char *
529# if defined (__STDC__) || defined (__cplusplus)
530yystpcpy (char *yydest, const char *yysrc)
531# else
532yystpcpy (yydest, yysrc)
533 char *yydest;
534 const char *yysrc;
535# endif
536{
537 register char *yyd = yydest;
538 register const char *yys = yysrc;
539
540 while ((*yyd++ = *yys++) != '\0')
541 continue;
542
543 return yyd - 1;
544}
545# endif
546# endif
547#endif
548
549#line 315 "/usr/share/bison/bison.simple"
550
551
552/* The user can define YYPARSE_PARAM as the name of an argument to be passed
553 into yyparse. The argument should have type void *.
554 It should actually point to an object.
555 Grammar actions can access the variable by casting it
556 to the proper pointer type. */
557
558#ifdef YYPARSE_PARAM
559# if defined (__STDC__) || defined (__cplusplus)
560# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
561# define YYPARSE_PARAM_DECL
562# else
563# define YYPARSE_PARAM_ARG YYPARSE_PARAM
564# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
565# endif
566#else /* !YYPARSE_PARAM */
567# define YYPARSE_PARAM_ARG
568# define YYPARSE_PARAM_DECL
569#endif /* !YYPARSE_PARAM */
570
571/* Prevent warning if -Wstrict-prototypes. */
572#ifdef __GNUC__
573# ifdef YYPARSE_PARAM
574int yyparse (void *);
575# else
576int yyparse (void);
577# endif
578#endif
579
580/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
581 variables are global, or local to YYPARSE. */
582
583 #define YY_DECL_NON_LSP_VARIABLES \
584 /* The lookahead symbol. */ \
585 int yychar; \
586 \
587 /* The semantic value of the lookahead symbol. */\
588 YYSTYPE yylval; \
589 \
590 /* Number of parse errors so far. */ \
591int yynerrs;
592
593#if YYLSP_NEEDED
594 # define YY_DECL_VARIABLES \
595 YY_DECL_NON_LSP_VARIABLES \
596 \
597 /* Location data for the lookahead symbol. */\
598YYLTYPE yylloc;
599#else
600 # define YY_DECL_VARIABLES \
601YY_DECL_NON_LSP_VARIABLES
602#endif
603
604
605/* If nonreentrant, generate the variables here. */
606
607#if !YYPURE
608YY_DECL_VARIABLES
609#endif /* !YYPURE */
610
611int
612yyparse (YYPARSE_PARAM_ARG)
613 YYPARSE_PARAM_DECL
614{
615 /* If reentrant, generate the variables here. */
616#if YYPURE
617 YY_DECL_VARIABLES
618#endif /* !YYPURE */
619
620 register int yystate;
621 register int yyn;
622 int yyresult;
623 /* Number of tokens to shift before error messages enabled. */
624 int yyerrstatus;
625 /* Lookahead token as an internal (translated) token number. */
626 int yychar1 = 0;
627
628 /* Three stacks and their tools:
629 `yyss': related to states,
630 `yyvs': related to semantic values,
631 `yyls': related to locations.
632
633 Refer to the stacks thru separate pointers, to allow yyoverflow
634 to reallocate them elsewhere. */
635
636 /* The state stack. */
637 shortyyssa[YYINITDEPTH];
638 short *yyss = yyssa;
639 register short *yyssp;
640
641 /* The semantic value stack. */
642 YYSTYPE yyvsa[YYINITDEPTH];
643 YYSTYPE *yyvs = yyvsa;
644 register YYSTYPE *yyvsp;
645
646#if YYLSP_NEEDED
647 /* The location stack. */
648 YYLTYPE yylsa[YYINITDEPTH];
649 YYLTYPE *yyls = yylsa;
650 YYLTYPE *yylsp;
651#endif
652
653#if YYLSP_NEEDED
654# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
655#else
656# define YYPOPSTACK (yyvsp--, yyssp--)
657#endif
658
659 YYSIZE_T yystacksize = YYINITDEPTH;
660
661
662 /* The variables used to return semantic value and location from the
663 action routines. */
664 YYSTYPE yyval;
665#if YYLSP_NEEDED
666 YYLTYPE yyloc;
667#endif
668
669 /* When reducing, the number of symbols on the RHS of the reduced
670 rule. */
671 int yylen;
672
673 YYDPRINTF ((stderr, "Starting parse\n"));
674
675 yystate = 0;
676 yyerrstatus = 0;
677 yynerrs = 0;
678 yychar = YYEMPTY; /* Cause a token to be read. */
679
680 /* Initialize stack pointers.
681 Waste one element of value and location stack
682 so that they stay on the same level as the state stack.
683 The wasted elements are never initialized. */
684
685 yyssp = yyss;
686 yyvsp = yyvs;
687#if YYLSP_NEEDED
688 yylsp = yyls;
689#endif
690 goto yysetstate;
691
692/*------------------------------------------------------------.
693| yynewstate -- Push a new state, which is found in yystate. |
694`------------------------------------------------------------*/
695 yynewstate:
696 /* In all cases, when you get here, the value and location stacks
697 have just been pushed. so pushing a state here evens the stacks.
698 */
699 yyssp++;
700
701 yysetstate:
702 *yyssp = yystate;
703
704 if (yyssp >= yyss + yystacksize - 1)
705 {
706 /* Get the current used size of the three stacks, in elements. */
707 YYSIZE_T yysize = yyssp - yyss + 1;
708
709#ifdef yyoverflow
710 {
711 /* Give user a chance to reallocate the stack. Use copies of
712 these so that the &'s don't force the real ones into
713 memory. */
714 YYSTYPE *yyvs1 = yyvs;
715 short *yyss1 = yyss;
716
717 /* Each stack pointer address is followed by the size of the
718 data in use in that stack, in bytes. */
719# if YYLSP_NEEDED
720 YYLTYPE *yyls1 = yyls;
721 /* This used to be a conditional around just the two extra args,
722 but that might be undefined if yyoverflow is a macro. */
723 yyoverflow ("parser stack overflow",
724 &yyss1, yysize * sizeof (*yyssp),
725 &yyvs1, yysize * sizeof (*yyvsp),
726 &yyls1, yysize * sizeof (*yylsp),
727 &yystacksize);
728 yyls = yyls1;
729# else
730 yyoverflow ("parser stack overflow",
731 &yyss1, yysize * sizeof (*yyssp),
732 &yyvs1, yysize * sizeof (*yyvsp),
733 &yystacksize);
734# endif
735 yyss = yyss1;
736 yyvs = yyvs1;
737 }
738#else /* no yyoverflow */
739# ifndef YYSTACK_RELOCATE
740 goto yyoverflowlab;
741# else
742 /* Extend the stack our own way. */
743 if (yystacksize >= YYMAXDEPTH)
744 goto yyoverflowlab;
745 yystacksize *= 2;
746 if (yystacksize > YYMAXDEPTH)
747 yystacksize = YYMAXDEPTH;
748
749 {
750 short *yyss1 = yyss;
751 union yyalloc *yyptr =
752 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
753 if (! yyptr)
754 goto yyoverflowlab;
755 YYSTACK_RELOCATE (yyss);
756 YYSTACK_RELOCATE (yyvs);
757# if YYLSP_NEEDED
758 YYSTACK_RELOCATE (yyls);
759# endif
760# undef YYSTACK_RELOCATE
761 if (yyss1 != yyssa)
762 YYSTACK_FREE (yyss1);
763 }
764# endif
765#endif /* no yyoverflow */
766
767 yyssp = yyss + yysize - 1;
768 yyvsp = yyvs + yysize - 1;
769#if YYLSP_NEEDED
770 yylsp = yyls + yysize - 1;
771#endif
772
773 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
774 (unsigned long int) yystacksize));
775
776 if (yyssp >= yyss + yystacksize - 1)
777 YYABORT;
778 }
779
780 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
781
782 goto yybackup;
783
784
785/*-----------.
786| yybackup. |
787`-----------*/
788yybackup:
789
790/* Do appropriate processing given the current state. */
791/* Read a lookahead token if we need one and don't already have one. */
792/* yyresume: */
793
794 /* First try to decide what to do without reference to lookahead token. */
795
796 yyn = yypact[yystate];
797 if (yyn == YYFLAG)
798 goto yydefault;
799
800 /* Not known => get a lookahead token if don't already have one. */
801
802 /* yychar is either YYEMPTY or YYEOF
803 or a valid token in external form. */
804
805 if (yychar == YYEMPTY)
806 {
807 YYDPRINTF ((stderr, "Reading a token: "));
808 yychar = YYLEX;
809 }
810
811 /* Convert token to internal form (in yychar1) for indexing tables with */
812
813 if (yychar <= 0) /* This means end of input. */
814 {
815 yychar1 = 0;
816 yychar = YYEOF; /* Don't call YYLEX any more */
817
818 YYDPRINTF ((stderr, "Now at end of input.\n"));
819 }
820 else
821 {
822 yychar1 = YYTRANSLATE (yychar);
823
824#if YYDEBUG
825 /* We have to keep this `#if YYDEBUG', since we use variables
826 which are defined only if `YYDEBUG' is set. */
827 if (yydebug)
828 {
829 YYFPRINTF (stderr, "Next token is %d (%s",
830 yychar, yytname[yychar1]);
831 /* Give the individual parser a way to print the precise
832 meaning of a token, for further debugging info. */
833# ifdef YYPRINT
834 YYPRINT (stderr, yychar, yylval);
835# endif
836 YYFPRINTF (stderr, ")\n");
837 }
838#endif
839 }
840
841 yyn += yychar1;
842 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
843 goto yydefault;
844
845 yyn = yytable[yyn];
846
847 /* yyn is what to do for this token type in this state.
848 Negative => reduce, -yyn is rule number.
849 Positive => shift, yyn is new state.
850 New state is final state => don't bother to shift,
851 just return success.
852 0, or most negative number => error. */
853
854 if (yyn < 0)
855 {
856 if (yyn == YYFLAG)
857 goto yyerrlab;
858 yyn = -yyn;
859 goto yyreduce;
860 }
861 else if (yyn == 0)
862 goto yyerrlab;
863
864 if (yyn == YYFINAL)
865 YYACCEPT;
866
867 /* Shift the lookahead token. */
868 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
869 yychar, yytname[yychar1]));
870
871 /* Discard the token being shifted unless it is eof. */
872 if (yychar != YYEOF)
873 yychar = YYEMPTY;
874
875 *++yyvsp = yylval;
876#if YYLSP_NEEDED
877 *++yylsp = yylloc;
878#endif
879
880 /* Count tokens shifted since error; after three, turn off error
881 status. */
882 if (yyerrstatus)
883 yyerrstatus--;
884
885 yystate = yyn;
886 goto yynewstate;
887
888
889/*-----------------------------------------------------------.
890| yydefault -- do the default action for the current state. |
891`-----------------------------------------------------------*/
892yydefault:
893 yyn = yydefact[yystate];
894 if (yyn == 0)
895 goto yyerrlab;
896 goto yyreduce;
897
898
899/*-----------------------------.
900| yyreduce -- Do a reduction. |
901`-----------------------------*/
902yyreduce:
903 /* yyn is the number of a rule to reduce with. */
904 yylen = yyr2[yyn];
905
906 /* If YYLEN is nonzero, implement the default value of the action:
907 `$$ = $1'.
908
909 Otherwise, the following line sets YYVAL to the semantic value of
910 the lookahead token. This behavior is undocumented and Bison
911 users should not rely upon it. Assigning to YYVAL
912 unconditionally makes the parser a bit smaller, and it avoids a
913 GCC warning that YYVAL may be used uninitialized. */
914 yyval = yyvsp[1-yylen];
915
916#if YYLSP_NEEDED
917 /* Similarly for the default location. Let the user run additional
918 commands if for instance locations are ranges. */
919 yyloc = yylsp[1-yylen];
920 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
921#endif
922
923#if YYDEBUG
924 /* We have to keep this `#if YYDEBUG', since we use variables which
925 are defined only if `YYDEBUG' is set. */
926 if (yydebug)
927 {
928 int yyi;
929
930 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
931 yyn, yyrline[yyn]);
932
933 /* Print the symbols being reduced, and their result. */
934 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
935 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
936 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
937 }
938#endif
939
940 switch (yyn) {
941
942case 2:
943#line 64 "icalssyacc.y"
944{
945 icalparser_clear_flex_input();
946 yyclearin;
947 }
948 break;
949case 3:
950#line 71 "icalssyacc.y"
951{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
952 break;
953case 4:
954#line 72 "icalssyacc.y"
955{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
956 break;
957case 5:
958#line 77 "icalssyacc.y"
959{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
960 break;
961case 6:
962#line 78 "icalssyacc.y"
963{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
964 break;
965case 8:
966#line 83 "icalssyacc.y"
967{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
968 break;
969case 9:
970#line 85 "icalssyacc.y"
971{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
972 break;
973case 10:
974#line 86 "icalssyacc.y"
975{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
976 break;
977case 11:
978#line 87 "icalssyacc.y"
979{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
980 break;
981case 12:
982#line 88 "icalssyacc.y"
983{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
984 break;
985case 13:
986#line 89 "icalssyacc.y"
987{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
988 break;
989case 14:
990#line 93 "icalssyacc.y"
991{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_NONE);}
992 break;
993case 15:
994#line 94 "icalssyacc.y"
995{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_AND);}
996 break;
997case 16:
998#line 95 "icalssyacc.y"
999{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_OR);}
1000 break;
1001}
1002
1003#line 705 "/usr/share/bison/bison.simple"
1004
1005
1006 yyvsp -= yylen;
1007 yyssp -= yylen;
1008#if YYLSP_NEEDED
1009 yylsp -= yylen;
1010#endif
1011
1012#if YYDEBUG
1013 if (yydebug)
1014 {
1015 short *yyssp1 = yyss - 1;
1016 YYFPRINTF (stderr, "state stack now");
1017 while (yyssp1 != yyssp)
1018 YYFPRINTF (stderr, " %d", *++yyssp1);
1019 YYFPRINTF (stderr, "\n");
1020 }
1021#endif
1022
1023 *++yyvsp = yyval;
1024#if YYLSP_NEEDED
1025 *++yylsp = yyloc;
1026#endif
1027
1028 /* Now `shift' the result of the reduction. Determine what state
1029 that goes to, based on the state we popped back to and the rule
1030 number reduced by. */
1031
1032 yyn = yyr1[yyn];
1033
1034 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1035 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1036 yystate = yytable[yystate];
1037 else
1038 yystate = yydefgoto[yyn - YYNTBASE];
1039
1040 goto yynewstate;
1041
1042
1043/*------------------------------------.
1044| yyerrlab -- here on detecting error |
1045`------------------------------------*/
1046yyerrlab:
1047 /* If not already recovering from an error, report this error. */
1048 if (!yyerrstatus)
1049 {
1050 ++yynerrs;
1051
1052#ifdef YYERROR_VERBOSE
1053 yyn = yypact[yystate];
1054
1055 if (yyn > YYFLAG && yyn < YYLAST)
1056 {
1057 YYSIZE_T yysize = 0;
1058 char *yymsg;
1059 int yyx, yycount;
1060
1061 yycount = 0;
1062 /* Start YYX at -YYN if negative to avoid negative indexes in
1063 YYCHECK. */
1064 for (yyx = yyn < 0 ? -yyn : 0;
1065 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1066 if (yycheck[yyx + yyn] == yyx)
1067 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1068 yysize += yystrlen ("parse error, unexpected ") + 1;
1069 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1070 yymsg = (char *) YYSTACK_ALLOC (yysize);
1071 if (yymsg != 0)
1072 {
1073 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1074 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1075
1076 if (yycount < 5)
1077 {
1078 yycount = 0;
1079 for (yyx = yyn < 0 ? -yyn : 0;
1080 yyx < (int) (sizeof (yytname) / sizeof (char *));
1081 yyx++)
1082 if (yycheck[yyx + yyn] == yyx)
1083 {
1084 const char *yyq = ! yycount ? ", expecting " : " or ";
1085 yyp = yystpcpy (yyp, yyq);
1086 yyp = yystpcpy (yyp, yytname[yyx]);
1087 yycount++;
1088 }
1089 }
1090 yyerror (yymsg);
1091 YYSTACK_FREE (yymsg);
1092 }
1093 else
1094 yyerror ("parse error; also virtual memory exhausted");
1095 }
1096 else
1097#endif /* defined (YYERROR_VERBOSE) */
1098 yyerror ("parse error");
1099 }
1100 goto yyerrlab1;
1101
1102
1103/*--------------------------------------------------.
1104| yyerrlab1 -- error raised explicitly by an action |
1105`--------------------------------------------------*/
1106yyerrlab1:
1107 if (yyerrstatus == 3)
1108 {
1109 /* If just tried and failed to reuse lookahead token after an
1110 error, discard it. */
1111
1112 /* return failure if at end of input */
1113 if (yychar == YYEOF)
1114 YYABORT;
1115 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1116 yychar, yytname[yychar1]));
1117 yychar = YYEMPTY;
1118 }
1119
1120 /* Else will try to reuse lookahead token after shifting the error
1121 token. */
1122
1123 yyerrstatus = 3; /* Each real token shifted decrements this */
1124
1125 goto yyerrhandle;
1126
1127
1128/*-------------------------------------------------------------------.
1129| yyerrdefault -- current state does not do anything special for the |
1130| error token. |
1131`-------------------------------------------------------------------*/
1132yyerrdefault:
1133#if 0
1134 /* This is wrong; only states that explicitly want error tokens
1135 should shift them. */
1136
1137 /* If its default is to accept any token, ok. Otherwise pop it. */
1138 yyn = yydefact[yystate];
1139 if (yyn)
1140 goto yydefault;
1141#endif
1142
1143
1144/*---------------------------------------------------------------.
1145| yyerrpop -- pop the current state because it cannot handle the |
1146| error token |
1147`---------------------------------------------------------------*/
1148yyerrpop:
1149 if (yyssp == yyss)
1150 YYABORT;
1151 yyvsp--;
1152 yystate = *--yyssp;
1153#if YYLSP_NEEDED
1154 yylsp--;
1155#endif
1156
1157#if YYDEBUG
1158 if (yydebug)
1159 {
1160 short *yyssp1 = yyss - 1;
1161 YYFPRINTF (stderr, "Error: state stack now");
1162 while (yyssp1 != yyssp)
1163 YYFPRINTF (stderr, " %d", *++yyssp1);
1164 YYFPRINTF (stderr, "\n");
1165 }
1166#endif
1167
1168/*--------------.
1169| yyerrhandle. |
1170`--------------*/
1171yyerrhandle:
1172 yyn = yypact[yystate];
1173 if (yyn == YYFLAG)
1174 goto yyerrdefault;
1175
1176 yyn += YYTERROR;
1177 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1178 goto yyerrdefault;
1179
1180 yyn = yytable[yyn];
1181 if (yyn < 0)
1182 {
1183 if (yyn == YYFLAG)
1184 goto yyerrpop;
1185 yyn = -yyn;
1186 goto yyreduce;
1187 }
1188 else if (yyn == 0)
1189 goto yyerrpop;
1190
1191 if (yyn == YYFINAL)
1192 YYACCEPT;
1193
1194 YYDPRINTF ((stderr, "Shifting error token, "));
1195
1196 *++yyvsp = yylval;
1197#if YYLSP_NEEDED
1198 *++yylsp = yylloc;
1199#endif
1200
1201 yystate = yyn;
1202 goto yynewstate;
1203
1204
1205/*-------------------------------------.
1206| yyacceptlab -- YYACCEPT comes here. |
1207`-------------------------------------*/
1208yyacceptlab:
1209 yyresult = 0;
1210 goto yyreturn;
1211
1212/*-----------------------------------.
1213| yyabortlab -- YYABORT comes here. |
1214`-----------------------------------*/
1215yyabortlab:
1216 yyresult = 1;
1217 goto yyreturn;
1218
1219/*---------------------------------------------.
1220| yyoverflowab -- parser overflow comes here. |
1221`---------------------------------------------*/
1222yyoverflowlab:
1223 yyerror ("parser stack overflow");
1224 yyresult = 2;
1225 /* Fall through. */
1226
1227yyreturn:
1228#ifndef yyoverflow
1229 if (yyss != yyssa)
1230 YYSTACK_FREE (yyss);
1231#endif
1232 return yyresult;
1233}
1234#line 99 "icalssyacc.y"
1235
1236
1237void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
1238 icalgaugecompare compare , char* value_str)
1239{
1240
1241 struct icalgauge_where *where;
1242 char *compstr, *propstr, *c, *s,*l;
1243
1244 if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){
1245 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
1246 return;
1247 }
1248
1249 memset(where,0,sizeof(struct icalgauge_where));
1250 where->logic = ICALGAUGELOGIC_NONE;
1251 where->compare = ICALGAUGECOMPARE_NONE;
1252 where->comp = ICAL_NO_COMPONENT;
1253 where->prop = ICAL_NO_PROPERTY;
1254
1255 /* remove enclosing quotes */
1256 s = value_str;
1257 if(*s == '\''){
1258 s++;
1259 }
1260 l = s+strlen(s)-1;
1261 if(*l == '\''){
1262 *l=0;
1263 }
1264
1265 where->value = strdup(s);
1266
1267 /* Is there a period in str1 ? If so, the string specified both a
1268 component and a property*/
1269 if( (c = strrchr(str1,'.')) != 0){
1270 compstr = str1;
1271 propstr = c+1;
1272 *c = '\0';
1273 } else {
1274 compstr = 0;
1275 propstr = str1;
1276 }
1277
1278
1279 /* Handle the case where a component was specified */
1280 if(compstr != 0){
1281 where->comp = icalenum_string_to_component_kind(compstr);
1282 } else {
1283 where->comp = ICAL_NO_COMPONENT;
1284 }
1285
1286 where->prop = icalenum_string_to_property_kind(propstr);
1287
1288 where->compare = compare;
1289
1290 if(where->value == 0){
1291 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
1292 free(where->value);
1293 return;
1294 }
1295
1296 pvl_push(impl->where,where);
1297}
1298
1299void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
1300{
1301 pvl_elem e = pvl_tail(impl->where);
1302 struct icalgauge_where *where = pvl_data(e);
1303
1304 where->logic = l;
1305
1306}
1307
1308
1309
1310void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
1311{
1312 char *c, *compstr, *propstr;
1313 struct icalgauge_where *where;
1314
1315 /* Uses only the prop and comp fields of the where structure */
1316 if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){
1317 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
1318 return;
1319 }
1320
1321 memset(where,0,sizeof(struct icalgauge_where));
1322 where->logic = ICALGAUGELOGIC_NONE;
1323 where->compare = ICALGAUGECOMPARE_NONE;
1324 where->comp = ICAL_NO_COMPONENT;
1325 where->prop = ICAL_NO_PROPERTY;
1326
1327 /* Is there a period in str1 ? If so, the string specified both a
1328 component and a property*/
1329 if( (c = strrchr(str1,'.')) != 0){
1330 compstr = str1;
1331 propstr = c+1;
1332 *c = '\0';
1333 } else {
1334 compstr = 0;
1335 propstr = str1;
1336 }
1337
1338
1339 /* Handle the case where a component was specified */
1340 if(compstr != 0){
1341 where->comp = icalenum_string_to_component_kind(compstr);
1342 } else {
1343 where->comp = ICAL_NO_COMPONENT;
1344 }
1345
1346
1347 /* If the property was '*', then accept all properties */
1348 if(strcmp("*",propstr) == 0) {
1349 where->prop = ICAL_ANY_PROPERTY;
1350 } else {
1351 where->prop = icalenum_string_to_property_kind(propstr);
1352 }
1353
1354
1355 if(where->prop == ICAL_NO_PROPERTY){
1356 icalgauge_free(where);
1357 icalerror_set_errno(ICAL_BADARG_ERROR);
1358 return;
1359 }
1360
1361 pvl_push(impl->select,where);
1362}
1363
1364void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
1365{
1366 icalcomponent_kind ckind;
1367
1368 ckind = icalenum_string_to_component_kind(str1);
1369
1370 if(ckind == ICAL_NO_COMPONENT){
1371 assert(0);
1372 }
1373
1374 pvl_push(impl->from,(void*)ckind);
1375
1376}
1377
1378
1379void sserror(char *s){
1380 fprintf(stderr,"Parse error \'%s\'\n", s);
1381}