Diffstat (limited to 'libical/src/libicalss/icalssyacc.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libicalss/icalssyacc.c | 270 |
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 @@ /* A Bison parser, made from icalssyacc.y - by GNU bison 1.35. */ + by GNU bison 1.34. */ @@ -28,4 +28,7 @@ # define END 272 +# define IS 273 +# define NOT 274 +# define SQLNULL 275 -#line 1 "icalssyacc.y" +#line 3 "icalssyacc.y" @@ -58,3 +61,3 @@ ======================================================================*/ - +/*#define YYDEBUG 1*/ #include <stdlib.h> @@ -63,3 +66,2 @@ #include "ical.h" -#include "pvl.h" #include "icalgauge.h" @@ -68,15 +70,18 @@ -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 @@ -86,3 +91,2 @@ typedef union { # define YYSTYPE yystype -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -94,8 +98,8 @@ 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) @@ -131,3 +135,3 @@ static const char yytranslate[] = 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18 + 16, 17, 18, 19, 20, 21 }; @@ -137,4 +141,4 @@ 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 }; @@ -142,8 +146,9 @@ 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 }; @@ -156,4 +161,4 @@ 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 }; @@ -169,4 +174,4 @@ static const char *const yytname[] = "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 }; @@ -177,4 +182,4 @@ 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 }; @@ -184,4 +189,4 @@ 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 }; @@ -193,6 +198,6 @@ 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 }; @@ -201,3 +206,3 @@ static const short yydefgoto[] = { - 32, 4, 8, 13, 14 + 36, 4, 8, 13, 14 }; @@ -206,6 +211,6 @@ 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 }; @@ -214,3 +219,3 @@ static const short yypgoto[] = { - -32768,-32768,-32768, -6,-32768 + -32768,-32768,-32768, -5,-32768 }; @@ -218,3 +223,3 @@ static const short yypgoto[] = -#define YYLAST 28 +#define YYLAST 32 @@ -223,5 +228,6 @@ 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 }; @@ -230,8 +236,11 @@ 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" @@ -303,8 +312,2 @@ static const short yycheck[] = # endif -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ - - -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) @@ -335,21 +338,3 @@ union yyalloc -/* 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 @@ -358,3 +343,3 @@ union yyalloc stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Type, Stack) \ do \ @@ -362,5 +347,6 @@ union yyalloc 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); \ @@ -369,3 +355,3 @@ union yyalloc -#endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ @@ -496,2 +482,29 @@ int yydebug; +#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 @@ -548,3 +561,3 @@ yystpcpy (yydest, yysrc) -#line 315 "/usr/share/bison/bison.simple" +#line 319 "/usr/local/share/bison/bison.simple" @@ -738,5 +751,2 @@ yyparse (YYPARSE_PARAM_ARG) #else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyoverflowlab; -# else /* Extend the stack our own way. */ @@ -754,6 +764,6 @@ yyparse (YYPARSE_PARAM_ARG) 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 @@ -763,3 +773,2 @@ yyparse (YYPARSE_PARAM_ARG) } -# endif #endif /* no yyoverflow */ @@ -941,16 +950,12 @@ yyreduce: -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; @@ -958,31 +963,31 @@ 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; @@ -990,3 +995,3 @@ 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; @@ -994,3 +999,3 @@ 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; @@ -998,3 +1003,15 @@ 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; @@ -1002,3 +1019,3 @@ case 16: -#line 705 "/usr/share/bison/bison.simple" +#line 705 "/usr/local/share/bison/bison.simple" @@ -1233,6 +1250,6 @@ yyreturn: } -#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) @@ -1298,3 +1315,3 @@ void ssyacc_add_where(struct icalgauge_impl* impl, char* str1, -void set_logic(struct icalgauge_impl* impl,icalgaugelogic l) +static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l) { @@ -1309,3 +1326,3 @@ 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) { @@ -1355,5 +1372,5 @@ 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; } @@ -1363,3 +1380,3 @@ void ssyacc_add_select(struct icalgauge_impl* impl, char* str1) -void ssyacc_add_from(struct icalgauge_impl* impl, char* str1) +static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1) { @@ -1379,3 +1396,4 @@ 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); } |