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.c270
1 files changed, 144 insertions, 126 deletions
diff --git a/libical/src/libicalss/icalssyacc.c b/libical/src/libicalss/icalssyacc.c
index 943123e..3d8cdc1 100644
--- a/libical/src/libicalss/icalssyacc.c
+++ b/libical/src/libicalss/icalssyacc.c
@@ -1,3 +1,3 @@
1/* A Bison parser, made from icalssyacc.y 1/* A Bison parser, made from icalssyacc.y
2 by GNU bison 1.35. */ 2 by GNU bison 1.34. */
3 3
@@ -28,4 +28,7 @@
28 # define END272 28 # define END272
29 # define IS273
30 # define NOT274
31 # define SQLNULL275
29 32
30#line 1 "icalssyacc.y" 33#line 3 "icalssyacc.y"
31 34
@@ -58,3 +61,3 @@
58 ======================================================================*/ 61 ======================================================================*/
59 62/*#define YYDEBUG 1*/
60#include <stdlib.h> 63#include <stdlib.h>
@@ -63,3 +66,2 @@
63#include "ical.h" 66#include "ical.h"
64#include "pvl.h"
65#include "icalgauge.h" 67#include "icalgauge.h"
@@ -68,15 +70,18 @@
68 70
69extern struct icalgauge_impl *icalss_yy_gauge; 71#define YYPARSE_PARAM yy_globals
70 72#define YYLEX_PARAM yy_globals
71void ssyacc_add_where(struct icalgauge_impl* impl, char* prop, 73#define YY_EXTRA_TYPE icalgauge_impl*
72 icalgaugecompare compare , char* value); 74 /* ick...*/
73void ssyacc_add_select(struct icalgauge_impl* impl, char* str1); 75#define yyextra ((struct icalgauge_impl*)ssget_extra(yy_globals))
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 76
78 77
78static void ssyacc_add_where(struct icalgauge_impl* impl, char* prop,
79 icalgaugecompare compare , char* value);
80static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
81static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
82static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
83void sserror(char *s); /* Don't know why I need this.... */
79 84
80 85
81#line 52 "icalssyacc.y" 86#line 56 "icalssyacc.y"
82#ifndef YYSTYPE 87#ifndef YYSTYPE
@@ -86,3 +91,2 @@ typedef union {
86# define YYSTYPE yystype 91# define YYSTYPE yystype
87# define YYSTYPE_IS_TRIVIAL 1
88#endif 92#endif
@@ -94,8 +98,8 @@ typedef union {
94 98
95 #define YYFINAL 34 99 #define YYFINAL 38
96 #define YYFLAG -32768 100 #define YYFLAG -32768
97 #define YYNTBASE19 101 #define YYNTBASE22
98 102
99/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ 103/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
100#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 24) 104#define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 27)
101 105
@@ -131,3 +135,3 @@ static const char yytranslate[] =
131 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 135 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
132 16, 17, 18 136 16, 17, 18, 19, 20, 21
133}; 137};
@@ -137,4 +141,4 @@ static const short yyprhs[] =
137{ 141{
138 0, 0, 7, 9, 11, 15, 17, 21, 22, 26, 142 0, 0, 7, 12, 14, 16, 20, 22, 26, 27,
139 30, 34, 38, 42, 46, 48, 52 143 31, 35, 40, 44, 48, 52, 56, 60, 62, 66
140}; 144};
@@ -142,8 +146,9 @@ static const short yyrhs[] =
142{ 146{
143 4, 20, 5, 21, 6, 23, 0, 1, 0, 3, 147 4, 23, 5, 24, 6, 26, 0, 4, 23, 5,
144 0, 20, 7, 3, 0, 3, 0, 21, 7, 3, 148 24, 0, 1, 0, 3, 0, 23, 7, 3, 0,
145 0, 0, 3, 9, 3, 0, 3, 10, 3, 0, 149 3, 0, 24, 7, 3, 0, 0, 3, 9, 3,
146 3, 11, 3, 0, 3, 12, 3, 0, 3, 13, 150 0, 3, 19, 21, 0, 3, 19, 20, 21, 0,
147 3, 0, 3, 14, 3, 0, 22, 0, 23, 15, 151 3, 10, 3, 0, 3, 11, 3, 0, 3, 12,
148 22, 0, 23, 16, 22, 0 152 3, 0, 3, 13, 3, 0, 3, 14, 3, 0,
153 25, 0, 26, 15, 25, 0, 26, 16, 25, 0
149}; 154};
@@ -156,4 +161,4 @@ static const short yyrline[] =
156{ 161{
157 0, 63, 64, 70, 72, 76, 78, 81, 83, 85, 162 0, 67, 68, 69, 75, 77, 81, 83, 86, 88,
158 86, 87, 88, 89, 92, 94, 95 163 89, 90, 91, 92, 93, 94, 95, 98, 100, 101
159}; 164};
@@ -169,4 +174,4 @@ static const char *const yytname[] =
169 "QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS", 174 "QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS",
170 "GREATEREQUALS", "AND", "OR", "EOL", "END", "query_min", "select_list", 175 "GREATEREQUALS", "AND", "OR", "EOL", "END", "IS", "NOT", "SQLNULL",
171 "from_list", "where_clause", "where_list", 0 176 "query_min", "select_list", "from_list", "where_clause", "where_list", 0
172}; 177};
@@ -177,4 +182,4 @@ static const short yyr1[] =
177{ 182{
178 0, 19, 19, 20, 20, 21, 21, 22, 22, 22, 183 0, 22, 22, 22, 23, 23, 24, 24, 25, 25,
179 22, 22, 22, 22, 23, 23, 23 184 25, 25, 25, 25, 25, 25, 25, 26, 26, 26
180}; 185};
@@ -184,4 +189,4 @@ static const short yyr2[] =
184{ 189{
185 0, 6, 1, 1, 3, 1, 3, 0, 3, 3, 190 0, 6, 4, 1, 1, 3, 1, 3, 0, 3,
186 3, 3, 3, 3, 1, 3, 3 191 3, 4, 3, 3, 3, 3, 3, 1, 3, 3
187}; 192};
@@ -193,6 +198,6 @@ static const short yydefact[] =
193{ 198{
194 0, 2, 0, 3, 0, 0, 0, 5, 0, 4, 199 0, 3, 0, 4, 0, 0, 0, 6, 2, 5,
195 7, 0, 0, 14, 1, 6, 0, 0, 0, 0, 200 8, 0, 0, 17, 1, 7, 0, 0, 0, 0,
196 0, 0, 7, 7, 8, 9, 10, 11, 12, 13, 201 0, 0, 0, 8, 8, 9, 12, 13, 14, 15,
197 15, 16, 0, 0, 0 202 16, 0, 10, 18, 19, 11, 0, 0, 0
198}; 203};
@@ -201,3 +206,3 @@ static const short yydefgoto[] =
201{ 206{
202 32, 4, 8, 13, 14 207 36, 4, 8, 13, 14
203}; 208};
@@ -206,6 +211,6 @@ static const short yypact[] =
206{ 211{
207 5,-32768, 4,-32768, 3, 8, 15,-32768, 6,-32768, 212 5,-32768, 9,-32768, 6, 17, 18,-32768, 1,-32768,
208 16, 17, -9,-32768, -1,-32768, 18, 19, 20, 21, 213 19, 20, -9,-32768, -1,-32768, 21, 22, 23, 24,
209 22, 23, 16, 16,-32768,-32768,-32768,-32768,-32768,-32768, 214 25, 26, -4, 19, 19,-32768,-32768,-32768,-32768,-32768,
210 -32768,-32768, 27, 28,-32768 215 -32768, 10,-32768,-32768,-32768,-32768, 30, 32,-32768
211}; 216};
@@ -214,3 +219,3 @@ static const short yypgoto[] =
214{ 219{
215 -32768,-32768,-32768, -6,-32768 220 -32768,-32768,-32768, -5,-32768
216}; 221};
@@ -218,3 +223,3 @@ static const short yypgoto[] =
218 223
219 #define YYLAST 28 224 #define YYLAST 32
220 225
@@ -223,5 +228,6 @@ static const short yytable[] =
223{ 228{
224 16, 17, 18, 19, 20, 21, 1, 3, 5, 2, 229 16, 17, 18, 19, 20, 21, 1, 10, 11, 2,
225 6, 7, 10, 11, 22, 23, 30, 31, 9, 12, 230 22, 5, 3, 6, 23, 24, 31, 32, 33, 34,
226 15, 24, 25, 26, 27, 28, 29, 33, 34 231 7, 9, 12, 15, 25, 26, 27, 28, 29, 30,
232 37, 35, 38
227}; 233};
@@ -230,8 +236,11 @@ static const short yycheck[] =
230{ 236{
231 9, 10, 11, 12, 13, 14, 1, 3, 5, 4, 237 9, 10, 11, 12, 13, 14, 1, 6, 7, 4,
232 7, 3, 6, 7, 15, 16, 22, 23, 3, 3, 238 19, 5, 3, 7, 15, 16, 20, 21, 23, 24,
233 3, 3, 3, 3, 3, 3, 3, 0, 0 239 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
240 0, 21, 0
234}; 241};
242#define YYPURE 1
243
235/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 244/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
236#line 3 "/usr/share/bison/bison.simple" 245#line 3 "/usr/local/share/bison/bison.simple"
237 246
@@ -303,8 +312,2 @@ static const short yycheck[] =
303# endif 312# 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 313
@@ -335,21 +338,3 @@ union yyalloc
335 338
336/* Copy COUNT objects from FROM to TO. The source and destination do 339/* Relocate the TYPE STACK from its old location to the new one. The
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 340 local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -358,3 +343,3 @@ union yyalloc
358 stack. */ 343 stack. */
359 # define YYSTACK_RELOCATE(Stack) \ 344 # define YYSTACK_RELOCATE(Type, Stack) \
360 do \ 345 do \
@@ -362,5 +347,6 @@ union yyalloc
362 YYSIZE_T yynewbytes; \ 347 YYSIZE_T yynewbytes; \
363 YYCOPY (&yyptr->Stack, Stack, yysize); \ 348 yymemcpy ((char *) yyptr, (char *) (Stack), \
349 yysize * (YYSIZE_T) sizeof (Type)); \
364 Stack = &yyptr->Stack; \ 350 Stack = &yyptr->Stack; \
365 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;\ 351 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX;\
366 yyptr += yynewbytes / sizeof (*yyptr); \ 352 yyptr += yynewbytes / sizeof (*yyptr); \
@@ -369,3 +355,3 @@ union yyalloc
369 355
370#endif 356#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
371 357
@@ -496,2 +482,29 @@ int yydebug;
496 482
483#if ! defined (yyoverflow) && ! defined (yymemcpy)
484 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
485# define yymemcpy __builtin_memcpy
486 # else /* not GNU C or C++ */
487
488/* This is the most reliable way to avoid incompatibilities
489 in available built-in functions on various systems. */
490static void
491# if defined (__STDC__) || defined (__cplusplus)
492yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
493# else
494yymemcpy (yyto, yyfrom, yycount)
495 char *yyto;
496 const char *yyfrom;
497 YYSIZE_T yycount;
498# endif
499{
500 register const char *yyf = yyfrom;
501 register char *yyt = yyto;
502 register YYSIZE_T yyi = yycount;
503
504 while (yyi-- != 0)
505 *yyt++ = *yyf++;
506}
507# endif
508#endif
509
497#ifdef YYERROR_VERBOSE 510#ifdef YYERROR_VERBOSE
@@ -548,3 +561,3 @@ yystpcpy (yydest, yysrc)
548 561
549#line 315 "/usr/share/bison/bison.simple" 562#line 319 "/usr/local/share/bison/bison.simple"
550 563
@@ -738,5 +751,2 @@ yyparse (YYPARSE_PARAM_ARG)
738#else /* no yyoverflow */ 751#else /* no yyoverflow */
739# ifndef YYSTACK_RELOCATE
740 goto yyoverflowlab;
741# else
742 /* Extend the stack our own way. */ 752 /* Extend the stack our own way. */
@@ -754,6 +764,6 @@ yyparse (YYPARSE_PARAM_ARG)
754 goto yyoverflowlab; 764 goto yyoverflowlab;
755 YYSTACK_RELOCATE (yyss); 765 YYSTACK_RELOCATE (short, yyss);
756 YYSTACK_RELOCATE (yyvs); 766 YYSTACK_RELOCATE (YYSTYPE, yyvs);
757# if YYLSP_NEEDED 767# if YYLSP_NEEDED
758 YYSTACK_RELOCATE (yyls); 768 YYSTACK_RELOCATE (YYLTYPE, yyls);
759# endif 769# endif
@@ -763,3 +773,2 @@ yyparse (YYPARSE_PARAM_ARG)
763 } 773 }
764# endif
765#endif /* no yyoverflow */ 774#endif /* no yyoverflow */
@@ -941,16 +950,12 @@ yyreduce:
941 950
942case 2: 951case 3:
943#line 64 "icalssyacc.y" 952#line 69 "icalssyacc.y"
944{ 953{
945 icalparser_clear_flex_input();
946 yyclearin; 954 yyclearin;
955 YYABORT;
947 } 956 }
948 break; 957 break;
949case 3:
950#line 71 "icalssyacc.y"
951{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
952 break;
953case 4: 958case 4:
954#line 72 "icalssyacc.y" 959#line 76 "icalssyacc.y"
955{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);} 960{ssyacc_add_select(yyextra,yyvsp[0].v_string);}
956 break; 961 break;
@@ -958,31 +963,31 @@ case 5:
958#line 77 "icalssyacc.y" 963#line 77 "icalssyacc.y"
959{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);} 964{ssyacc_add_select(yyextra,yyvsp[0].v_string);}
960 break; 965 break;
961case 6: 966case 6:
962#line 78 "icalssyacc.y" 967#line 82 "icalssyacc.y"
963{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);} 968{ssyacc_add_from(yyextra,yyvsp[0].v_string);}
964 break; 969 break;
965case 8: 970case 7:
966#line 83 "icalssyacc.y" 971#line 83 "icalssyacc.y"
967{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); } 972{ssyacc_add_from(yyextra,yyvsp[0].v_string);}
968 break; 973 break;
969case 9: 974case 9:
970#line 85 "icalssyacc.y" 975#line 88 "icalssyacc.y"
971{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); } 976{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
972 break; 977 break;
973case 10: 978case 10:
974#line 86 "icalssyacc.y" 979#line 89 "icalssyacc.y"
975{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); } 980{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_ISNULL,""); }
976 break; 981 break;
977case 11: 982case 11:
978#line 87 "icalssyacc.y" 983#line 90 "icalssyacc.y"
979{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); } 984{ssyacc_add_where(yyextra,yyvsp[-3].v_string,ICALGAUGECOMPARE_ISNOTNULL,""); }
980 break; 985 break;
981case 12: 986case 12:
982#line 88 "icalssyacc.y" 987#line 91 "icalssyacc.y"
983{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); } 988{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
984 break; 989 break;
985case 13: 990case 13:
986#line 89 "icalssyacc.y" 991#line 92 "icalssyacc.y"
987{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); } 992{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
988 break; 993 break;
@@ -990,3 +995,3 @@ case 14:
990#line 93 "icalssyacc.y" 995#line 93 "icalssyacc.y"
991{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_NONE);} 996{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
992 break; 997 break;
@@ -994,3 +999,3 @@ case 15:
994#line 94 "icalssyacc.y" 999#line 94 "icalssyacc.y"
995{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_AND);} 1000{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
996 break; 1001 break;
@@ -998,3 +1003,15 @@ case 16:
998#line 95 "icalssyacc.y" 1003#line 95 "icalssyacc.y"
999{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_OR);} 1004{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
1005 break;
1006case 17:
1007#line 99 "icalssyacc.y"
1008{set_logic(yyextra,ICALGAUGELOGIC_NONE);}
1009 break;
1010case 18:
1011#line 100 "icalssyacc.y"
1012{set_logic(yyextra,ICALGAUGELOGIC_AND);}
1013 break;
1014case 19:
1015#line 101 "icalssyacc.y"
1016{set_logic(yyextra,ICALGAUGELOGIC_OR);}
1000 break; 1017 break;
@@ -1002,3 +1019,3 @@ case 16:
1002 1019
1003#line 705 "/usr/share/bison/bison.simple" 1020#line 705 "/usr/local/share/bison/bison.simple"
1004 1021
@@ -1233,6 +1250,6 @@ yyreturn:
1233} 1250}
1234#line 99 "icalssyacc.y" 1251#line 105 "icalssyacc.y"
1235 1252
1236 1253
1237void ssyacc_add_where(struct icalgauge_impl* impl, char* str1, 1254static void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
1238 icalgaugecompare compare , char* value_str) 1255 icalgaugecompare compare , char* value_str)
@@ -1298,3 +1315,3 @@ void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
1298 1315
1299void set_logic(struct icalgauge_impl* impl,icalgaugelogic l) 1316static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
1300{ 1317{
@@ -1309,3 +1326,3 @@ void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
1309 1326
1310void ssyacc_add_select(struct icalgauge_impl* impl, char* str1) 1327static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
1311{ 1328{
@@ -1355,5 +1372,5 @@ void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
1355 if(where->prop == ICAL_NO_PROPERTY){ 1372 if(where->prop == ICAL_NO_PROPERTY){
1356 icalgauge_free(where); 1373 free(where);
1357 icalerror_set_errno(ICAL_BADARG_ERROR); 1374 icalerror_set_errno(ICAL_BADARG_ERROR);
1358 return; 1375 return;
1359 } 1376 }
@@ -1363,3 +1380,3 @@ void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
1363 1380
1364void ssyacc_add_from(struct icalgauge_impl* impl, char* str1) 1381static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
1365{ 1382{
@@ -1379,3 +1396,4 @@ void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
1379void sserror(char *s){ 1396void sserror(char *s){
1380 fprintf(stderr,"Parse error \'%s\'\n", s); 1397 fprintf(stderr,"Parse error \'%s\'\n", s);
1398 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
1381} 1399}