1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
80 /* Copy the first part of user declarations. */
90 typedef struct ssfilter * ssfilter_t;
92 #define YYSTYPE ssfilter_t
94 static struct ssfilter * alloc_node(int type, void *pred)
96 struct ssfilter *n = malloc(sizeof(*n));
105 static char **yy_argv;
108 static ssfilter_t *yy_ret;
110 static int yylex(void);
112 static void yyerror(char *s)
114 fprintf(stderr, "ss: bison bellows (while parsing filter): \"%s!\"", s);
119 /* Enabling traces. */
124 /* Enabling verbose error messages. */
125 #ifdef YYERROR_VERBOSE
126 # undef YYERROR_VERBOSE
127 # define YYERROR_VERBOSE 1
129 # define YYERROR_VERBOSE 0
132 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
134 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
135 # define YYSTYPE_IS_DECLARED 1
136 # define YYSTYPE_IS_TRIVIAL 1
141 /* Copy the second part of user declarations. */
144 /* Line 214 of yacc.c. */
145 #line 146 "ssfilter.c"
147 #if ! defined (yyoverflow) || YYERROR_VERBOSE
153 # define YYMALLOC malloc
156 /* The parser invokes alloca or malloc; define the necessary symbols. */
158 # ifdef YYSTACK_USE_ALLOCA
159 # if YYSTACK_USE_ALLOCA
160 # define YYSTACK_ALLOC alloca
163 # if defined (alloca) || defined (_ALLOCA_H)
164 # define YYSTACK_ALLOC alloca
167 # define YYSTACK_ALLOC __builtin_alloca
172 # ifdef YYSTACK_ALLOC
173 /* Pacify GCC's `empty if-body' warning. */
174 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
176 # if defined (__STDC__) || defined (__cplusplus)
177 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
178 # define YYSIZE_T size_t
180 # define YYSTACK_ALLOC YYMALLOC
181 # define YYSTACK_FREE YYFREE
183 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
186 #if (! defined (yyoverflow) \
187 && (! defined (__cplusplus) \
188 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
190 /* A type that is properly aligned for any stack member. */
197 /* The size of the maximum gap between one aligned stack and the next. */
198 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
200 /* The size of an array large to enough to hold all stacks, each with
202 # define YYSTACK_BYTES(N) \
203 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
204 + YYSTACK_GAP_MAXIMUM)
206 /* Copy COUNT objects from FROM to TO. The source and destination do
209 # if defined (__GNUC__) && 1 < __GNUC__
210 # define YYCOPY(To, From, Count) \
211 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
213 # define YYCOPY(To, From, Count) \
216 register YYSIZE_T yyi; \
217 for (yyi = 0; yyi < (Count); yyi++) \
218 (To)[yyi] = (From)[yyi]; \
224 /* Relocate STACK from its old location to the new one. The
225 local variables YYSIZE and YYSTACKSIZE give the old and new number of
226 elements in the stack, and YYPTR gives the new location of the
227 stack. Advance YYPTR to a properly aligned location for the next
229 # define YYSTACK_RELOCATE(Stack) \
232 YYSIZE_T yynewbytes; \
233 YYCOPY (&yyptr->Stack, Stack, yysize); \
234 Stack = &yyptr->Stack; \
235 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
236 yyptr += yynewbytes / sizeof (*yyptr); \
242 #if defined (__STDC__) || defined (__cplusplus)
243 typedef signed char yysigned_char;
245 typedef short yysigned_char;
248 /* YYFINAL -- State number of the termination state. */
250 /* YYLAST -- Last index in YYTABLE. */
253 /* YYNTOKENS -- Number of terminals. */
255 /* YYNNTS -- Number of nonterminals. */
257 /* YYNRULES -- Number of rules. */
259 /* YYNRULES -- Number of states. */
262 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
264 #define YYMAXUTOK 266
266 #define YYTRANSLATE(YYX) \
267 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
269 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
270 static const unsigned char yytranslate[] =
272 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
273 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
274 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
275 2, 2, 2, 14, 2, 2, 2, 2, 13, 2,
276 18, 19, 2, 2, 2, 2, 2, 2, 2, 2,
277 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
278 16, 17, 15, 2, 2, 2, 2, 2, 2, 2,
279 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
280 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
281 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
282 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
283 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
284 2, 2, 2, 2, 12, 2, 2, 2, 2, 2,
285 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
286 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
288 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
289 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
290 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
291 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
292 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
293 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
294 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
295 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
296 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
297 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
298 5, 6, 7, 8, 9, 10, 11
302 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
304 static const unsigned char yyprhs[] =
306 0, 0, 3, 6, 8, 9, 12, 15, 19, 23,
307 27, 31, 35, 39, 43, 47, 51, 55, 59, 63,
311 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
312 static const yysigned_char yyrhs[] =
314 21, 0, -1, 22, 23, -1, 22, -1, -1, 4,
315 3, -1, 5, 3, -1, 6, 9, 3, -1, 6,
316 8, 3, -1, 6, 15, 3, -1, 6, 16, 3,
317 -1, 6, 17, 3, -1, 6, 10, 3, -1, 7,
318 9, 3, -1, 7, 8, 3, -1, 7, 15, 3,
319 -1, 7, 16, 3, -1, 7, 17, 3, -1, 7,
320 10, 3, -1, 11, -1, 23, 12, 23, -1, 23,
321 23, -1, 23, 13, 23, -1, 14, 23, -1, 18,
325 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
326 static const unsigned char yyrline[] =
328 0, 44, 44, 49, 51, 53, 57, 61, 65, 69,
329 73, 77, 81, 86, 90, 94, 98, 102, 106, 111,
330 115, 120, 125, 131, 135
334 #if YYDEBUG || YYERROR_VERBOSE
335 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
336 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
337 static const char *const yytname[] =
339 "$end", "error", "$undefined", "HOSTCOND", "DCOND", "SCOND", "DPORT",
340 "SPORT", "LEQ", "GEQ", "NEQ", "AUTOBOUND", "'|'", "'&'", "'!'", "'>'",
341 "'<'", "'='", "'('", "')'", "$accept", "applet", "null", "expr", 0
346 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
348 static const unsigned short yytoknum[] =
350 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
351 265, 266, 124, 38, 33, 62, 60, 61, 40, 41
355 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
356 static const unsigned char yyr1[] =
358 0, 20, 21, 21, 22, 23, 23, 23, 23, 23,
359 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
363 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
364 static const unsigned char yyr2[] =
366 0, 2, 2, 1, 0, 2, 2, 3, 3, 3,
367 3, 3, 3, 3, 3, 3, 3, 3, 3, 1,
371 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
372 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
373 means the default is an error. */
374 static const unsigned char yydefact[] =
376 4, 0, 3, 1, 0, 0, 0, 0, 19, 0,
377 0, 2, 5, 6, 0, 0, 0, 0, 0, 0,
378 0, 0, 0, 0, 0, 0, 23, 0, 0, 0,
379 21, 8, 7, 12, 9, 10, 11, 14, 13, 18,
380 15, 16, 17, 24, 20, 22
383 /* YYDEFGOTO[NTERM-NUM]. */
384 static const yysigned_char yydefgoto[] =
389 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
391 #define YYPACT_NINF -3
392 static const yysigned_char yypact[] =
394 -3, 1, 47, -3, 6, 11, 69, 73, -3, 47,
395 47, 17, -3, -3, 12, 13, 16, 22, 29, 30,
396 31, 37, 38, 39, 41, 44, 62, -1, 47, 47,
397 17, -3, -3, -3, -3, -3, -3, -3, -3, -3,
398 -3, -3, -3, -3, 32, 47
401 /* YYPGOTO[NTERM-NUM]. */
402 static const yysigned_char yypgoto[] =
407 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
408 positive, shift that token. If negative, reduce the rule which
409 number is the opposite. If zero, do what YYDEFACT says.
410 If YYTABLE_NINF, syntax error. */
411 #define YYTABLE_NINF -1
412 static const yysigned_char yytable[] =
414 11, 3, 0, 4, 5, 6, 7, 26, 27, 12,
415 8, 28, 29, 9, 13, 31, 32, 10, 43, 33,
416 0, 4, 5, 6, 7, 34, 44, 45, 8, 28,
417 29, 9, 35, 36, 37, 10, 4, 5, 6, 7,
418 38, 39, 40, 8, 41, 29, 9, 42, 0, 0,
419 10, 4, 5, 6, 7, 0, 0, 0, 8, 0,
420 0, 9, 0, 0, 0, 10, 4, 5, 6, 7,
421 0, 0, 0, 8, 0, 0, -1, 14, 15, 16,
422 10, 20, 21, 22, 17, 18, 19, 0, 23, 24,
426 static const yysigned_char yycheck[] =
428 2, 0, -1, 4, 5, 6, 7, 9, 10, 3,
429 11, 12, 13, 14, 3, 3, 3, 18, 19, 3,
430 -1, 4, 5, 6, 7, 3, 28, 29, 11, 12,
431 13, 14, 3, 3, 3, 18, 4, 5, 6, 7,
432 3, 3, 3, 11, 3, 13, 14, 3, -1, -1,
433 18, 4, 5, 6, 7, -1, -1, -1, 11, -1,
434 -1, 14, -1, -1, -1, 18, 4, 5, 6, 7,
435 -1, -1, -1, 11, -1, -1, 14, 8, 9, 10,
436 18, 8, 9, 10, 15, 16, 17, -1, 15, 16,
440 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
441 symbol of state STATE-NUM. */
442 static const unsigned char yystos[] =
444 0, 21, 22, 0, 4, 5, 6, 7, 11, 14,
445 18, 23, 3, 3, 8, 9, 10, 15, 16, 17,
446 8, 9, 10, 15, 16, 17, 23, 23, 12, 13,
447 23, 3, 3, 3, 3, 3, 3, 3, 3, 3,
451 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
452 # define YYSIZE_T __SIZE_TYPE__
454 #if ! defined (YYSIZE_T) && defined (size_t)
455 # define YYSIZE_T size_t
457 #if ! defined (YYSIZE_T)
458 # if defined (__STDC__) || defined (__cplusplus)
459 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
460 # define YYSIZE_T size_t
463 #if ! defined (YYSIZE_T)
464 # define YYSIZE_T unsigned int
467 #define yyerrok (yyerrstatus = 0)
468 #define yyclearin (yychar = YYEMPTY)
472 #define YYACCEPT goto yyacceptlab
473 #define YYABORT goto yyabortlab
474 #define YYERROR goto yyerrorlab
477 /* Like YYERROR except do call yyerror. This remains here temporarily
478 to ease the transition to the new meaning of YYERROR, for GCC.
479 Once GCC version 2 has supplanted version 1, this can go. */
481 #define YYFAIL goto yyerrlab
483 #define YYRECOVERING() (!!yyerrstatus)
485 #define YYBACKUP(Token, Value) \
487 if (yychar == YYEMPTY && yylen == 1) \
491 yytoken = YYTRANSLATE (yychar); \
497 yyerror ("syntax error: cannot back up");\
503 #define YYERRCODE 256
505 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
508 #ifndef YYLLOC_DEFAULT
509 # define YYLLOC_DEFAULT(Current, Rhs, N) \
510 ((Current).first_line = (Rhs)[1].first_line, \
511 (Current).first_column = (Rhs)[1].first_column, \
512 (Current).last_line = (Rhs)[N].last_line, \
513 (Current).last_column = (Rhs)[N].last_column)
516 /* YYLEX -- calling `yylex' with the right arguments. */
519 # define YYLEX yylex (YYLEX_PARAM)
521 # define YYLEX yylex ()
524 /* Enable debugging if requested. */
528 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
529 # define YYFPRINTF fprintf
532 # define YYDPRINTF(Args) \
538 # define YYDSYMPRINT(Args) \
544 # define YYDSYMPRINTF(Title, Token, Value, Location) \
548 YYFPRINTF (stderr, "%s ", Title); \
549 yysymprint (stderr, \
551 YYFPRINTF (stderr, "\n"); \
555 /*------------------------------------------------------------------.
556 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
558 `------------------------------------------------------------------*/
560 #if defined (__STDC__) || defined (__cplusplus)
562 yy_stack_print (short *bottom, short *top)
565 yy_stack_print (bottom, top)
570 YYFPRINTF (stderr, "Stack now");
571 for (/* Nothing. */; bottom <= top; ++bottom)
572 YYFPRINTF (stderr, " %d", *bottom);
573 YYFPRINTF (stderr, "\n");
576 # define YY_STACK_PRINT(Bottom, Top) \
579 yy_stack_print ((Bottom), (Top)); \
583 /*------------------------------------------------.
584 | Report that the YYRULE is going to be reduced. |
585 `------------------------------------------------*/
587 #if defined (__STDC__) || defined (__cplusplus)
589 yy_reduce_print (int yyrule)
592 yy_reduce_print (yyrule)
597 unsigned int yylno = yyrline[yyrule];
598 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
600 /* Print the symbols being reduced, and their result. */
601 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
602 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
603 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
606 # define YY_REDUCE_PRINT(Rule) \
609 yy_reduce_print (Rule); \
612 /* Nonzero means print parse trace. It is left uninitialized so that
613 multiple parsers can coexist. */
616 # define YYDPRINTF(Args)
617 # define YYDSYMPRINT(Args)
618 # define YYDSYMPRINTF(Title, Token, Value, Location)
619 # define YY_STACK_PRINT(Bottom, Top)
620 # define YY_REDUCE_PRINT(Rule)
621 #endif /* !YYDEBUG */
624 /* YYINITDEPTH -- initial size of the parser's stacks. */
626 # define YYINITDEPTH 200
629 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
630 if the built-in stack extension method is used).
632 Do not make this value too large; the results are undefined if
633 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
634 evaluated with infinite-precision integer arithmetic. */
636 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
641 # define YYMAXDEPTH 10000
649 # if defined (__GLIBC__) && defined (_STRING_H)
650 # define yystrlen strlen
652 /* Return the length of YYSTR. */
654 # if defined (__STDC__) || defined (__cplusplus)
655 yystrlen (const char *yystr)
661 register const char *yys = yystr;
663 while (*yys++ != '\0')
666 return yys - yystr - 1;
672 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
673 # define yystpcpy stpcpy
675 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
678 # if defined (__STDC__) || defined (__cplusplus)
679 yystpcpy (char *yydest, const char *yysrc)
681 yystpcpy (yydest, yysrc)
686 register char *yyd = yydest;
687 register const char *yys = yysrc;
689 while ((*yyd++ = *yys++) != '\0')
697 #endif /* !YYERROR_VERBOSE */
702 /*--------------------------------.
703 | Print this symbol on YYOUTPUT. |
704 `--------------------------------*/
706 #if defined (__STDC__) || defined (__cplusplus)
708 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
711 yysymprint (yyoutput, yytype, yyvaluep)
717 /* Pacify ``unused variable'' warnings. */
720 if (yytype < YYNTOKENS)
722 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
724 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
728 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
735 YYFPRINTF (yyoutput, ")");
738 #endif /* ! YYDEBUG */
739 /*-----------------------------------------------.
740 | Release the memory associated to this symbol. |
741 `-----------------------------------------------*/
743 #if defined (__STDC__) || defined (__cplusplus)
745 yydestruct (int yytype, YYSTYPE *yyvaluep)
748 yydestruct (yytype, yyvaluep)
753 /* Pacify ``unused variable'' warnings. */
765 /* Prevent warnings from -Wmissing-prototypes. */
768 # if defined (__STDC__) || defined (__cplusplus)
769 int yyparse (void *YYPARSE_PARAM);
773 #else /* ! YYPARSE_PARAM */
774 #if defined (__STDC__) || defined (__cplusplus)
779 #endif /* ! YYPARSE_PARAM */
783 /* The lookahead symbol. */
786 /* The semantic value of the lookahead symbol. */
789 /* Number of syntax errors so far. */
799 # if defined (__STDC__) || defined (__cplusplus)
800 int yyparse (void *YYPARSE_PARAM)
802 int yyparse (YYPARSE_PARAM)
805 #else /* ! YYPARSE_PARAM */
806 #if defined (__STDC__) || defined (__cplusplus)
817 register int yystate;
820 /* Number of tokens to shift before error messages enabled. */
822 /* Lookahead token as an internal (translated) token number. */
825 /* Three stacks and their tools:
826 `yyss': related to states,
827 `yyvs': related to semantic values,
828 `yyls': related to locations.
830 Refer to the stacks thru separate pointers, to allow yyoverflow
831 to reallocate them elsewhere. */
833 /* The state stack. */
834 short yyssa[YYINITDEPTH];
836 register short *yyssp;
838 /* The semantic value stack. */
839 YYSTYPE yyvsa[YYINITDEPTH];
840 YYSTYPE *yyvs = yyvsa;
841 register YYSTYPE *yyvsp;
845 #define YYPOPSTACK (yyvsp--, yyssp--)
847 YYSIZE_T yystacksize = YYINITDEPTH;
849 /* The variables used to return semantic value and location from the
854 /* When reducing, the number of symbols on the RHS of the reduced
858 YYDPRINTF ((stderr, "Starting parse\n"));
863 yychar = YYEMPTY; /* Cause a token to be read. */
865 /* Initialize stack pointers.
866 Waste one element of value and location stack
867 so that they stay on the same level as the state stack.
868 The wasted elements are never initialized. */
875 /*------------------------------------------------------------.
876 | yynewstate -- Push a new state, which is found in yystate. |
877 `------------------------------------------------------------*/
879 /* In all cases, when you get here, the value and location stacks
880 have just been pushed. so pushing a state here evens the stacks.
887 if (yyss + yystacksize - 1 <= yyssp)
889 /* Get the current used size of the three stacks, in elements. */
890 YYSIZE_T yysize = yyssp - yyss + 1;
894 /* Give user a chance to reallocate the stack. Use copies of
895 these so that the &'s don't force the real ones into
897 YYSTYPE *yyvs1 = yyvs;
901 /* Each stack pointer address is followed by the size of the
902 data in use in that stack, in bytes. This used to be a
903 conditional around just the two extra args, but that might
904 be undefined if yyoverflow is a macro. */
905 yyoverflow ("parser stack overflow",
906 &yyss1, yysize * sizeof (*yyssp),
907 &yyvs1, yysize * sizeof (*yyvsp),
914 #else /* no yyoverflow */
915 # ifndef YYSTACK_RELOCATE
918 /* Extend the stack our own way. */
919 if (YYMAXDEPTH <= yystacksize)
922 if (YYMAXDEPTH < yystacksize)
923 yystacksize = YYMAXDEPTH;
927 union yyalloc *yyptr =
928 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
931 YYSTACK_RELOCATE (yyss);
932 YYSTACK_RELOCATE (yyvs);
934 # undef YYSTACK_RELOCATE
936 YYSTACK_FREE (yyss1);
939 #endif /* no yyoverflow */
941 yyssp = yyss + yysize - 1;
942 yyvsp = yyvs + yysize - 1;
945 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
946 (unsigned long int) yystacksize));
948 if (yyss + yystacksize - 1 <= yyssp)
952 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
961 /* Do appropriate processing given the current state. */
962 /* Read a lookahead token if we need one and don't already have one. */
965 /* First try to decide what to do without reference to lookahead token. */
967 yyn = yypact[yystate];
968 if (yyn == YYPACT_NINF)
971 /* Not known => get a lookahead token if don't already have one. */
973 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
974 if (yychar == YYEMPTY)
976 YYDPRINTF ((stderr, "Reading a token: "));
982 yychar = yytoken = YYEOF;
983 YYDPRINTF ((stderr, "Now at end of input.\n"));
987 yytoken = YYTRANSLATE (yychar);
988 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
991 /* If the proper action on seeing token YYTOKEN is to reduce or to
992 detect an error, take that action. */
994 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
999 if (yyn == 0 || yyn == YYTABLE_NINF)
1008 /* Shift the lookahead token. */
1009 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1011 /* Discard the token being shifted unless it is eof. */
1012 if (yychar != YYEOF)
1018 /* Count tokens shifted since error; after three, turn off error
1027 /*-----------------------------------------------------------.
1028 | yydefault -- do the default action for the current state. |
1029 `-----------------------------------------------------------*/
1031 yyn = yydefact[yystate];
1037 /*-----------------------------.
1038 | yyreduce -- Do a reduction. |
1039 `-----------------------------*/
1041 /* yyn is the number of a rule to reduce with. */
1044 /* If YYLEN is nonzero, implement the default value of the action:
1047 Otherwise, the following line sets YYVAL to garbage.
1048 This behavior is undocumented and Bison
1049 users should not rely upon it. Assigning to YYVAL
1050 unconditionally makes the parser a bit smaller, and it avoids a
1051 GCC warning that YYVAL may be used uninitialized. */
1052 yyval = yyvsp[1-yylen];
1055 YY_REDUCE_PRINT (yyn);
1059 #line 45 "ssfilter.y"
1067 #line 51 "ssfilter.y"
1072 #line 54 "ssfilter.y"
1074 yyval = alloc_node(SSF_DCOND, yyvsp[0]);
1079 #line 58 "ssfilter.y"
1081 yyval = alloc_node(SSF_SCOND, yyvsp[0]);
1086 #line 62 "ssfilter.y"
1088 yyval = alloc_node(SSF_D_GE, yyvsp[0]);
1093 #line 66 "ssfilter.y"
1095 yyval = alloc_node(SSF_D_LE, yyvsp[0]);
1100 #line 70 "ssfilter.y"
1102 yyval = alloc_node(SSF_NOT, alloc_node(SSF_D_LE, yyvsp[0]));
1107 #line 74 "ssfilter.y"
1109 yyval = alloc_node(SSF_NOT, alloc_node(SSF_D_GE, yyvsp[0]));
1114 #line 78 "ssfilter.y"
1116 yyval = alloc_node(SSF_DCOND, yyvsp[0]);
1121 #line 82 "ssfilter.y"
1123 yyval = alloc_node(SSF_NOT, alloc_node(SSF_DCOND, yyvsp[0]));
1128 #line 87 "ssfilter.y"
1130 yyval = alloc_node(SSF_S_GE, yyvsp[0]);
1135 #line 91 "ssfilter.y"
1137 yyval = alloc_node(SSF_S_LE, yyvsp[0]);
1142 #line 95 "ssfilter.y"
1144 yyval = alloc_node(SSF_NOT, alloc_node(SSF_S_LE, yyvsp[0]));
1149 #line 99 "ssfilter.y"
1151 yyval = alloc_node(SSF_NOT, alloc_node(SSF_S_GE, yyvsp[0]));
1156 #line 103 "ssfilter.y"
1158 yyval = alloc_node(SSF_SCOND, yyvsp[0]);
1163 #line 107 "ssfilter.y"
1165 yyval = alloc_node(SSF_NOT, alloc_node(SSF_SCOND, yyvsp[0]));
1170 #line 112 "ssfilter.y"
1172 yyval = alloc_node(SSF_S_AUTO, NULL);
1177 #line 116 "ssfilter.y"
1179 yyval = alloc_node(SSF_OR, yyvsp[-2]);
1180 yyval->post = yyvsp[0];
1185 #line 121 "ssfilter.y"
1187 yyval = alloc_node(SSF_AND, yyvsp[-1]);
1188 yyval->post = yyvsp[0];
1193 #line 127 "ssfilter.y"
1195 yyval = alloc_node(SSF_AND, yyvsp[-2]);
1196 yyval->post = yyvsp[0];
1201 #line 132 "ssfilter.y"
1203 yyval = alloc_node(SSF_NOT, yyvsp[0]);
1208 #line 136 "ssfilter.y"
1217 /* Line 1000 of yacc.c. */
1218 #line 1219 "ssfilter.c"
1224 YY_STACK_PRINT (yyss, yyssp);
1229 /* Now `shift' the result of the reduction. Determine what state
1230 that goes to, based on the state we popped back to and the rule
1231 number reduced by. */
1235 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1236 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1237 yystate = yytable[yystate];
1239 yystate = yydefgoto[yyn - YYNTOKENS];
1244 /*------------------------------------.
1245 | yyerrlab -- here on detecting error |
1246 `------------------------------------*/
1248 /* If not already recovering from an error, report this error. */
1253 yyn = yypact[yystate];
1255 if (YYPACT_NINF < yyn && yyn < YYLAST)
1257 YYSIZE_T yysize = 0;
1258 int yytype = YYTRANSLATE (yychar);
1259 const char* yyprefix;
1263 /* Start YYX at -YYN if negative to avoid negative indexes in
1265 int yyxbegin = yyn < 0 ? -yyn : 0;
1267 /* Stay within bounds of both yycheck and yytname. */
1268 int yychecklim = YYLAST - yyn;
1269 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1272 yyprefix = ", expecting ";
1273 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1274 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1276 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1284 yysize += (sizeof ("syntax error, unexpected ")
1285 + yystrlen (yytname[yytype]));
1286 yymsg = (char *) YYSTACK_ALLOC (yysize);
1289 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1290 yyp = yystpcpy (yyp, yytname[yytype]);
1294 yyprefix = ", expecting ";
1295 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1296 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1298 yyp = yystpcpy (yyp, yyprefix);
1299 yyp = yystpcpy (yyp, yytname[yyx]);
1304 YYSTACK_FREE (yymsg);
1307 yyerror ("syntax error; also virtual memory exhausted");
1310 #endif /* YYERROR_VERBOSE */
1311 yyerror ("syntax error");
1316 if (yyerrstatus == 3)
1318 /* If just tried and failed to reuse lookahead token after an
1319 error, discard it. */
1321 if (yychar <= YYEOF)
1323 /* If at end of input, pop the error token,
1324 then the rest of the stack, then return failure. */
1325 if (yychar == YYEOF)
1331 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1332 yydestruct (yystos[*yyssp], yyvsp);
1337 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1338 yydestruct (yytoken, &yylval);
1344 /* Else will try to reuse lookahead token after shifting the error
1349 /*---------------------------------------------------.
1350 | yyerrorlab -- error raised explicitly by YYERROR. |
1351 `---------------------------------------------------*/
1355 /* Pacify GCC when the user code never invokes YYERROR and the label
1356 yyerrorlab therefore never appears in user code. */
1367 /*-------------------------------------------------------------.
1368 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1369 `-------------------------------------------------------------*/
1371 yyerrstatus = 3; /* Each real token shifted decrements this. */
1375 yyn = yypact[yystate];
1376 if (yyn != YYPACT_NINF)
1379 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1387 /* Pop the current state because it cannot handle the error token. */
1391 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1392 yydestruct (yystos[yystate], yyvsp);
1395 YY_STACK_PRINT (yyss, yyssp);
1401 YYDPRINTF ((stderr, "Shifting error token, "));
1410 /*-------------------------------------.
1411 | yyacceptlab -- YYACCEPT comes here. |
1412 `-------------------------------------*/
1417 /*-----------------------------------.
1418 | yyabortlab -- YYABORT comes here. |
1419 `-----------------------------------*/
1425 /*----------------------------------------------.
1426 | yyoverflowlab -- parser overflow comes here. |
1427 `----------------------------------------------*/
1429 yyerror ("parser stack overflow");
1437 YYSTACK_FREE (yyss);
1443 #line 140 "ssfilter.y"
1446 static char *get_token_from_line(char **ptr)
1448 char *tok, *cp = *ptr;
1450 while (*cp == ' ' || *cp == '\t') cp++;
1459 while (*cp != 0 && *cp != ' ' && *cp != '\t') {
1460 /* Backslash escapes everything. */
1463 for (tp = cp; tp != tok; tp--)
1480 static char argbuf[1024];
1481 static char *tokptr = argbuf;
1486 while (*tokptr == 0) {
1488 if (argc < yy_argc) {
1489 tokptr = yy_argv[argc];
1492 while (tokptr == NULL) {
1493 if (fgets(argbuf, sizeof(argbuf)-1, yy_fp) == NULL)
1495 argbuf[sizeof(argbuf)-1] = 0;
1496 if (strlen(argbuf) == sizeof(argbuf) - 1) {
1497 fprintf(stderr, "Too long line in filter");
1500 if (argbuf[strlen(argbuf)-1] == '\n')
1501 argbuf[strlen(argbuf)-1] = 0;
1502 if (argbuf[0] == '#' || argbuf[0] == '0')
1510 } while ((curtok = get_token_from_line(&tokptr)) == NULL);
1512 if (strcmp(curtok, "!") == 0 ||
1513 strcmp(curtok, "not") == 0)
1515 if (strcmp(curtok, "&") == 0 ||
1516 strcmp(curtok, "&&") == 0 ||
1517 strcmp(curtok, "and") == 0)
1519 if (strcmp(curtok, "|") == 0 ||
1520 strcmp(curtok, "||") == 0 ||
1521 strcmp(curtok, "or") == 0)
1523 if (strcmp(curtok, "(") == 0)
1525 if (strcmp(curtok, ")") == 0)
1527 if (strcmp(curtok, "dst") == 0)
1529 if (strcmp(curtok, "src") == 0)
1531 if (strcmp(curtok, "dport") == 0)
1533 if (strcmp(curtok, "sport") == 0)
1535 if (strcmp(curtok, ">=") == 0 ||
1536 strcmp(curtok, "ge") == 0 ||
1537 strcmp(curtok, "geq") == 0)
1539 if (strcmp(curtok, "<=") == 0 ||
1540 strcmp(curtok, "le") == 0 ||
1541 strcmp(curtok, "leq") == 0)
1543 if (strcmp(curtok, "!=") == 0 ||
1544 strcmp(curtok, "ne") == 0 ||
1545 strcmp(curtok, "neq") == 0)
1547 if (strcmp(curtok, "=") == 0 ||
1548 strcmp(curtok, "==") == 0 ||
1549 strcmp(curtok, "eq") == 0)
1551 if (strcmp(curtok, ">") == 0 ||
1552 strcmp(curtok, "gt") == 0)
1554 if (strcmp(curtok, "<") == 0 ||
1555 strcmp(curtok, "lt") == 0)
1557 if (strcmp(curtok, "autobound") == 0)
1559 yylval = (void*)parse_hostcond(curtok);
1560 if (yylval == NULL) {
1561 fprintf(stderr, "Cannot parse dst/src address.\n");
1567 int ssfilter_parse(struct ssfilter **f, int argc, char **argv, FILE *fp)
1575 fprintf(stderr, " Sorry.\n");