diff options
author | Michael Biebl <biebl@debian.org> | 2013-07-23 01:01:14 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2013-07-23 01:01:14 +0200 |
commit | a400789c367fd3cd8d0f9588ca2af72dcac47c9c (patch) | |
tree | 8c1caa6308f9e720e1e461da321107e6dc29f256 /grammar | |
parent | f5638ea86a8626b7e0e471d720359cb4e3d8cb1c (diff) | |
download | rsyslog-a400789c367fd3cd8d0f9588ca2af72dcac47c9c.tar.gz |
Imported Upstream version 7.4.3upstream/7.4.3
Diffstat (limited to 'grammar')
-rw-r--r-- | grammar/Makefile.in | 120 | ||||
-rw-r--r-- | grammar/grammar.c | 399 | ||||
-rw-r--r-- | grammar/grammar.h | 36 | ||||
-rw-r--r-- | grammar/lexer.c | 269 | ||||
-rw-r--r-- | grammar/lexer.l | 2 | ||||
-rw-r--r-- | grammar/rainerscript.c | 109 | ||||
-rw-r--r-- | grammar/rainerscript.h | 2 |
7 files changed, 480 insertions, 457 deletions
diff --git a/grammar/Makefile.in b/grammar/Makefile.in index 2643634..73648f1 100644 --- a/grammar/Makefile.in +++ b/grammar/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.12.2 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,23 +16,6 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -51,9 +35,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = grammar -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/depcomp $(top_srcdir)/ylwrap grammar.c grammar.h \ - lexer.c +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in grammar.c \ + grammar.h lexer.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \ $(top_srcdir)/m4/atomic_operations_64bit.m4 \ @@ -74,19 +57,6 @@ libgrammar_la_OBJECTS = $(am_libgrammar_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am__v_lt_1 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -99,40 +69,35 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = +am__v_CCLD_0 = @echo " CCLD " $@; LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) LTLEXCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) -am__v_LEX_0 = @echo " LEX " $@; -am__v_LEX_1 = +am__v_LEX_0 = @echo " LEX " $@; YLWRAP = $(top_srcdir)/ylwrap -am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ - -e s/c++$$/h++/ -e s/c$$/h/ YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS) AM_V_YACC = $(am__v_YACC_@AM_V@) am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) -am__v_YACC_0 = @echo " YACC " $@; -am__v_YACC_1 = +am__v_YACC_0 = @echo " YACC " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libgrammar_la_SOURCES) DIST_SOURCES = $(libgrammar_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -375,14 +340,12 @@ $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done grammar.h: grammar.c @if test ! -f $@; then rm -f grammar.c; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) grammar.c; else :; fi @@ -445,7 +408,7 @@ libgrammar_la-rainerscript.lo: rainerscript.c $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: - $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) + $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) mostlyclean-libtool: -rm -f *.lo @@ -502,20 +465,6 @@ GTAGS: && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -664,18 +613,17 @@ uninstall-am: .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am #testdriver_SOURCES = testdriver.c libgrammar.la diff --git a/grammar/grammar.c b/grammar/grammar.c index 57caa63..4a70e3d 100644 --- a/grammar/grammar.c +++ b/grammar/grammar.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.6.1. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.6.1" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,11 +58,14 @@ /* Pull parsers. */ #define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ -/* Line 336 of yacc.c */ + +/* Line 268 of yacc.c */ #line 31 "grammar.y" #include <stdio.h> @@ -76,16 +79,14 @@ extern int yylineno; extern int yylex(void); extern int yyerror(char*); -/* Line 336 of yacc.c */ -#line 81 "grammar.c" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif +/* Line 268 of yacc.c */ +#line 85 "grammar.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -95,18 +96,12 @@ extern int yyerror(char*); # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "y.tab.h". */ -#ifndef YY_Y_TAB_H -# define YY_Y_TAB_H -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -199,10 +194,12 @@ extern int yydebug; + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 350 of yacc.c */ + +/* Line 293 of yacc.c */ #line 44 "grammar.y" char *s; @@ -219,36 +216,21 @@ typedef union YYSTYPE struct cnffparamlst *fparams; -/* Line 350 of yacc.c */ -#line 224 "grammar.c" + +/* Line 293 of yacc.c */ +#line 222 "grammar.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -extern YYSTYPE yylval; - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_Y_TAB_H */ /* Copy the second part of user declarations. */ -/* Line 353 of yacc.c */ -#line 252 "grammar.c" + +/* Line 343 of yacc.c */ +#line 234 "grammar.c" #ifdef short # undef short @@ -354,7 +336,6 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -446,20 +427,20 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do +/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -580,7 +561,7 @@ static const yytype_uint8 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -596,7 +577,7 @@ static const char *const yytname[] = "'%'", "UMINUS", "'{'", "'}'", "'='", "';'", "'('", "')'", "','", "'['", "']'", "$accept", "conf", "obj", "propconst", "property", "constant", "nvlst", "nv", "value", "script", "stmt", "block", "actlst", "s_act", - "expr", "fparams", "array", "arrayelt", YY_NULL + "expr", "fparams", "array", "arrayelt", 0 }; #endif @@ -823,18 +804,17 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ @@ -844,33 +824,32 @@ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 + /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) #endif -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - - /* This macro is provided for backward compatibility. */ @@ -930,8 +909,6 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) YYSTYPE const * const yyvaluep; #endif { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT @@ -1183,12 +1160,12 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1248,7 +1225,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + yysize1 = yysize + yytnamerr (0, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1340,6 +1317,20 @@ yydestruct (yymsg, yytype, yyvaluep) } +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ @@ -1386,7 +1377,7 @@ yyparse () `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks through separate pointers, to allow yyoverflow + Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1440,6 +1431,7 @@ yyparse () The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; + goto yysetstate; /*------------------------------------------------------------. @@ -1617,49 +1609,57 @@ yyreduce: switch (yyn) { case 3: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 123 "grammar.y" { cnfDoObj((yyvsp[(2) - (2)].obj)); } break; case 4: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 124 "grammar.y" { cnfDoScript((yyvsp[(2) - (2)].stmt)); } break; case 5: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 125 "grammar.y" { cnfDoCfsysline((yyvsp[(2) - (2)].s)); } break; case 6: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 126 "grammar.y" { cnfDoBSDTag((yyvsp[(2) - (2)].s)); } break; case 7: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 127 "grammar.y" { cnfDoBSDHost((yyvsp[(2) - (2)].s)); } break; case 8: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 128 "grammar.y" { (yyval.obj) = cnfobjNew((yyvsp[(1) - (3)].objType), (yyvsp[(2) - (3)].nvlst)); } break; case 9: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 129 "grammar.y" { (yyval.obj) = cnfobjNew(CNFOBJ_TPL, (yyvsp[(2) - (3)].nvlst)); } break; case 10: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 131 "grammar.y" { (yyval.obj) = cnfobjNew(CNFOBJ_TPL, (yyvsp[(2) - (6)].nvlst)); (yyval.obj)->subobjs = (yyvsp[(5) - (6)].objlst); @@ -1667,7 +1667,8 @@ yyreduce: break; case 11: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 135 "grammar.y" { (yyval.obj) = cnfobjNew(CNFOBJ_RULESET, (yyvsp[(2) - (6)].nvlst)); (yyval.obj)->script = (yyvsp[(5) - (6)].stmt); @@ -1675,85 +1676,99 @@ yyreduce: break; case 12: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 138 "grammar.y" { (yyval.objlst) = NULL; } break; case 13: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 139 "grammar.y" { (yyval.objlst) = objlstAdd((yyvsp[(1) - (2)].objlst), (yyvsp[(2) - (2)].obj)); } break; case 14: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 140 "grammar.y" { (yyval.objlst) = objlstAdd((yyvsp[(1) - (2)].objlst), (yyvsp[(2) - (2)].obj)); } break; case 15: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 141 "grammar.y" { (yyval.obj) = cnfobjNew(CNFOBJ_PROPERTY, (yyvsp[(2) - (3)].nvlst)); } break; case 16: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 142 "grammar.y" { (yyval.obj) = cnfobjNew(CNFOBJ_CONSTANT, (yyvsp[(2) - (3)].nvlst)); } break; case 17: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 143 "grammar.y" { (yyval.nvlst) = NULL; } break; case 18: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 144 "grammar.y" { (yyvsp[(2) - (2)].nvlst)->next = (yyvsp[(1) - (2)].nvlst); (yyval.nvlst) = (yyvsp[(2) - (2)].nvlst); } break; case 19: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 145 "grammar.y" { (yyval.nvlst) = nvlstSetName((yyvsp[(3) - (3)].nvlst), (yyvsp[(1) - (3)].estr)); } break; case 20: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 146 "grammar.y" { (yyval.nvlst) = nvlstNewStr((yyvsp[(1) - (1)].estr)); } break; case 21: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 147 "grammar.y" { (yyval.nvlst) = nvlstNewArray((yyvsp[(1) - (1)].arr)); } break; case 22: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 148 "grammar.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } break; case 23: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 149 "grammar.y" { (yyval.stmt) = scriptAddStmt((yyvsp[(1) - (2)].stmt), (yyvsp[(2) - (2)].stmt)); } break; case 24: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 150 "grammar.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } break; case 25: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 151 "grammar.y" { (yyval.stmt) = cnfstmtNew(S_IF); (yyval.stmt)->d.s_if.expr = (yyvsp[(2) - (4)].expr); @@ -1762,7 +1777,8 @@ yyreduce: break; case 26: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 155 "grammar.y" { (yyval.stmt) = cnfstmtNew(S_IF); (yyval.stmt)->d.s_if.expr = (yyvsp[(2) - (6)].expr); @@ -1771,278 +1787,324 @@ yyreduce: break; case 27: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 159 "grammar.y" { (yyval.stmt) = cnfstmtNewSet((yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].expr)); } break; case 28: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 160 "grammar.y" { (yyval.stmt) = cnfstmtNewUnset((yyvsp[(2) - (3)].s)); } break; case 29: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 161 "grammar.y" { (yyval.stmt) = cnfstmtNewPRIFILT((yyvsp[(1) - (2)].s), (yyvsp[(2) - (2)].stmt)); } break; case 30: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 162 "grammar.y" { (yyval.stmt) = cnfstmtNewPROPFILT((yyvsp[(1) - (2)].s), (yyvsp[(2) - (2)].stmt)); } break; case 31: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 163 "grammar.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } break; case 32: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 164 "grammar.y" { (yyval.stmt) = (yyvsp[(2) - (3)].stmt); } break; case 33: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 165 "grammar.y" { (yyval.stmt) = (yyvsp[(1) - (1)].stmt); } break; case 34: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 166 "grammar.y" { (yyval.stmt) = scriptAddStmt((yyvsp[(1) - (3)].stmt), (yyvsp[(3) - (3)].stmt)); } break; case 35: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 168 "grammar.y" { (yyval.stmt) = cnfstmtNewAct((yyvsp[(2) - (3)].nvlst)); } break; case 36: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 169 "grammar.y" { (yyval.stmt) = cnfstmtNewLegaAct((yyvsp[(1) - (1)].s)); } break; case 37: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 170 "grammar.y" { (yyval.stmt) = cnfstmtNew(S_STOP); } break; case 38: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 171 "grammar.y" { (yyval.stmt) = cnfstmtNewCall((yyvsp[(2) - (2)].estr)); } break; case 39: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 172 "grammar.y" { (yyval.stmt) = cnfstmtNewContinue(); } break; case 40: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 173 "grammar.y" { (yyval.expr) = cnfexprNew(AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 41: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 174 "grammar.y" { (yyval.expr) = cnfexprNew(OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 42: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 175 "grammar.y" { (yyval.expr) = cnfexprNew(NOT, NULL, (yyvsp[(2) - (2)].expr)); } break; case 43: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 176 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_EQ, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 44: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 177 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_NE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 45: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 178 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_LE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 46: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 179 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_GE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 47: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 180 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_LT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 48: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 181 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_GT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 49: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 182 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_CONTAINS, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 50: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 183 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_CONTAINSI, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 51: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 184 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_STARTSWITH, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 52: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 185 "grammar.y" { (yyval.expr) = cnfexprNew(CMP_STARTSWITHI, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 53: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 186 "grammar.y" { (yyval.expr) = cnfexprNew('&', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 54: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 187 "grammar.y" { (yyval.expr) = cnfexprNew('+', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 55: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 188 "grammar.y" { (yyval.expr) = cnfexprNew('-', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 56: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 189 "grammar.y" { (yyval.expr) = cnfexprNew('*', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 57: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 190 "grammar.y" { (yyval.expr) = cnfexprNew('/', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 58: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 191 "grammar.y" { (yyval.expr) = cnfexprNew('%', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } break; case 59: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 192 "grammar.y" { (yyval.expr) = (yyvsp[(2) - (3)].expr); } break; case 60: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 193 "grammar.y" { (yyval.expr) = cnfexprNew('M', NULL, (yyvsp[(2) - (2)].expr)); } break; case 61: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 194 "grammar.y" { (yyval.expr) = (struct cnfexpr*) cnffuncNew((yyvsp[(1) - (3)].estr), NULL); } break; case 62: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 195 "grammar.y" { (yyval.expr) = (struct cnfexpr*) cnffuncNew((yyvsp[(1) - (4)].estr), (yyvsp[(3) - (4)].fparams)); } break; case 63: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 196 "grammar.y" { (yyval.expr) = (struct cnfexpr*) cnfnumvalNew((yyvsp[(1) - (1)].n)); } break; case 64: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 197 "grammar.y" { (yyval.expr) = (struct cnfexpr*) cnfstringvalNew((yyvsp[(1) - (1)].estr)); } break; case 65: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 198 "grammar.y" { (yyval.expr) = (struct cnfexpr*) cnfvarNew((yyvsp[(1) - (1)].s)); } break; case 66: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 199 "grammar.y" { (yyval.expr) = (struct cnfexpr*) (yyvsp[(1) - (1)].arr); } break; case 67: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 200 "grammar.y" { (yyval.fparams) = cnffparamlstNew((yyvsp[(1) - (1)].expr), NULL); } break; case 68: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 201 "grammar.y" { (yyval.fparams) = cnffparamlstNew((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].fparams)); } break; case 69: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 202 "grammar.y" { (yyval.arr) = (yyvsp[(2) - (3)].arr); } break; case 70: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 203 "grammar.y" { (yyval.arr) = cnfarrayNew((yyvsp[(1) - (1)].estr)); } break; case 71: -/* Line 1787 of yacc.c */ + +/* Line 1806 of yacc.c */ #line 204 "grammar.y" { (yyval.arr) = cnfarrayAdd((yyvsp[(1) - (3)].arr), (yyvsp[(3) - (3)].estr)); } break; -/* Line 1787 of yacc.c */ -#line 2046 "grammar.c" + +/* Line 1806 of yacc.c */ +#line 2108 "grammar.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2229,7 +2291,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2271,7 +2333,8 @@ yyreturn: } -/* Line 2048 of yacc.c */ + +/* Line 2067 of yacc.c */ #line 206 "grammar.y" /* diff --git a/grammar/grammar.h b/grammar/grammar.h index 7c399e9..cad1d92 100644 --- a/grammar/grammar.h +++ b/grammar/grammar.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.6.1. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,15 +30,6 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_GRAMMAR_H -# define YY_GRAMMAR_H -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -132,10 +123,12 @@ extern int yydebug; + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 2049 of yacc.c */ + +/* Line 2068 of yacc.c */ #line 44 "grammar.y" char *s; @@ -152,8 +145,9 @@ typedef union YYSTYPE struct cnffparamlst *fparams; -/* Line 2049 of yacc.c */ -#line 157 "grammar.h" + +/* Line 2068 of yacc.c */ +#line 151 "grammar.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -162,18 +156,4 @@ typedef union YYSTYPE extern YYSTYPE yylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ -#endif /* !YY_GRAMMAR_H */ diff --git a/grammar/lexer.c b/grammar/lexer.c index 42967bf..9b7cf47 100644 --- a/grammar/lexer.c +++ b/grammar/lexer.c @@ -8,7 +8,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 36 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -141,7 +141,15 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -153,12 +161,7 @@ typedef unsigned int flex_uint32_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; +extern int yyleng; extern FILE *yyin, *yyout; @@ -197,6 +200,11 @@ extern FILE *yyin, *yyout; #define unput(c) yyunput( c, (yytext_ptr) ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -214,7 +222,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -284,8 +292,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; @@ -313,7 +321,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); @@ -345,7 +353,7 @@ void yyfree (void * ); /* Begin user sect3 */ -#define yywrap() 1 +#define yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -1439,9 +1447,11 @@ extern int yydebug; /* somehow, I need these prototype even though the headers are * included. I guess that's some autotools magic I don't understand... */ +#if !defined(__FreeBSD__) int fileno(FILE *stream); +#endif -#line 1445 "lexer.c" +#line 1455 "lexer.c" #define INITIAL 0 #define INOBJ 1 @@ -1486,7 +1496,7 @@ FILE *yyget_out (void ); void yyset_out (FILE * out_str ); -yy_size_t yyget_leng (void ); +int yyget_leng (void ); char *yyget_text (void ); @@ -1526,7 +1536,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1630,11 +1645,11 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 95 "lexer.l" +#line 97 "lexer.l" /* keywords */ -#line 1638 "lexer.c" +#line 1653 "lexer.c" if ( !(yy_init) ) { @@ -1730,131 +1745,131 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 98 "lexer.l" +#line 100 "lexer.l" { BEGIN EXPR; return IF; } YY_BREAK case 2: YY_RULE_SETUP -#line 99 "lexer.l" +#line 101 "lexer.l" { BEGIN INITIAL; return THEN; } YY_BREAK case 3: YY_RULE_SETUP -#line 100 "lexer.l" +#line 102 "lexer.l" { BEGIN INITIAL; return ';'; } YY_BREAK case 4: YY_RULE_SETUP -#line 101 "lexer.l" +#line 103 "lexer.l" { return OR; } YY_BREAK case 5: YY_RULE_SETUP -#line 102 "lexer.l" +#line 104 "lexer.l" { return AND; } YY_BREAK case 6: YY_RULE_SETUP -#line 103 "lexer.l" +#line 105 "lexer.l" { return NOT; } YY_BREAK case 7: -#line 105 "lexer.l" +#line 107 "lexer.l" case 8: -#line 106 "lexer.l" +#line 108 "lexer.l" case 9: -#line 107 "lexer.l" +#line 109 "lexer.l" case 10: -#line 108 "lexer.l" +#line 110 "lexer.l" case 11: -#line 109 "lexer.l" +#line 111 "lexer.l" case 12: -#line 110 "lexer.l" +#line 112 "lexer.l" case 13: -#line 111 "lexer.l" +#line 113 "lexer.l" case 14: -#line 112 "lexer.l" +#line 114 "lexer.l" case 15: -#line 113 "lexer.l" +#line 115 "lexer.l" case 16: -#line 114 "lexer.l" +#line 116 "lexer.l" case 17: -#line 115 "lexer.l" +#line 117 "lexer.l" case 18: YY_RULE_SETUP -#line 115 "lexer.l" +#line 117 "lexer.l" { return yytext[0]; } YY_BREAK case 19: YY_RULE_SETUP -#line 116 "lexer.l" +#line 118 "lexer.l" { return CMP_EQ; } YY_BREAK case 20: YY_RULE_SETUP -#line 117 "lexer.l" +#line 119 "lexer.l" { return CMP_LE; } YY_BREAK case 21: YY_RULE_SETUP -#line 118 "lexer.l" +#line 120 "lexer.l" { return CMP_GE; } YY_BREAK case 22: -#line 120 "lexer.l" +#line 122 "lexer.l" case 23: YY_RULE_SETUP -#line 120 "lexer.l" +#line 122 "lexer.l" { return CMP_NE; } YY_BREAK case 24: YY_RULE_SETUP -#line 121 "lexer.l" +#line 123 "lexer.l" { return CMP_LT; } YY_BREAK case 25: YY_RULE_SETUP -#line 122 "lexer.l" +#line 124 "lexer.l" { return CMP_GT; } YY_BREAK case 26: YY_RULE_SETUP -#line 123 "lexer.l" +#line 125 "lexer.l" { return CMP_CONTAINS; } YY_BREAK case 27: YY_RULE_SETUP -#line 124 "lexer.l" +#line 126 "lexer.l" { return CMP_CONTAINSI; } YY_BREAK case 28: YY_RULE_SETUP -#line 125 "lexer.l" +#line 127 "lexer.l" { return CMP_STARTSWITH; } YY_BREAK case 29: YY_RULE_SETUP -#line 126 "lexer.l" +#line 128 "lexer.l" { return CMP_STARTSWITHI; } YY_BREAK case 30: -#line 128 "lexer.l" +#line 130 "lexer.l" case 31: -#line 129 "lexer.l" +#line 131 "lexer.l" case 32: YY_RULE_SETUP -#line 129 "lexer.l" +#line 131 "lexer.l" { yylval.n = strtoll(yytext, NULL, 0); return NUMBER; } YY_BREAK case 33: YY_RULE_SETUP -#line 130 "lexer.l" +#line 132 "lexer.l" { yylval.s = strdup(yytext); return VAR; } YY_BREAK case 34: /* rule 34 can match eol */ YY_RULE_SETUP -#line 131 "lexer.l" +#line 133 "lexer.l" { yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -1864,7 +1879,7 @@ YY_RULE_SETUP case 35: /* rule 35 can match eol */ YY_RULE_SETUP -#line 136 "lexer.l" +#line 138 "lexer.l" { yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -1874,18 +1889,18 @@ YY_RULE_SETUP case 36: /* rule 36 can match eol */ YY_RULE_SETUP -#line 141 "lexer.l" +#line 143 "lexer.l" YY_BREAK case 37: YY_RULE_SETUP -#line 142 "lexer.l" +#line 144 "lexer.l" { yylval.estr = es_newStrFromCStr(yytext, yyleng); return FUNC; } YY_BREAK case 38: YY_RULE_SETUP -#line 144 "lexer.l" +#line 146 "lexer.l" { parser_errmsg("invalid character '%s' in expression " "- is there an invalid escape sequence somewhere?", yytext); } @@ -1893,66 +1908,66 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 147 "lexer.l" +#line 149 "lexer.l" YY_BREAK case 40: YY_RULE_SETUP -#line 148 "lexer.l" +#line 150 "lexer.l" { parser_errmsg("invalid character '%s' in 'call' statement" "- is there an invalid escape sequence somewhere?", yytext); } YY_BREAK case 41: YY_RULE_SETUP -#line 151 "lexer.l" +#line 153 "lexer.l" { yylval.estr = es_newStrFromCStr(yytext, yyleng); BEGIN INITIAL; return NAME; } YY_BREAK case 42: YY_RULE_SETUP -#line 154 "lexer.l" +#line 156 "lexer.l" { return '&'; } YY_BREAK case 43: YY_RULE_SETUP -#line 155 "lexer.l" +#line 157 "lexer.l" { return '{'; } YY_BREAK case 44: YY_RULE_SETUP -#line 156 "lexer.l" +#line 158 "lexer.l" { return '}'; } YY_BREAK case 45: YY_RULE_SETUP -#line 157 "lexer.l" +#line 159 "lexer.l" { return STOP; } YY_BREAK case 46: YY_RULE_SETUP -#line 158 "lexer.l" +#line 160 "lexer.l" { return ELSE; } YY_BREAK case 47: YY_RULE_SETUP -#line 159 "lexer.l" +#line 161 "lexer.l" { BEGIN INCALL; return CALL; } YY_BREAK case 48: YY_RULE_SETUP -#line 160 "lexer.l" +#line 162 "lexer.l" { BEGIN EXPR; return SET; } YY_BREAK case 49: YY_RULE_SETUP -#line 161 "lexer.l" +#line 163 "lexer.l" { BEGIN EXPR; return UNSET; } YY_BREAK case 50: YY_RULE_SETUP -#line 162 "lexer.l" +#line 164 "lexer.l" { return CONTINUE; } YY_BREAK /* line number support because the "preprocessor" combines lines and so needs @@ -1960,23 +1975,23 @@ YY_RULE_SETUP */ case 51: YY_RULE_SETUP -#line 166 "lexer.l" +#line 168 "lexer.l" { BEGIN LINENO; } YY_BREAK case 52: YY_RULE_SETUP -#line 167 "lexer.l" +#line 169 "lexer.l" { yylineno = atoi(yytext) - 1; } YY_BREAK case 53: YY_RULE_SETUP -#line 168 "lexer.l" +#line 170 "lexer.l" { BEGIN INITIAL; } YY_BREAK case 54: /* rule 54 can match eol */ YY_RULE_SETUP -#line 169 "lexer.l" +#line 171 "lexer.l" YY_BREAK /* $IncludeConfig must be detected as part of CFSYSLINE, because this is @@ -1985,12 +2000,12 @@ YY_RULE_SETUP case 55: /* rule 55 can match eol */ YY_RULE_SETUP -#line 173 "lexer.l" +#line 175 "lexer.l" YY_BREAK case 56: YY_RULE_SETUP -#line 174 "lexer.l" +#line 176 "lexer.l" { if(cnfDoInclude(yytext) != 0) yyterminate(); BEGIN INITIAL; } @@ -1998,62 +2013,62 @@ YY_RULE_SETUP case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 177 "lexer.l" +#line 179 "lexer.l" { yylval.objType = CNFOBJ_GLOBAL; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 58: /* rule 58 can match eol */ YY_RULE_SETUP -#line 179 "lexer.l" +#line 181 "lexer.l" { yylval.objType = CNFOBJ_TPL; BEGIN INOBJ; return BEGIN_TPL; } YY_BREAK case 59: /* rule 59 can match eol */ YY_RULE_SETUP -#line 181 "lexer.l" +#line 183 "lexer.l" { yylval.objType = CNFOBJ_RULESET; BEGIN INOBJ; return BEGIN_RULESET; } YY_BREAK case 60: /* rule 60 can match eol */ YY_RULE_SETUP -#line 183 "lexer.l" +#line 185 "lexer.l" { yylval.objType = CNFOBJ_PROPERTY; BEGIN INOBJ; return BEGIN_PROPERTY; } YY_BREAK case 61: /* rule 61 can match eol */ YY_RULE_SETUP -#line 185 "lexer.l" +#line 187 "lexer.l" { yylval.objType = CNFOBJ_CONSTANT; BEGIN INOBJ; return BEGIN_CONSTANT; } YY_BREAK case 62: /* rule 62 can match eol */ YY_RULE_SETUP -#line 187 "lexer.l" +#line 189 "lexer.l" { yylval.objType = CNFOBJ_INPUT; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 63: /* rule 63 can match eol */ YY_RULE_SETUP -#line 189 "lexer.l" +#line 191 "lexer.l" { yylval.objType = CNFOBJ_MODULE; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 191 "lexer.l" +#line 193 "lexer.l" { BEGIN INOBJ; return BEGIN_ACTION; } YY_BREAK case 65: /* rule 65 can match eol */ YY_RULE_SETUP -#line 192 "lexer.l" +#line 194 "lexer.l" { yylval.s = strdup(rmLeadingSpace(yytext)); dbgprintf("lexer: propfilt is '%s'\n", yylval.s); @@ -2062,57 +2077,57 @@ YY_RULE_SETUP YY_BREAK case 66: YY_RULE_SETUP -#line 197 "lexer.l" +#line 199 "lexer.l" { yylval.s = strdup(rmLeadingSpace(yytext)); return PRIFILT; } YY_BREAK case 67: -#line 199 "lexer.l" +#line 201 "lexer.l" case 68: -#line 200 "lexer.l" +#line 202 "lexer.l" case 69: /* rule 69 can match eol */ -#line 201 "lexer.l" +#line 203 "lexer.l" case 70: /* rule 70 can match eol */ -#line 202 "lexer.l" +#line 204 "lexer.l" case 71: /* rule 71 can match eol */ -#line 203 "lexer.l" +#line 205 "lexer.l" case 72: /* rule 72 can match eol */ -#line 204 "lexer.l" +#line 206 "lexer.l" case 73: /* rule 73 can match eol */ YY_RULE_SETUP -#line 204 "lexer.l" +#line 206 "lexer.l" { yylval.s = yytext; return LEGACY_ACTION; } YY_BREAK case 74: YY_RULE_SETUP -#line 205 "lexer.l" +#line 207 "lexer.l" { BEGIN INITIAL; return ENDOBJ; } YY_BREAK case 75: YY_RULE_SETUP -#line 206 "lexer.l" +#line 208 "lexer.l" { yylval.estr = es_newStrFromCStr(yytext, yyleng); return NAME; } YY_BREAK case 76: -#line 209 "lexer.l" +#line 211 "lexer.l" case 77: -#line 210 "lexer.l" +#line 212 "lexer.l" case 78: -#line 211 "lexer.l" +#line 213 "lexer.l" case 79: YY_RULE_SETUP -#line 211 "lexer.l" +#line 213 "lexer.l" { return(yytext[0]); } YY_BREAK case 80: /* rule 80 can match eol */ YY_RULE_SETUP -#line 212 "lexer.l" +#line 214 "lexer.l" { yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2123,28 +2138,28 @@ YY_RULE_SETUP return VALUE; }*/ case 81: YY_RULE_SETUP -#line 219 "lexer.l" +#line 221 "lexer.l" { preCommentState = YY_START; BEGIN COMMENT; } YY_BREAK case 82: YY_RULE_SETUP -#line 220 "lexer.l" +#line 222 "lexer.l" { preCommentState = YY_START; BEGIN COMMENT; } YY_BREAK case 83: YY_RULE_SETUP -#line 221 "lexer.l" +#line 223 "lexer.l" { preCommentState = YY_START; BEGIN COMMENT; } YY_BREAK case 84: YY_RULE_SETUP -#line 222 "lexer.l" +#line 224 "lexer.l" { BEGIN preCommentState; } YY_BREAK case 85: /* rule 85 can match eol */ YY_RULE_SETUP -#line 223 "lexer.l" +#line 225 "lexer.l" YY_BREAK case 86: @@ -2152,18 +2167,18 @@ case 86: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 224 "lexer.l" +#line 226 "lexer.l" /* skip comments in input */ YY_BREAK case 87: /* rule 87 can match eol */ YY_RULE_SETUP -#line 225 "lexer.l" +#line 227 "lexer.l" YY_BREAK case 88: YY_RULE_SETUP -#line 226 "lexer.l" +#line 228 "lexer.l" { parser_errmsg("invalid character '%s' in object definition " "- is there an invalid escape sequence somewhere?", yytext); } @@ -2173,7 +2188,7 @@ case 89: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 229 "lexer.l" +#line 231 "lexer.l" { /* see comment on $IncludeConfig above */ if(!strncasecmp(yytext, "$includeconfig ", 14)) { yyless(14); @@ -2191,7 +2206,7 @@ case 90: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 240 "lexer.l" +#line 242 "lexer.l" { yylval.s = strdup(yytext); return BSD_TAG_SELECTOR; } YY_BREAK case 91: @@ -2200,7 +2215,7 @@ case 91: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 241 "lexer.l" +#line 243 "lexer.l" { yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; } YY_BREAK case 92: @@ -2209,7 +2224,7 @@ case 92: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 242 "lexer.l" +#line 244 "lexer.l" { yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; } YY_BREAK case 93: @@ -2217,24 +2232,24 @@ case 93: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 243 "lexer.l" +#line 245 "lexer.l" { yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; } YY_BREAK case 94: /* rule 94 can match eol */ YY_RULE_SETUP -#line 244 "lexer.l" +#line 246 "lexer.l" /* skip comments in input */ YY_BREAK case 95: /* rule 95 can match eol */ YY_RULE_SETUP -#line 245 "lexer.l" +#line 247 "lexer.l" /* drop whitespace */ YY_BREAK case 96: YY_RULE_SETUP -#line 246 "lexer.l" +#line 248 "lexer.l" { parser_errmsg("invalid character '%s' " "- is there an invalid escape sequence somewhere?", yytext); } @@ -2246,15 +2261,15 @@ case YY_STATE_EOF(INCL): case YY_STATE_EOF(LINENO): case YY_STATE_EOF(INCALL): case YY_STATE_EOF(EXPR): -#line 249 "lexer.l" +#line 251 "lexer.l" { if(popfile() != 0) yyterminate(); } YY_BREAK case 97: YY_RULE_SETUP -#line 251 "lexer.l" +#line 253 "lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2258 "lexer.c" +#line 2273 "lexer.c" case YY_END_OF_BUFFER: { @@ -2438,21 +2453,21 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2483,7 +2498,7 @@ static int yy_get_next_buffer (void) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); + (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -2579,7 +2594,7 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 442); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT @@ -2606,7 +2621,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2772,6 +2787,10 @@ static void yy_load_buffer_state (void) yyfree((void *) b ); } +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -2884,7 +2903,7 @@ void yypop_buffer_state (void) */ static void yyensure_buffer_stack (void) { - yy_size_t num_to_alloc; + int num_to_alloc; if (!(yy_buffer_stack)) { @@ -2981,7 +3000,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; @@ -3068,7 +3087,7 @@ FILE *yyget_out (void) /** Get the length of the current token. * */ -yy_size_t yyget_leng (void) +int yyget_leng (void) { return yyleng; } @@ -3219,7 +3238,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 251 "lexer.l" +#line 253 "lexer.l" int diff --git a/grammar/lexer.l b/grammar/lexer.l index 237eb2a..ed5d8a8 100644 --- a/grammar/lexer.l +++ b/grammar/lexer.l @@ -88,7 +88,9 @@ extern int yydebug; /* somehow, I need these prototype even though the headers are * included. I guess that's some autotools magic I don't understand... */ +#if !defined(__FreeBSD__) int fileno(FILE *stream); +#endif %} diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index 95972fb..0f0b469 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -2278,7 +2278,8 @@ cnfstmtPrintOnly(struct cnfstmt *stmt, int indent, sbool subtree) free(cstr); break; case S_ACT: - doIndent(indent); dbgprintf("ACTION %p [%s]\n", stmt->d.act, stmt->printable); + doIndent(indent); dbgprintf("ACTION %p [%s:%s]\n", stmt->d.act, + modGetName(stmt->d.act->pMod), stmt->printable); break; case S_IF: doIndent(indent); dbgprintf("IF\n"); @@ -2446,59 +2447,69 @@ cnfstmtNew(unsigned s_type) return cnfstmt; } +void cnfstmtDestructLst(struct cnfstmt *root); + +/* delete a single stmt */ +static void +cnfstmtDestruct(struct cnfstmt *stmt) +{ + switch(stmt->nodetype) { + case S_NOP: + case S_STOP: + break; + case S_CALL: + es_deleteStr(stmt->d.s_call.name); + break; + case S_ACT: + actionDestruct(stmt->d.act); + break; + case S_IF: + cnfexprDestruct(stmt->d.s_if.expr); + if(stmt->d.s_if.t_then != NULL) { + cnfstmtDestructLst(stmt->d.s_if.t_then); + } + if(stmt->d.s_if.t_else != NULL) { + cnfstmtDestructLst(stmt->d.s_if.t_else); + } + break; + case S_SET: + free(stmt->d.s_set.varname); + cnfexprDestruct(stmt->d.s_set.expr); + break; + case S_UNSET: + free(stmt->d.s_set.varname); + break; + case S_PRIFILT: + cnfstmtDestructLst(stmt->d.s_prifilt.t_then); + cnfstmtDestructLst(stmt->d.s_prifilt.t_else); + break; + case S_PROPFILT: + if(stmt->d.s_propfilt.propName != NULL) + es_deleteStr(stmt->d.s_propfilt.propName); + if(stmt->d.s_propfilt.regex_cache != NULL) + rsCStrRegexDestruct(&stmt->d.s_propfilt.regex_cache); + if(stmt->d.s_propfilt.pCSCompValue != NULL) + cstrDestruct(&stmt->d.s_propfilt.pCSCompValue); + cnfstmtDestructLst(stmt->d.s_propfilt.t_then); + break; + default: + dbgprintf("error: unknown stmt type during destruct %u\n", + (unsigned) stmt->nodetype); + break; + } + free(stmt->printable); + free(stmt); +} + +/* delete a stmt and all others following it */ void -cnfstmtDestruct(struct cnfstmt *root) +cnfstmtDestructLst(struct cnfstmt *root) { struct cnfstmt *stmt, *todel; for(stmt = root ; stmt != NULL ; ) { - switch(stmt->nodetype) { - case S_NOP: - case S_STOP: - break; - case S_CALL: - es_deleteStr(stmt->d.s_call.name); - break; - case S_ACT: - actionDestruct(stmt->d.act); - break; - case S_IF: - cnfexprDestruct(stmt->d.s_if.expr); - if(stmt->d.s_if.t_then != NULL) { - cnfstmtDestruct(stmt->d.s_if.t_then); - } - if(stmt->d.s_if.t_else != NULL) { - cnfstmtDestruct(stmt->d.s_if.t_else); - } - break; - case S_SET: - free(stmt->d.s_set.varname); - cnfexprDestruct(stmt->d.s_set.expr); - break; - case S_UNSET: - free(stmt->d.s_set.varname); - break; - case S_PRIFILT: - cnfstmtDestruct(stmt->d.s_prifilt.t_then); - cnfstmtDestruct(stmt->d.s_prifilt.t_else); - break; - case S_PROPFILT: - if(stmt->d.s_propfilt.propName != NULL) - es_deleteStr(stmt->d.s_propfilt.propName); - if(stmt->d.s_propfilt.regex_cache != NULL) - rsCStrRegexDestruct(&stmt->d.s_propfilt.regex_cache); - if(stmt->d.s_propfilt.pCSCompValue != NULL) - cstrDestruct(&stmt->d.s_propfilt.pCSCompValue); - cnfstmtDestruct(stmt->d.s_propfilt.t_then); - break; - default: - dbgprintf("error: unknown stmt type during destruct %u\n", - (unsigned) stmt->nodetype); - break; - } - free(stmt->printable); todel = stmt; stmt = stmt->next; - free(todel); + cnfstmtDestruct(todel); } } @@ -3049,7 +3060,7 @@ cnfstmtOptimizePRIFilt(struct cnfstmt *stmt) DBGPRINTF("optimizer: removing always-true PRIFILT %p\n", stmt); if(stmt->d.s_prifilt.t_else != NULL) { parser_errmsg("error: always-true PRI filter has else part!\n"); - cnfstmtDestruct(stmt->d.s_prifilt.t_else); + cnfstmtDestructLst(stmt->d.s_prifilt.t_else); } free(stmt->printable); stmt->printable = NULL; diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h index 31b2eb9..d00cc4c 100644 --- a/grammar/rainerscript.h +++ b/grammar/rainerscript.h @@ -331,7 +331,7 @@ struct cnfstmt * cnfstmtNewSet(char *var, struct cnfexpr *expr); struct cnfstmt * cnfstmtNewUnset(char *var); struct cnfstmt * cnfstmtNewCall(es_str_t *name); struct cnfstmt * cnfstmtNewContinue(void); -void cnfstmtDestruct(struct cnfstmt *root); +void cnfstmtDestructLst(struct cnfstmt *root); void cnfstmtOptimize(struct cnfstmt *root); struct cnfarray* cnfarrayNew(es_str_t *val); struct cnfarray* cnfarrayDup(struct cnfarray *old); |