summaryrefslogtreecommitdiffabout
path: root/libical/src/libicalss/icalssyacc.c
Side-by-side diff
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,5 +1,5 @@
/* A Bison parser, made from icalssyacc.y
- by GNU bison 1.35. */
+ by GNU bison 1.34. */
#define YYBISON 1 /* Identify Bison output. */
@@ -26,8 +26,11 @@
# define OR 270
# define EOL 271
# define END 272
+# define IS 273
+# define NOT 274
+# define SQLNULL 275
-#line 1 "icalssyacc.y"
+#line 3 "icalssyacc.y"
/* -*- Mode: C -*-
======================================================================
@@ -56,35 +59,36 @@
Code is Eric Busboom
======================================================================*/
-
+/*#define YYDEBUG 1*/
#include <stdlib.h>
#include <string.h> /* for strdup() */
#include <limits.h> /* for SHRT_MAX*/
#include "ical.h"
-#include "pvl.h"
#include "icalgauge.h"
#include "icalgaugeimpl.h"
-extern struct icalgauge_impl *icalss_yy_gauge;
-
-void ssyacc_add_where(struct icalgauge_impl* impl, char* prop,
- icalgaugecompare compare , char* value);
-void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
-void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
-void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
-void sserror(char *s); /* Don't know why I need this.... */
+#define YYPARSE_PARAM yy_globals
+#define YYLEX_PARAM yy_globals
+#define YY_EXTRA_TYPE icalgauge_impl*
+ /* ick...*/
+#define yyextra ((struct icalgauge_impl*)ssget_extra(yy_globals))
+static void ssyacc_add_where(struct icalgauge_impl* impl, char* prop,
+ icalgaugecompare compare , char* value);
+static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
+static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
+static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
+void sserror(char *s); /* Don't know why I need this.... */
-#line 52 "icalssyacc.y"
+#line 56 "icalssyacc.y"
#ifndef YYSTYPE
typedef union {
char* v_string;
} yystype;
# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
#endif
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -92,12 +96,12 @@ typedef union {
-#define YYFINAL 34
+#define YYFINAL 38
#define YYFLAG -32768
-#define YYNTBASE 19
+#define YYNTBASE 22
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
-#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 24)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 27)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const char yytranslate[] =
@@ -129,23 +133,24 @@ static const char yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18
+ 16, 17, 18, 19, 20, 21
};
#if YYDEBUG
static const short yyprhs[] =
{
- 0, 0, 7, 9, 11, 15, 17, 21, 22, 26,
- 30, 34, 38, 42, 46, 48, 52
+ 0, 0, 7, 12, 14, 16, 20, 22, 26, 27,
+ 31, 35, 40, 44, 48, 52, 56, 60, 62, 66
};
static const short yyrhs[] =
{
- 4, 20, 5, 21, 6, 23, 0, 1, 0, 3,
- 0, 20, 7, 3, 0, 3, 0, 21, 7, 3,
- 0, 0, 3, 9, 3, 0, 3, 10, 3, 0,
- 3, 11, 3, 0, 3, 12, 3, 0, 3, 13,
- 3, 0, 3, 14, 3, 0, 22, 0, 23, 15,
- 22, 0, 23, 16, 22, 0
+ 4, 23, 5, 24, 6, 26, 0, 4, 23, 5,
+ 24, 0, 1, 0, 3, 0, 23, 7, 3, 0,
+ 3, 0, 24, 7, 3, 0, 0, 3, 9, 3,
+ 0, 3, 19, 21, 0, 3, 19, 20, 21, 0,
+ 3, 10, 3, 0, 3, 11, 3, 0, 3, 12,
+ 3, 0, 3, 13, 3, 0, 3, 14, 3, 0,
+ 25, 0, 26, 15, 25, 0, 26, 16, 25, 0
};
#endif
@@ -154,8 +159,8 @@ static const short yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
- 0, 63, 64, 70, 72, 76, 78, 81, 83, 85,
- 86, 87, 88, 89, 92, 94, 95
+ 0, 67, 68, 69, 75, 77, 81, 83, 86, 88,
+ 89, 90, 91, 92, 93, 94, 95, 98, 100, 101
};
#endif
@@ -167,23 +172,23 @@ static const char *const yytname[] =
{
"$", "error", "$undefined.", "STRING", "SELECT", "FROM", "WHERE", "COMMA",
"QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS",
- "GREATEREQUALS", "AND", "OR", "EOL", "END", "query_min", "select_list",
- "from_list", "where_clause", "where_list", 0
+ "GREATEREQUALS", "AND", "OR", "EOL", "END", "IS", "NOT", "SQLNULL",
+ "query_min", "select_list", "from_list", "where_clause", "where_list", 0
};
#endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const short yyr1[] =
{
- 0, 19, 19, 20, 20, 21, 21, 22, 22, 22,
- 22, 22, 22, 22, 23, 23, 23
+ 0, 22, 22, 22, 23, 23, 24, 24, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 26, 26, 26
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const short yyr2[] =
{
- 0, 6, 1, 1, 3, 1, 3, 0, 3, 3,
- 3, 3, 3, 3, 1, 3, 3
+ 0, 6, 4, 1, 1, 3, 1, 3, 0, 3,
+ 3, 4, 3, 3, 3, 3, 3, 1, 3, 3
};
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
@@ -191,49 +196,53 @@ static const short yyr2[] =
error. */
static const short yydefact[] =
{
- 0, 2, 0, 3, 0, 0, 0, 5, 0, 4,
- 7, 0, 0, 14, 1, 6, 0, 0, 0, 0,
- 0, 0, 7, 7, 8, 9, 10, 11, 12, 13,
- 15, 16, 0, 0, 0
+ 0, 3, 0, 4, 0, 0, 0, 6, 2, 5,
+ 8, 0, 0, 17, 1, 7, 0, 0, 0, 0,
+ 0, 0, 0, 8, 8, 9, 12, 13, 14, 15,
+ 16, 0, 10, 18, 19, 11, 0, 0, 0
};
static const short yydefgoto[] =
{
- 32, 4, 8, 13, 14
+ 36, 4, 8, 13, 14
};
static const short yypact[] =
{
- 5,-32768, 4,-32768, 3, 8, 15,-32768, 6,-32768,
- 16, 17, -9,-32768, -1,-32768, 18, 19, 20, 21,
- 22, 23, 16, 16,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768, 27, 28,-32768
+ 5,-32768, 9,-32768, 6, 17, 18,-32768, 1,-32768,
+ 19, 20, -9,-32768, -1,-32768, 21, 22, 23, 24,
+ 25, 26, -4, 19, 19,-32768,-32768,-32768,-32768,-32768,
+ -32768, 10,-32768,-32768,-32768,-32768, 30, 32,-32768
};
static const short yypgoto[] =
{
- -32768,-32768,-32768, -6,-32768
+ -32768,-32768,-32768, -5,-32768
};
-#define YYLAST 28
+#define YYLAST 32
static const short yytable[] =
{
- 16, 17, 18, 19, 20, 21, 1, 3, 5, 2,
- 6, 7, 10, 11, 22, 23, 30, 31, 9, 12,
- 15, 24, 25, 26, 27, 28, 29, 33, 34
+ 16, 17, 18, 19, 20, 21, 1, 10, 11, 2,
+ 22, 5, 3, 6, 23, 24, 31, 32, 33, 34,
+ 7, 9, 12, 15, 25, 26, 27, 28, 29, 30,
+ 37, 35, 38
};
static const short yycheck[] =
{
- 9, 10, 11, 12, 13, 14, 1, 3, 5, 4,
- 7, 3, 6, 7, 15, 16, 22, 23, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 0, 0
+ 9, 10, 11, 12, 13, 14, 1, 6, 7, 4,
+ 19, 5, 3, 7, 15, 16, 20, 21, 23, 24,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 0, 21, 0
};
+#define YYPURE 1
+
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/share/bison/bison.simple"
+#line 3 "/usr/local/share/bison/bison.simple"
/* Skeleton output parser for bison,
@@ -301,12 +310,6 @@ static const short yycheck[] =
# define YYSTACK_ALLOC malloc
# define YYSTACK_FREE free
# endif
-#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -333,41 +336,24 @@ union yyalloc
+ YYSTACK_GAP_MAX)
# endif
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
+/* Relocate the TYPE STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Type, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
+ yymemcpy ((char *) yyptr, (char *) (Stack), \
+ yysize * (YYSIZE_T) sizeof (Type)); \
Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
+ yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
-#endif
+#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@@ -494,6 +480,33 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
+#if ! defined (yyoverflow) && ! defined (yymemcpy)
+# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+# define yymemcpy __builtin_memcpy
+# else /* not GNU C or C++ */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+# if defined (__STDC__) || defined (__cplusplus)
+yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
+# else
+yymemcpy (yyto, yyfrom, yycount)
+ char *yyto;
+ const char *yyfrom;
+ YYSIZE_T yycount;
+# endif
+{
+ register const char *yyf = yyfrom;
+ register char *yyt = yyto;
+ register YYSIZE_T yyi = yycount;
+
+ while (yyi-- != 0)
+ *yyt++ = *yyf++;
+}
+# endif
+#endif
+
#ifdef YYERROR_VERBOSE
# ifndef yystrlen
@@ -546,7 +559,7 @@ yystpcpy (yydest, yysrc)
# endif
#endif
-#line 315 "/usr/share/bison/bison.simple"
+#line 319 "/usr/local/share/bison/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
@@ -736,9 +749,6 @@ yyparse (YYPARSE_PARAM_ARG)
yyvs = yyvs1;
}
#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
goto yyoverflowlab;
@@ -752,16 +762,15 @@ yyparse (YYPARSE_PARAM_ARG)
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
+ YYSTACK_RELOCATE (short, yyss);
+ YYSTACK_RELOCATE (YYSTYPE, yyvs);
# if YYLSP_NEEDED
- YYSTACK_RELOCATE (yyls);
+ YYSTACK_RELOCATE (YYLTYPE, yyls);
# endif
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
-# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
@@ -939,68 +948,76 @@ yyreduce:
switch (yyn) {
-case 2:
-#line 64 "icalssyacc.y"
+case 3:
+#line 69 "icalssyacc.y"
{
- icalparser_clear_flex_input();
yyclearin;
+ YYABORT;
}
break;
-case 3:
-#line 71 "icalssyacc.y"
-{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
- break;
case 4:
-#line 72 "icalssyacc.y"
-{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
+#line 76 "icalssyacc.y"
+{ssyacc_add_select(yyextra,yyvsp[0].v_string);}
break;
case 5:
#line 77 "icalssyacc.y"
-{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
+{ssyacc_add_select(yyextra,yyvsp[0].v_string);}
break;
case 6:
-#line 78 "icalssyacc.y"
-{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
+#line 82 "icalssyacc.y"
+{ssyacc_add_from(yyextra,yyvsp[0].v_string);}
break;
-case 8:
+case 7:
#line 83 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
+{ssyacc_add_from(yyextra,yyvsp[0].v_string);}
break;
case 9:
-#line 85 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
+#line 88 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
break;
case 10:
-#line 86 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
+#line 89 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_ISNULL,""); }
break;
case 11:
-#line 87 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
+#line 90 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-3].v_string,ICALGAUGECOMPARE_ISNOTNULL,""); }
break;
case 12:
-#line 88 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
+#line 91 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
break;
case 13:
-#line 89 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
+#line 92 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
break;
case 14:
#line 93 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_NONE);}
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
break;
case 15:
#line 94 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_AND);}
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
break;
case 16:
#line 95 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_OR);}
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
+ break;
+case 17:
+#line 99 "icalssyacc.y"
+{set_logic(yyextra,ICALGAUGELOGIC_NONE);}
+ break;
+case 18:
+#line 100 "icalssyacc.y"
+{set_logic(yyextra,ICALGAUGELOGIC_AND);}
+ break;
+case 19:
+#line 101 "icalssyacc.y"
+{set_logic(yyextra,ICALGAUGELOGIC_OR);}
break;
}
-#line 705 "/usr/share/bison/bison.simple"
+#line 705 "/usr/local/share/bison/bison.simple"
yyvsp -= yylen;
@@ -1231,10 +1248,10 @@ yyreturn:
#endif
return yyresult;
}
-#line 99 "icalssyacc.y"
+#line 105 "icalssyacc.y"
-void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
+static void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
icalgaugecompare compare , char* value_str)
{
@@ -1296,7 +1313,7 @@ void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
pvl_push(impl->where,where);
}
-void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
+static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
{
pvl_elem e = pvl_tail(impl->where);
struct icalgauge_where *where = pvl_data(e);
@@ -1307,7 +1324,7 @@ void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
-void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
+static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
{
char *c, *compstr, *propstr;
struct icalgauge_where *where;
@@ -1353,15 +1370,15 @@ void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
if(where->prop == ICAL_NO_PROPERTY){
- icalgauge_free(where);
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return;
+ free(where);
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return;
}
pvl_push(impl->select,where);
}
-void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
+static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
{
icalcomponent_kind ckind;
@@ -1377,5 +1394,6 @@ void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
void sserror(char *s){
- fprintf(stderr,"Parse error \'%s\'\n", s);
+ fprintf(stderr,"Parse error \'%s\'\n", s);
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
}