#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <regex.h>
#include <limits.h>
#include <asterisk/ast_expr.h>
#include <asterisk/logger.h>
Go to the source code of this file.
Data Structures | |
struct | parser_control |
struct | val |
union | yyalloc |
union | YYSTYPE |
Defines | |
#define | YYBISON 1 |
#define | YYSKELETON_NAME "yacc.c" |
#define | YYPURE 1 |
#define | YYLSP_NEEDED 0 |
#define | yyparse ast_yyparse |
#define | yylex ast_yylex |
#define | yyerror ast_yyerror |
#define | yylval ast_yylval |
#define | yychar ast_yychar |
#define | yydebug ast_yydebug |
#define | yynerrs ast_yynerrs |
#define | NE 258 |
#define | LE 259 |
#define | GE 260 |
#define | TOKEN 261 |
#define | QUAD_MIN (-0x7fffffffffffffffL-1) |
#define | QUAD_MAX (0x7fffffffffffffffL) |
#define | YYPARSE_PARAM kota |
#define | YYLEX_PARAM kota |
#define | YYDEBUG 0 |
#define | YYERROR_VERBOSE 0 |
#define | yystype YYSTYPE |
#define | YYSTYPE_IS_DECLARED 1 |
#define | YYSTYPE_IS_TRIVIAL 1 |
#define | YYSTACK_ALLOC malloc |
#define | YYSTACK_FREE free |
#define | YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
#define | YYSTACK_BYTES(N) |
#define | YYCOPY(To, From, Count) |
#define | YYSTACK_RELOCATE(Stack) |
#define | YYFINAL 6 |
#define | YYLAST 83 |
#define | YYNTOKENS 20 |
#define | YYNNTS 3 |
#define | YYNRULES 18 |
#define | YYNSTATES 36 |
#define | YYUNDEFTOK 2 |
#define | YYMAXUTOK 261 |
#define | YYTRANSLATE(YYX) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
#define | YYPACT_NINF -13 |
#define | YYTABLE_NINF -1 |
#define | YYSIZE_T unsigned int |
#define | yyerrok (yyerrstatus = 0) |
#define | yyclearin (yychar = YYEMPTY) |
#define | YYEMPTY (-2) |
#define | YYEOF 0 |
#define | YYACCEPT goto yyacceptlab |
#define | YYABORT goto yyabortlab |
#define | YYERROR goto yyerrlab1 |
#define | YYFAIL goto yyerrlab |
#define | YYRECOVERING() (!!yyerrstatus) |
#define | YYBACKUP(Token, Value) |
#define | YYTERROR 1 |
#define | YYERRCODE 256 |
#define | YYLLOC_DEFAULT(Current, Rhs, N) |
#define | YYLEX yylex (&yylval, YYLEX_PARAM) |
#define | YYDPRINTF(Args) |
#define | YYDSYMPRINT(Args) |
#define | YYDSYMPRINTF(Title, Token, Value, Location) |
#define | YY_STACK_PRINT(Bottom, Top) |
#define | YY_REDUCE_PRINT(Rule) |
#define | YYINITDEPTH 200 |
#define | YYMAXDEPTH 10000 |
#define | YYPOPSTACK (yyvsp--, yyssp--) |
Typedefs | |
typedef YYSTYPE | YYSTYPE |
typedef short | yysigned_char |
Enumerations | |
enum | yytokentype { NE = 258, LE = 259, GE = 260, TOKEN = 261 } |
enum | valtype { integer, numeric_string, string } |
Functions | |
int | yyparse () |
int | yyparse (void *YYPARSE_PARAM) |
char * | ast_expr (char *arg) |
|
Definition at line 73 of file ast_expr.c. |
|
Definition at line 72 of file ast_expr.c. |
|
Definition at line 71 of file ast_expr.c. |
|
Definition at line 107 of file ast_expr.c. |
|
Definition at line 104 of file ast_expr.c. |
|
Definition at line 74 of file ast_expr.c. |
|
Definition at line 655 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 654 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 508 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 507 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 520 of file ast_expr.c. |
|
Definition at line 37 of file ast_expr.c. |
|
Definition at line 54 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 503 of file ast_expr.c. |
|
Definition at line 259 of file ast_expr.c. |
|
Definition at line 166 of file ast_expr.c. |
|
Definition at line 55 of file ast_expr.c. |
|
Definition at line 651 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 652 of file ast_expr.c. |
|
Definition at line 653 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 504 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 505 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 538 of file ast_expr.c. |
|
Definition at line 502 of file ast_expr.c. |
|
Definition at line 509 of file ast_expr.c. |
|
Definition at line 52 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 174 of file ast_expr.c. |
|
Definition at line 516 of file ast_expr.c. |
|
Definition at line 295 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 661 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 297 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 554 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 51 of file ast_expr.c. |
|
Definition at line 111 of file ast_expr.c. |
|
Value: Current.first_line = Rhs[1].first_line; \ Current.first_column = Rhs[1].first_column; \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; Definition at line 544 of file ast_expr.c. |
|
Definition at line 46 of file ast_expr.c. |
|
Definition at line 53 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 676 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 310 of file ast_expr.c. |
|
Definition at line 56 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 302 of file ast_expr.c. |
|
Definition at line 304 of file ast_expr.c. |
|
Definition at line 306 of file ast_expr.c. |
|
Definition at line 300 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 430 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 50 of file ast_expr.c. |
|
Definition at line 110 of file ast_expr.c. Referenced by yyparse(). |
|
Referenced by yyparse(). |
|
Definition at line 43 of file ast_expr.c. |
|
Definition at line 518 of file ast_expr.c. |
|
Definition at line 499 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 40 of file ast_expr.c. |
|
Definition at line 226 of file ast_expr.c. Referenced by yyparse(). |
|
Value: ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) Definition at line 248 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 227 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 244 of file ast_expr.c. |
|
Definition at line 275 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 184 of file ast_expr.c. |
|
Definition at line 185 of file ast_expr.c. |
|
Definition at line 186 of file ast_expr.c. |
|
Definition at line 449 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 537 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 312 of file ast_expr.c. Referenced by yyparse(). |
|
Definition at line 309 of file ast_expr.c. |
|
Definition at line 291 of file ast_expr.c. |
|
|
|
Definition at line 116 of file ast_expr.c.
00116 { 00117 integer, numeric_string, string 00118 } ; |
|
Definition at line 64 of file ast_expr.c.
|
|
Definition at line 1539 of file ast_expr.c. References parser_control::argv, parser_control::firsttoken, free, integer, malloc, parser_control::result, strdup, val::type, and val::u. Referenced by pbx_substitute_variables_helper().
01540 { 01541 struct parser_control karoto; 01542 01543 char *kota; 01544 char *pirouni; 01545 01546 kota=strdup(arg); 01547 karoto.result = NULL; 01548 karoto.firsttoken=1; 01549 karoto.argv=kota; 01550 01551 ast_yyparse ((void *)&karoto); 01552 01553 free(kota); 01554 01555 if (karoto.result==NULL) { 01556 pirouni=strdup("0"); 01557 return(pirouni); 01558 } else { 01559 if (karoto.result->type == integer) { 01560 pirouni=malloc(256); 01561 sprintf (pirouni,"%lld", (long long)karoto.result->u.i); 01562 } 01563 else { 01564 pirouni=strdup(karoto.result->u.s); 01565 } 01566 free(karoto.result); 01567 } 01568 return(pirouni); 01569 } |
|
Definition at line 829 of file ast_expr.c. References YYSTYPE::val, YY_REDUCE_PRINT, YY_STACK_PRINT, YYABORT, YYACCEPT, yychar, YYDPRINTF, YYDSYMPRINTF, YYEMPTY, YYEOF, yyerror, YYFINAL, YYINITDEPTH, YYLAST, YYLEX, yylval, YYMAXDEPTH, yynerrs, YYNTOKENS, YYPACT_NINF, YYPARSE_PARAM, YYPOPSTACK, YYSIZE_T, YYSTACK_ALLOC, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, YYTABLE_NINF, YYTERROR, and YYTRANSLATE.
00842 { 00843 /* The lookahead symbol. */ 00844 int yychar; 00845 00846 /* The semantic value of the lookahead symbol. */ 00847 YYSTYPE yylval; 00848 00849 /* Number of syntax errors so far. */ 00850 int yynerrs; 00851 00852 register int yystate; 00853 register int yyn; 00854 int yyresult; 00855 /* Number of tokens to shift before error messages enabled. */ 00856 int yyerrstatus; 00857 /* Lookahead token as an internal (translated) token number. */ 00858 int yytoken = 0; 00859 00860 /* Three stacks and their tools: 00861 `yyss': related to states, 00862 `yyvs': related to semantic values, 00863 `yyls': related to locations. 00864 00865 Refer to the stacks thru separate pointers, to allow yyoverflow 00866 to reallocate them elsewhere. */ 00867 00868 /* The state stack. */ 00869 short yyssa[YYINITDEPTH]; 00870 short *yyss = yyssa; 00871 register short *yyssp; 00872 00873 /* The semantic value stack. */ 00874 YYSTYPE yyvsa[YYINITDEPTH]; 00875 YYSTYPE *yyvs = yyvsa; 00876 register YYSTYPE *yyvsp; 00877 00878 00879 00880 #define YYPOPSTACK (yyvsp--, yyssp--) 00881 00882 YYSIZE_T yystacksize = YYINITDEPTH; 00883 00884 /* The variables used to return semantic value and location from the 00885 action routines. */ 00886 YYSTYPE yyval; 00887 00888 00889 /* When reducing, the number of symbols on the RHS of the reduced 00890 rule. */ 00891 int yylen; 00892 00893 YYDPRINTF ((stderr, "Starting parse\n")); 00894 00895 yystate = 0; 00896 yyerrstatus = 0; 00897 yynerrs = 0; 00898 yychar = YYEMPTY; /* Cause a token to be read. */ 00899 00900 /* Initialize stack pointers. 00901 Waste one element of value and location stack 00902 so that they stay on the same level as the state stack. 00903 The wasted elements are never initialized. */ 00904 00905 yyssp = yyss; 00906 yyvsp = yyvs; 00907 00908 goto yysetstate; 00909 00910 /*------------------------------------------------------------. 00911 | yynewstate -- Push a new state, which is found in yystate. | 00912 `------------------------------------------------------------*/ 00913 yynewstate: 00914 /* In all cases, when you get here, the value and location stacks 00915 have just been pushed. so pushing a state here evens the stacks. 00916 */ 00917 yyssp++; 00918 00919 yysetstate: 00920 *yyssp = yystate; 00921 00922 if (yyss + yystacksize - 1 <= yyssp) 00923 { 00924 /* Get the current used size of the three stacks, in elements. */ 00925 YYSIZE_T yysize = yyssp - yyss + 1; 00926 00927 #ifdef yyoverflow 00928 { 00929 /* Give user a chance to reallocate the stack. Use copies of 00930 these so that the &'s don't force the real ones into 00931 memory. */ 00932 YYSTYPE *yyvs1 = yyvs; 00933 short *yyss1 = yyss; 00934 00935 00936 /* Each stack pointer address is followed by the size of the 00937 data in use in that stack, in bytes. This used to be a 00938 conditional around just the two extra args, but that might 00939 be undefined if yyoverflow is a macro. */ 00940 yyoverflow ("parser stack overflow", 00941 &yyss1, yysize * sizeof (*yyssp), 00942 &yyvs1, yysize * sizeof (*yyvsp), 00943 00944 &yystacksize); 00945 00946 yyss = yyss1; 00947 yyvs = yyvs1; 00948 } 00949 #else /* no yyoverflow */ 00950 # ifndef YYSTACK_RELOCATE 00951 goto yyoverflowlab; 00952 # else 00953 /* Extend the stack our own way. */ 00954 if (YYMAXDEPTH <= yystacksize) 00955 goto yyoverflowlab; 00956 yystacksize *= 2; 00957 if (YYMAXDEPTH < yystacksize) 00958 yystacksize = YYMAXDEPTH; 00959 00960 { 00961 short *yyss1 = yyss; 00962 union yyalloc *yyptr = 00963 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 00964 if (! yyptr) 00965 goto yyoverflowlab; 00966 YYSTACK_RELOCATE (yyss); 00967 YYSTACK_RELOCATE (yyvs); 00968 00969 # undef YYSTACK_RELOCATE 00970 if (yyss1 != yyssa) 00971 YYSTACK_FREE (yyss1); 00972 } 00973 # endif 00974 #endif /* no yyoverflow */ 00975 00976 yyssp = yyss + yysize - 1; 00977 yyvsp = yyvs + yysize - 1; 00978 00979 00980 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 00981 (unsigned long int) yystacksize)); 00982 00983 if (yyss + yystacksize - 1 <= yyssp) 00984 YYABORT; 00985 } 00986 00987 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 00988 00989 goto yybackup; 00990 00991 /*-----------. 00992 | yybackup. | 00993 `-----------*/ 00994 yybackup: 00995 00996 /* Do appropriate processing given the current state. */ 00997 /* Read a lookahead token if we need one and don't already have one. */ 00998 /* yyresume: */ 00999 01000 /* First try to decide what to do without reference to lookahead token. */ 01001 01002 yyn = yypact[yystate]; 01003 if (yyn == YYPACT_NINF) 01004 goto yydefault; 01005 01006 /* Not known => get a lookahead token if don't already have one. */ 01007 01008 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01009 if (yychar == YYEMPTY) 01010 { 01011 YYDPRINTF ((stderr, "Reading a token: ")); 01012 yychar = YYLEX; 01013 } 01014 01015 if (yychar <= YYEOF) 01016 { 01017 yychar = yytoken = YYEOF; 01018 YYDPRINTF ((stderr, "Now at end of input.\n")); 01019 } 01020 else 01021 { 01022 yytoken = YYTRANSLATE (yychar); 01023 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); 01024 } 01025 01026 /* If the proper action on seeing token YYTOKEN is to reduce or to 01027 detect an error, take that action. */ 01028 yyn += yytoken; 01029 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01030 goto yydefault; 01031 yyn = yytable[yyn]; 01032 if (yyn <= 0) 01033 { 01034 if (yyn == 0 || yyn == YYTABLE_NINF) 01035 goto yyerrlab; 01036 yyn = -yyn; 01037 goto yyreduce; 01038 } 01039 01040 if (yyn == YYFINAL) 01041 YYACCEPT; 01042 01043 /* Shift the lookahead token. */ 01044 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); 01045 01046 /* Discard the token being shifted unless it is eof. */ 01047 if (yychar != YYEOF) 01048 yychar = YYEMPTY; 01049 01050 *++yyvsp = yylval; 01051 01052 01053 /* Count tokens shifted since error; after three, turn off error 01054 status. */ 01055 if (yyerrstatus) 01056 yyerrstatus--; 01057 01058 yystate = yyn; 01059 goto yynewstate; 01060 01061 01062 /*-----------------------------------------------------------. 01063 | yydefault -- do the default action for the current state. | 01064 `-----------------------------------------------------------*/ 01065 yydefault: 01066 yyn = yydefact[yystate]; 01067 if (yyn == 0) 01068 goto yyerrlab; 01069 goto yyreduce; 01070 01071 01072 /*-----------------------------. 01073 | yyreduce -- Do a reduction. | 01074 `-----------------------------*/ 01075 yyreduce: 01076 /* yyn is the number of a rule to reduce with. */ 01077 yylen = yyr2[yyn]; 01078 01079 /* If YYLEN is nonzero, implement the default value of the action: 01080 `$$ = $1'. 01081 01082 Otherwise, the following line sets YYVAL to garbage. 01083 This behavior is undocumented and Bison 01084 users should not rely upon it. Assigning to YYVAL 01085 unconditionally makes the parser a bit smaller, and it avoids a 01086 GCC warning that YYVAL may be used uninitialized. */ 01087 yyval = yyvsp[1-yylen]; 01088 01089 01090 YY_REDUCE_PRINT (yyn); 01091 switch (yyn) 01092 { 01093 case 2: 01094 #line 109 "ast_expr.y" 01095 { ((struct parser_control *)kota)->result = yyval.val; ;} 01096 break; 01097 01098 case 4: 01099 #line 113 "ast_expr.y" 01100 { yyval.val = yyvsp[-1].val; ;} 01101 break; 01102 01103 case 5: 01104 #line 114 "ast_expr.y" 01105 { yyval.val = op_or (yyvsp[-2].val, yyvsp[0].val); ;} 01106 break; 01107 01108 case 6: 01109 #line 115 "ast_expr.y" 01110 { yyval.val = op_and (yyvsp[-2].val, yyvsp[0].val); ;} 01111 break; 01112 01113 case 7: 01114 #line 116 "ast_expr.y" 01115 { yyval.val = op_eq (yyvsp[-2].val, yyvsp[0].val); ;} 01116 break; 01117 01118 case 8: 01119 #line 117 "ast_expr.y" 01120 { yyval.val = op_gt (yyvsp[-2].val, yyvsp[0].val); ;} 01121 break; 01122 01123 case 9: 01124 #line 118 "ast_expr.y" 01125 { yyval.val = op_lt (yyvsp[-2].val, yyvsp[0].val); ;} 01126 break; 01127 01128 case 10: 01129 #line 119 "ast_expr.y" 01130 { yyval.val = op_ge (yyvsp[-2].val, yyvsp[0].val); ;} 01131 break; 01132 01133 case 11: 01134 #line 120 "ast_expr.y" 01135 { yyval.val = op_le (yyvsp[-2].val, yyvsp[0].val); ;} 01136 break; 01137 01138 case 12: 01139 #line 121 "ast_expr.y" 01140 { yyval.val = op_ne (yyvsp[-2].val, yyvsp[0].val); ;} 01141 break; 01142 01143 case 13: 01144 #line 122 "ast_expr.y" 01145 { yyval.val = op_plus (yyvsp[-2].val, yyvsp[0].val); ;} 01146 break; 01147 01148 case 14: 01149 #line 123 "ast_expr.y" 01150 { yyval.val = op_minus (yyvsp[-2].val, yyvsp[0].val); ;} 01151 break; 01152 01153 case 15: 01154 #line 124 "ast_expr.y" 01155 { yyval.val = op_times (yyvsp[-2].val, yyvsp[0].val); ;} 01156 break; 01157 01158 case 16: 01159 #line 125 "ast_expr.y" 01160 { yyval.val = op_div (yyvsp[-2].val, yyvsp[0].val); ;} 01161 break; 01162 01163 case 17: 01164 #line 126 "ast_expr.y" 01165 { yyval.val = op_rem (yyvsp[-2].val, yyvsp[0].val); ;} 01166 break; 01167 01168 case 18: 01169 #line 127 "ast_expr.y" 01170 { yyval.val = op_colon (yyvsp[-2].val, yyvsp[0].val); ;} 01171 break; 01172 01173 01174 } 01175 01176 /* Line 999 of yacc.c. */ 01177 #line 1178 "ast_expr.c" 01178 01179 yyvsp -= yylen; 01180 yyssp -= yylen; 01181 01182 01183 YY_STACK_PRINT (yyss, yyssp); 01184 01185 *++yyvsp = yyval; 01186 01187 01188 /* Now `shift' the result of the reduction. Determine what state 01189 that goes to, based on the state we popped back to and the rule 01190 number reduced by. */ 01191 01192 yyn = yyr1[yyn]; 01193 01194 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 01195 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 01196 yystate = yytable[yystate]; 01197 else 01198 yystate = yydefgoto[yyn - YYNTOKENS]; 01199 01200 goto yynewstate; 01201 01202 01203 /*------------------------------------. 01204 | yyerrlab -- here on detecting error | 01205 `------------------------------------*/ 01206 yyerrlab: 01207 /* If not already recovering from an error, report this error. */ 01208 if (!yyerrstatus) 01209 { 01210 ++yynerrs; 01211 #if YYERROR_VERBOSE 01212 yyn = yypact[yystate]; 01213 01214 if (YYPACT_NINF < yyn && yyn < YYLAST) 01215 { 01216 YYSIZE_T yysize = 0; 01217 int yytype = YYTRANSLATE (yychar); 01218 char *yymsg; 01219 int yyx, yycount; 01220 01221 yycount = 0; 01222 /* Start YYX at -YYN if negative to avoid negative indexes in 01223 YYCHECK. */ 01224 for (yyx = yyn < 0 ? -yyn : 0; 01225 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) 01226 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 01227 yysize += yystrlen (yytname[yyx]) + 15, yycount++; 01228 yysize += yystrlen ("syntax error, unexpected ") + 1; 01229 yysize += yystrlen (yytname[yytype]); 01230 yymsg = (char *) YYSTACK_ALLOC (yysize); 01231 if (yymsg != 0) 01232 { 01233 char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); 01234 yyp = yystpcpy (yyp, yytname[yytype]); 01235 01236 if (yycount < 5) 01237 { 01238 yycount = 0; 01239 for (yyx = yyn < 0 ? -yyn : 0; 01240 yyx < (int) (sizeof (yytname) / sizeof (char *)); 01241 yyx++) 01242 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 01243 { 01244 const char *yyq = ! yycount ? ", expecting " : " or "; 01245 yyp = yystpcpy (yyp, yyq); 01246 yyp = yystpcpy (yyp, yytname[yyx]); 01247 yycount++; 01248 } 01249 } 01250 yyerror (yymsg); 01251 YYSTACK_FREE (yymsg); 01252 } 01253 else 01254 yyerror ("syntax error; also virtual memory exhausted"); 01255 } 01256 else 01257 #endif /* YYERROR_VERBOSE */ 01258 yyerror ("syntax error"); 01259 } 01260 01261 01262 01263 if (yyerrstatus == 3) 01264 { 01265 /* If just tried and failed to reuse lookahead token after an 01266 error, discard it. */ 01267 01268 /* Return failure if at end of input. */ 01269 if (yychar == YYEOF) 01270 { 01271 /* Pop the error token. */ 01272 YYPOPSTACK; 01273 /* Pop the rest of the stack. */ 01274 while (yyss < yyssp) 01275 { 01276 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 01277 yydestruct (yystos[*yyssp], yyvsp); 01278 YYPOPSTACK; 01279 } 01280 YYABORT; 01281 } 01282 01283 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); 01284 yydestruct (yytoken, &yylval); 01285 yychar = YYEMPTY; 01286 01287 } 01288 01289 /* Else will try to reuse lookahead token after shifting the error 01290 token. */ 01291 goto yyerrlab1; 01292 01293 01294 /*----------------------------------------------------. 01295 | yyerrlab1 -- error raised explicitly by an action. | 01296 `----------------------------------------------------*/ 01297 yyerrlab1: 01298 yyerrstatus = 3; /* Each real token shifted decrements this. */ 01299 01300 for (;;) 01301 { 01302 yyn = yypact[yystate]; 01303 if (yyn != YYPACT_NINF) 01304 { 01305 yyn += YYTERROR; 01306 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 01307 { 01308 yyn = yytable[yyn]; 01309 if (0 < yyn) 01310 break; 01311 } 01312 } 01313 01314 /* Pop the current state because it cannot handle the error token. */ 01315 if (yyssp == yyss) 01316 YYABORT; 01317 01318 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 01319 yydestruct (yystos[yystate], yyvsp); 01320 yyvsp--; 01321 yystate = *--yyssp; 01322 01323 YY_STACK_PRINT (yyss, yyssp); 01324 } 01325 01326 if (yyn == YYFINAL) 01327 YYACCEPT; 01328 01329 YYDPRINTF ((stderr, "Shifting error token, ")); 01330 01331 *++yyvsp = yylval; 01332 01333 01334 yystate = yyn; 01335 goto yynewstate; 01336 01337 01338 /*-------------------------------------. 01339 | yyacceptlab -- YYACCEPT comes here. | 01340 `-------------------------------------*/ 01341 yyacceptlab: 01342 yyresult = 0; 01343 goto yyreturn; 01344 01345 /*-----------------------------------. 01346 | yyabortlab -- YYABORT comes here. | 01347 `-----------------------------------*/ 01348 yyabortlab: 01349 yyresult = 1; 01350 goto yyreturn; 01351 01352 #ifndef yyoverflow 01353 /*----------------------------------------------. 01354 | yyoverflowlab -- parser overflow comes here. | 01355 `----------------------------------------------*/ 01356 yyoverflowlab: 01357 yyerror ("parser stack overflow"); 01358 yyresult = 2; 01359 /* Fall through. */ 01360 #endif 01361 01362 yyreturn: 01363 #ifndef yyoverflow 01364 if (yyss != yyssa) 01365 YYSTACK_FREE (yyss); 01366 #endif 01367 return yyresult; 01368 } |
|
|