summaryrefslogtreecommitdiff
path: root/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'grammar')
-rw-r--r--grammar/grammar.c397
-rw-r--r--grammar/grammar.h8
-rw-r--r--grammar/grammar.y58
-rw-r--r--grammar/lexer.c242
-rw-r--r--grammar/lexer.l28
-rw-r--r--grammar/parserif.h20
-rw-r--r--grammar/rainerscript.c2
-rw-r--r--grammar/rainerscript.h18
8 files changed, 384 insertions, 389 deletions
diff --git a/grammar/grammar.c b/grammar/grammar.c
index e28ba33..6704bab 100644
--- a/grammar/grammar.c
+++ b/grammar/grammar.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 2.6.4. */
+/* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.6.4"
+#define YYBISON_VERSION "2.7"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -62,8 +62,8 @@
/* Copy the first part of user declarations. */
-/* Line 358 of yacc.c */
-#line 31 "grammar.y"
+/* Line 371 of yacc.c */
+#line 29 "grammar.y"
#include "config.h"
#include <stdio.h>
@@ -77,7 +77,7 @@ extern int yylineno;
extern int yylex(void);
extern int yyerror(char*);
-/* Line 358 of yacc.c */
+/* Line 371 of yacc.c */
#line 82 "grammar.c"
# ifndef YY_NULL
@@ -203,8 +203,8 @@ extern int yydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
-/* Line 374 of yacc.c */
-#line 45 "grammar.y"
+/* Line 387 of yacc.c */
+#line 43 "grammar.y"
char *s;
long long n;
@@ -220,7 +220,7 @@ typedef union YYSTYPE
struct cnffparamlst *fparams;
-/* Line 374 of yacc.c */
+/* Line 387 of yacc.c */
#line 225 "grammar.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
@@ -248,7 +248,7 @@ int yyparse ();
/* Copy the second part of user declarations. */
-/* Line 377 of yacc.c */
+/* Line 390 of yacc.c */
#line 253 "grammar.c"
#ifdef short
@@ -570,14 +570,14 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 123, 123, 124, 125, 126, 127, 128, 129, 130,
- 131, 135, 139, 140, 141, 142, 143, 144, 145, 146,
- 147, 148, 149, 150, 151, 152, 156, 160, 161, 162,
- 163, 164, 165, 166, 167, 169, 170, 171, 172, 173,
- 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
- 194, 195, 196, 197, 198, 199, 200, 201, 202, 203,
- 204, 205
+ 0, 121, 121, 122, 123, 124, 125, 126, 127, 128,
+ 129, 133, 137, 138, 139, 140, 141, 142, 143, 144,
+ 145, 146, 147, 148, 149, 150, 154, 158, 159, 160,
+ 161, 162, 163, 164, 165, 167, 168, 169, 170, 171,
+ 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
+ 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
+ 202, 203
};
#endif
@@ -841,47 +841,18 @@ do \
} \
while (YYID (0))
-
+/* Error token number */
#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). */
-
-#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; \
- } \
- while (YYID (0))
-#endif
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-
-
/* This macro is provided for backward compatibility. */
-
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
-
#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
@@ -944,7 +915,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
switch (yytype)
{
default:
- break;
+ break;
}
}
@@ -1186,7 +1157,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
@@ -1249,11 +1219,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
}
}
}
@@ -1273,10 +1245,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
- yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
if (*yymsg_alloc < yysize)
{
@@ -1336,7 +1310,7 @@ yydestruct (yymsg, yytype, yyvaluep)
{
default:
- break;
+ break;
}
}
@@ -1347,16 +1321,16 @@ yydestruct (yymsg, yytype, yyvaluep)
int yychar;
-#ifndef YYLVAL_INITIALIZE
-# define YYLVAL_INITIALIZE()
-#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
@@ -1432,8 +1406,8 @@ yyparse ()
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yyss = yyssa;
- yyvs = yyvsa;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1442,15 +1416,6 @@ yyparse ()
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
- yyssp = yyss;
- yyvsp = yyvs;
-
- YYLVAL_INITIALIZE ();
goto yysetstate;
/*------------------------------------------------------------.
@@ -1630,144 +1595,144 @@ yyreduce:
switch (yyn)
{
case 3:
-/* Line 1813 of yacc.c */
-#line 124 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 122 "grammar.y"
{ cnfDoObj((yyvsp[(2) - (2)].obj)); }
break;
case 4:
-/* Line 1813 of yacc.c */
-#line 125 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 123 "grammar.y"
{ cnfDoScript((yyvsp[(2) - (2)].stmt)); }
break;
case 5:
-/* Line 1813 of yacc.c */
-#line 126 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 124 "grammar.y"
{ cnfDoCfsysline((yyvsp[(2) - (2)].s)); }
break;
case 6:
-/* Line 1813 of yacc.c */
-#line 127 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 125 "grammar.y"
{ cnfDoBSDTag((yyvsp[(2) - (2)].s)); }
break;
case 7:
-/* Line 1813 of yacc.c */
-#line 128 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 126 "grammar.y"
{ cnfDoBSDHost((yyvsp[(2) - (2)].s)); }
break;
case 8:
-/* Line 1813 of yacc.c */
-#line 129 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 127 "grammar.y"
{ (yyval.obj) = cnfobjNew((yyvsp[(1) - (3)].objType), (yyvsp[(2) - (3)].nvlst)); }
break;
case 9:
-/* Line 1813 of yacc.c */
-#line 130 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 128 "grammar.y"
{ (yyval.obj) = cnfobjNew(CNFOBJ_TPL, (yyvsp[(2) - (3)].nvlst)); }
break;
case 10:
-/* Line 1813 of yacc.c */
-#line 132 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 130 "grammar.y"
{ (yyval.obj) = cnfobjNew(CNFOBJ_TPL, (yyvsp[(2) - (6)].nvlst));
(yyval.obj)->subobjs = (yyvsp[(5) - (6)].objlst);
}
break;
case 11:
-/* Line 1813 of yacc.c */
-#line 136 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 134 "grammar.y"
{ (yyval.obj) = cnfobjNew(CNFOBJ_RULESET, (yyvsp[(2) - (6)].nvlst));
(yyval.obj)->script = (yyvsp[(5) - (6)].stmt);
}
break;
case 12:
-/* Line 1813 of yacc.c */
-#line 139 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 137 "grammar.y"
{ (yyval.objlst) = NULL; }
break;
case 13:
-/* Line 1813 of yacc.c */
-#line 140 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 138 "grammar.y"
{ (yyval.objlst) = objlstAdd((yyvsp[(1) - (2)].objlst), (yyvsp[(2) - (2)].obj)); }
break;
case 14:
-/* Line 1813 of yacc.c */
-#line 141 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 139 "grammar.y"
{ (yyval.objlst) = objlstAdd((yyvsp[(1) - (2)].objlst), (yyvsp[(2) - (2)].obj)); }
break;
case 15:
-/* Line 1813 of yacc.c */
-#line 142 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 140 "grammar.y"
{ (yyval.obj) = cnfobjNew(CNFOBJ_PROPERTY, (yyvsp[(2) - (3)].nvlst)); }
break;
case 16:
-/* Line 1813 of yacc.c */
-#line 143 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 141 "grammar.y"
{ (yyval.obj) = cnfobjNew(CNFOBJ_CONSTANT, (yyvsp[(2) - (3)].nvlst)); }
break;
case 17:
-/* Line 1813 of yacc.c */
-#line 144 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 142 "grammar.y"
{ (yyval.nvlst) = NULL; }
break;
case 18:
-/* Line 1813 of yacc.c */
-#line 145 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 143 "grammar.y"
{ (yyvsp[(2) - (2)].nvlst)->next = (yyvsp[(1) - (2)].nvlst); (yyval.nvlst) = (yyvsp[(2) - (2)].nvlst); }
break;
case 19:
-/* Line 1813 of yacc.c */
-#line 146 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 144 "grammar.y"
{ (yyval.nvlst) = nvlstSetName((yyvsp[(3) - (3)].nvlst), (yyvsp[(1) - (3)].estr)); }
break;
case 20:
-/* Line 1813 of yacc.c */
-#line 147 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 145 "grammar.y"
{ (yyval.nvlst) = nvlstNewStr((yyvsp[(1) - (1)].estr)); }
break;
case 21:
-/* Line 1813 of yacc.c */
-#line 148 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 146 "grammar.y"
{ (yyval.nvlst) = nvlstNewArray((yyvsp[(1) - (1)].arr)); }
break;
case 22:
-/* Line 1813 of yacc.c */
-#line 149 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 147 "grammar.y"
{ (yyval.stmt) = (yyvsp[(1) - (1)].stmt); }
break;
case 23:
-/* Line 1813 of yacc.c */
-#line 150 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 148 "grammar.y"
{ (yyval.stmt) = scriptAddStmt((yyvsp[(1) - (2)].stmt), (yyvsp[(2) - (2)].stmt)); }
break;
case 24:
-/* Line 1813 of yacc.c */
-#line 151 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 149 "grammar.y"
{ (yyval.stmt) = (yyvsp[(1) - (1)].stmt); }
break;
case 25:
-/* Line 1813 of yacc.c */
-#line 152 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 150 "grammar.y"
{ (yyval.stmt) = cnfstmtNew(S_IF);
(yyval.stmt)->d.s_if.expr = (yyvsp[(2) - (4)].expr);
(yyval.stmt)->d.s_if.t_then = (yyvsp[(4) - (4)].stmt);
@@ -1775,8 +1740,8 @@ yyreduce:
break;
case 26:
-/* Line 1813 of yacc.c */
-#line 156 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 154 "grammar.y"
{ (yyval.stmt) = cnfstmtNew(S_IF);
(yyval.stmt)->d.s_if.expr = (yyvsp[(2) - (6)].expr);
(yyval.stmt)->d.s_if.t_then = (yyvsp[(4) - (6)].stmt);
@@ -1784,278 +1749,278 @@ yyreduce:
break;
case 27:
-/* Line 1813 of yacc.c */
-#line 160 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 158 "grammar.y"
{ (yyval.stmt) = cnfstmtNewSet((yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].expr)); }
break;
case 28:
-/* Line 1813 of yacc.c */
-#line 161 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 159 "grammar.y"
{ (yyval.stmt) = cnfstmtNewUnset((yyvsp[(2) - (3)].s)); }
break;
case 29:
-/* Line 1813 of yacc.c */
-#line 162 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 160 "grammar.y"
{ (yyval.stmt) = cnfstmtNewPRIFILT((yyvsp[(1) - (2)].s), (yyvsp[(2) - (2)].stmt)); }
break;
case 30:
-/* Line 1813 of yacc.c */
-#line 163 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 161 "grammar.y"
{ (yyval.stmt) = cnfstmtNewPROPFILT((yyvsp[(1) - (2)].s), (yyvsp[(2) - (2)].stmt)); }
break;
case 31:
-/* Line 1813 of yacc.c */
-#line 164 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 162 "grammar.y"
{ (yyval.stmt) = (yyvsp[(1) - (1)].stmt); }
break;
case 32:
-/* Line 1813 of yacc.c */
-#line 165 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 163 "grammar.y"
{ (yyval.stmt) = (yyvsp[(2) - (3)].stmt); }
break;
case 33:
-/* Line 1813 of yacc.c */
-#line 166 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 164 "grammar.y"
{ (yyval.stmt) = (yyvsp[(1) - (1)].stmt); }
break;
case 34:
-/* Line 1813 of yacc.c */
-#line 167 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 165 "grammar.y"
{ (yyval.stmt) = scriptAddStmt((yyvsp[(1) - (3)].stmt), (yyvsp[(3) - (3)].stmt)); }
break;
case 35:
-/* Line 1813 of yacc.c */
-#line 169 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 167 "grammar.y"
{ (yyval.stmt) = cnfstmtNewAct((yyvsp[(2) - (3)].nvlst)); }
break;
case 36:
-/* Line 1813 of yacc.c */
-#line 170 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 168 "grammar.y"
{ (yyval.stmt) = cnfstmtNewLegaAct((yyvsp[(1) - (1)].s)); }
break;
case 37:
-/* Line 1813 of yacc.c */
-#line 171 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 169 "grammar.y"
{ (yyval.stmt) = cnfstmtNew(S_STOP); }
break;
case 38:
-/* Line 1813 of yacc.c */
-#line 172 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 170 "grammar.y"
{ (yyval.stmt) = cnfstmtNewCall((yyvsp[(2) - (2)].estr)); }
break;
case 39:
-/* Line 1813 of yacc.c */
-#line 173 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 171 "grammar.y"
{ (yyval.stmt) = cnfstmtNewContinue(); }
break;
case 40:
-/* Line 1813 of yacc.c */
-#line 174 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 172 "grammar.y"
{ (yyval.expr) = cnfexprNew(AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 41:
-/* Line 1813 of yacc.c */
-#line 175 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 173 "grammar.y"
{ (yyval.expr) = cnfexprNew(OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 42:
-/* Line 1813 of yacc.c */
-#line 176 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 174 "grammar.y"
{ (yyval.expr) = cnfexprNew(NOT, NULL, (yyvsp[(2) - (2)].expr)); }
break;
case 43:
-/* Line 1813 of yacc.c */
-#line 177 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 175 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_EQ, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 44:
-/* Line 1813 of yacc.c */
-#line 178 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 176 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_NE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 45:
-/* Line 1813 of yacc.c */
-#line 179 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 177 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_LE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 46:
-/* Line 1813 of yacc.c */
-#line 180 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 178 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_GE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 47:
-/* Line 1813 of yacc.c */
-#line 181 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 179 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_LT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 48:
-/* Line 1813 of yacc.c */
-#line 182 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 180 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_GT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 49:
-/* Line 1813 of yacc.c */
-#line 183 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 181 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_CONTAINS, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 50:
-/* Line 1813 of yacc.c */
-#line 184 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 182 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_CONTAINSI, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 51:
-/* Line 1813 of yacc.c */
-#line 185 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 183 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_STARTSWITH, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 52:
-/* Line 1813 of yacc.c */
-#line 186 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 184 "grammar.y"
{ (yyval.expr) = cnfexprNew(CMP_STARTSWITHI, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 53:
-/* Line 1813 of yacc.c */
-#line 187 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 185 "grammar.y"
{ (yyval.expr) = cnfexprNew('&', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 54:
-/* Line 1813 of yacc.c */
-#line 188 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 186 "grammar.y"
{ (yyval.expr) = cnfexprNew('+', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 55:
-/* Line 1813 of yacc.c */
-#line 189 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 187 "grammar.y"
{ (yyval.expr) = cnfexprNew('-', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 56:
-/* Line 1813 of yacc.c */
-#line 190 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 188 "grammar.y"
{ (yyval.expr) = cnfexprNew('*', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 57:
-/* Line 1813 of yacc.c */
-#line 191 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 189 "grammar.y"
{ (yyval.expr) = cnfexprNew('/', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 58:
-/* Line 1813 of yacc.c */
-#line 192 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 190 "grammar.y"
{ (yyval.expr) = cnfexprNew('%', (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
break;
case 59:
-/* Line 1813 of yacc.c */
-#line 193 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 191 "grammar.y"
{ (yyval.expr) = (yyvsp[(2) - (3)].expr); }
break;
case 60:
-/* Line 1813 of yacc.c */
-#line 194 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 192 "grammar.y"
{ (yyval.expr) = cnfexprNew('M', NULL, (yyvsp[(2) - (2)].expr)); }
break;
case 61:
-/* Line 1813 of yacc.c */
-#line 195 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 193 "grammar.y"
{ (yyval.expr) = (struct cnfexpr*) cnffuncNew((yyvsp[(1) - (3)].estr), NULL); }
break;
case 62:
-/* Line 1813 of yacc.c */
-#line 196 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 194 "grammar.y"
{ (yyval.expr) = (struct cnfexpr*) cnffuncNew((yyvsp[(1) - (4)].estr), (yyvsp[(3) - (4)].fparams)); }
break;
case 63:
-/* Line 1813 of yacc.c */
-#line 197 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 195 "grammar.y"
{ (yyval.expr) = (struct cnfexpr*) cnfnumvalNew((yyvsp[(1) - (1)].n)); }
break;
case 64:
-/* Line 1813 of yacc.c */
-#line 198 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 196 "grammar.y"
{ (yyval.expr) = (struct cnfexpr*) cnfstringvalNew((yyvsp[(1) - (1)].estr)); }
break;
case 65:
-/* Line 1813 of yacc.c */
-#line 199 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 197 "grammar.y"
{ (yyval.expr) = (struct cnfexpr*) cnfvarNew((yyvsp[(1) - (1)].s)); }
break;
case 66:
-/* Line 1813 of yacc.c */
-#line 200 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 198 "grammar.y"
{ (yyval.expr) = (struct cnfexpr*) (yyvsp[(1) - (1)].arr); }
break;
case 67:
-/* Line 1813 of yacc.c */
-#line 201 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 199 "grammar.y"
{ (yyval.fparams) = cnffparamlstNew((yyvsp[(1) - (1)].expr), NULL); }
break;
case 68:
-/* Line 1813 of yacc.c */
-#line 202 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 200 "grammar.y"
{ (yyval.fparams) = cnffparamlstNew((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].fparams)); }
break;
case 69:
-/* Line 1813 of yacc.c */
-#line 203 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 201 "grammar.y"
{ (yyval.arr) = (yyvsp[(2) - (3)].arr); }
break;
case 70:
-/* Line 1813 of yacc.c */
-#line 204 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 202 "grammar.y"
{ (yyval.arr) = cnfarrayNew((yyvsp[(1) - (1)].estr)); }
break;
case 71:
-/* Line 1813 of yacc.c */
-#line 205 "grammar.y"
+/* Line 1792 of yacc.c */
+#line 203 "grammar.y"
{ (yyval.arr) = cnfarrayAdd((yyvsp[(1) - (3)].arr), (yyvsp[(3) - (3)].estr)); }
break;
-/* Line 1813 of yacc.c */
-#line 2059 "grammar.c"
+/* Line 1792 of yacc.c */
+#line 2024 "grammar.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2286,8 +2251,8 @@ yyreturn:
}
-/* Line 2076 of yacc.c */
-#line 207 "grammar.y"
+/* Line 2055 of yacc.c */
+#line 205 "grammar.y"
/*
int yyerror(char *s)
diff --git a/grammar/grammar.h b/grammar/grammar.h
index 9ff8183..3ee2b26 100644
--- a/grammar/grammar.h
+++ b/grammar/grammar.h
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 2.6.4. */
+/* A Bison parser, made by GNU Bison 2.7. */
/* Bison interface for Yacc-like parsers in C
@@ -135,8 +135,8 @@ extern int yydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
-/* Line 2077 of yacc.c */
-#line 45 "grammar.y"
+/* Line 2058 of yacc.c */
+#line 43 "grammar.y"
char *s;
long long n;
@@ -152,7 +152,7 @@ typedef union YYSTYPE
struct cnffparamlst *fparams;
-/* Line 2077 of yacc.c */
+/* Line 2058 of yacc.c */
#line 157 "grammar.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
diff --git a/grammar/grammar.y b/grammar/grammar.y
index a198db0..488d332 100644
--- a/grammar/grammar.y
+++ b/grammar/grammar.y
@@ -1,33 +1,31 @@
- /* Bison file for rsyslog config format v2 (RainerScript).
- * Please note: this file introduces the new config format, but maintains
- * backward compatibility. In order to do so, the grammar is not 100% clean,
- * but IMHO still sufficiently easy both to understand for programmers
- * maitaining the code as well as users writing the config file. Users are,
- * of course, encouraged to use new constructs only. But it needs to be noted
- * that some of the legacy constructs (specifically the in-front-of-action
- * PRI filter) are very hard to beat in ease of use, at least for simpler
- * cases.
- *
- * Copyright 2011-2014 Rainer Gerhards and Adiscon GmbH.
- *
- * This file is part of the rsyslog runtime library.
- *
- * The rsyslog runtime library is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * The rsyslog runtime library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the rsyslog runtime library. If not, see <http://www.gnu.org/licenses/>.
- *
- * A copy of the GPL can be found in the file "COPYING" in this distribution.
- * A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution.
- */
+/* Bison file for rsyslog config format v2 (RainerScript).
+ * Please note: this file introduces the new config format, but maintains
+ * backward compatibility. In order to do so, the grammar is not 100% clean,
+ * but IMHO still sufficiently easy both to understand for programmers
+ * maitaining the code as well as users writing the config file. Users are,
+ * of course, encouraged to use new constructs only. But it needs to be noted
+ * that some of the legacy constructs (specifically the in-front-of-action
+ * PRI filter) are very hard to beat in ease of use, at least for simpler
+ * cases.
+ *
+ * Copyright 2011-2014 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of the rsyslog runtime library.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * -or-
+ * see COPYING.ASL20 in the source distribution
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
%{
#include "config.h"
#include <stdio.h>
diff --git a/grammar/lexer.c b/grammar/lexer.c
index 2c96807..9dba6f2 100644
--- a/grammar/lexer.c
+++ b/grammar/lexer.c
@@ -1434,23 +1434,21 @@ char *yytext;
*
* This file is part of the rsyslog runtime library.
*
-* The rsyslog runtime library is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* The rsyslog runtime library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with the rsyslog runtime library. If not, see <http://www.gnu.org/licenses/>.
-*
-* A copy of the GPL can be found in the file "COPYING" in this distribution.
-* A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+* -or-
+* see COPYING.ASL20 in the source distribution
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
*/
-#line 34 "lexer.l"
+#line 32 "lexer.l"
#include "config.h"
/*%option noyywrap nodefault case-insensitive */
/* avoid compiler warning: `yyunput' defined but not used */
@@ -1477,7 +1475,7 @@ char *yytext;
* wrote this ugly, but the price needed to pay in order to remain
* compatible to the previous format.
*/
-#line 67 "lexer.l"
+#line 65 "lexer.l"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -1510,7 +1508,7 @@ extern int yydebug;
int fileno(FILE *stream);
#endif
-#line 1514 "lexer.c"
+#line 1512 "lexer.c"
#define INITIAL 0
#define INOBJ 1
@@ -1699,11 +1697,11 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 101 "lexer.l"
+#line 99 "lexer.l"
/* keywords */
-#line 1707 "lexer.c"
+#line 1705 "lexer.c"
if ( !(yy_init) )
{
@@ -1799,131 +1797,131 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 104 "lexer.l"
+#line 102 "lexer.l"
{ BEGIN EXPR; return IF; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 105 "lexer.l"
+#line 103 "lexer.l"
{ BEGIN INITIAL; return THEN; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 106 "lexer.l"
+#line 104 "lexer.l"
{ BEGIN INITIAL; return ';'; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 107 "lexer.l"
+#line 105 "lexer.l"
{ return OR; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 108 "lexer.l"
+#line 106 "lexer.l"
{ return AND; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 109 "lexer.l"
+#line 107 "lexer.l"
{ return NOT; }
YY_BREAK
case 7:
-#line 111 "lexer.l"
+#line 109 "lexer.l"
case 8:
-#line 112 "lexer.l"
+#line 110 "lexer.l"
case 9:
-#line 113 "lexer.l"
+#line 111 "lexer.l"
case 10:
-#line 114 "lexer.l"
+#line 112 "lexer.l"
case 11:
-#line 115 "lexer.l"
+#line 113 "lexer.l"
case 12:
-#line 116 "lexer.l"
+#line 114 "lexer.l"
case 13:
-#line 117 "lexer.l"
+#line 115 "lexer.l"
case 14:
-#line 118 "lexer.l"
+#line 116 "lexer.l"
case 15:
-#line 119 "lexer.l"
+#line 117 "lexer.l"
case 16:
-#line 120 "lexer.l"
+#line 118 "lexer.l"
case 17:
-#line 121 "lexer.l"
+#line 119 "lexer.l"
case 18:
YY_RULE_SETUP
-#line 121 "lexer.l"
+#line 119 "lexer.l"
{ return yytext[0]; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 122 "lexer.l"
+#line 120 "lexer.l"
{ return CMP_EQ; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 123 "lexer.l"
+#line 121 "lexer.l"
{ return CMP_LE; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 124 "lexer.l"
+#line 122 "lexer.l"
{ return CMP_GE; }
YY_BREAK
case 22:
-#line 126 "lexer.l"
+#line 124 "lexer.l"
case 23:
YY_RULE_SETUP
-#line 126 "lexer.l"
+#line 124 "lexer.l"
{ return CMP_NE; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 127 "lexer.l"
+#line 125 "lexer.l"
{ return CMP_LT; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 128 "lexer.l"
+#line 126 "lexer.l"
{ return CMP_GT; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 129 "lexer.l"
+#line 127 "lexer.l"
{ return CMP_CONTAINS; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 130 "lexer.l"
+#line 128 "lexer.l"
{ return CMP_CONTAINSI; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 131 "lexer.l"
+#line 129 "lexer.l"
{ return CMP_STARTSWITH; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 132 "lexer.l"
+#line 130 "lexer.l"
{ return CMP_STARTSWITHI; }
YY_BREAK
case 30:
-#line 134 "lexer.l"
+#line 132 "lexer.l"
case 31:
-#line 135 "lexer.l"
+#line 133 "lexer.l"
case 32:
YY_RULE_SETUP
-#line 135 "lexer.l"
+#line 133 "lexer.l"
{ yylval.n = strtoll(yytext, NULL, 0); return NUMBER; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 136 "lexer.l"
+#line 134 "lexer.l"
{ yylval.s = strdup(yytext+1); return VAR; }
YY_BREAK
case 34:
/* rule 34 can match eol */
YY_RULE_SETUP
-#line 137 "lexer.l"
+#line 135 "lexer.l"
{
yytext[yyleng-1] = '\0';
unescapeStr((uchar*)yytext+1, yyleng-2);
@@ -1933,7 +1931,7 @@ YY_RULE_SETUP
case 35:
/* rule 35 can match eol */
YY_RULE_SETUP
-#line 142 "lexer.l"
+#line 140 "lexer.l"
{
yytext[yyleng-1] = '\0';
unescapeStr((uchar*)yytext+1, yyleng-2);
@@ -1943,18 +1941,18 @@ YY_RULE_SETUP
case 36:
/* rule 36 can match eol */
YY_RULE_SETUP
-#line 147 "lexer.l"
+#line 145 "lexer.l"
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 148 "lexer.l"
+#line 146 "lexer.l"
{ yylval.estr = es_newStrFromCStr(yytext, yyleng);
return FUNC; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 150 "lexer.l"
+#line 148 "lexer.l"
{ parser_errmsg("invalid character '%s' in expression "
"- is there an invalid escape sequence somewhere?",
yytext); }
@@ -1962,66 +1960,66 @@ YY_RULE_SETUP
case 39:
/* rule 39 can match eol */
YY_RULE_SETUP
-#line 153 "lexer.l"
+#line 151 "lexer.l"
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 154 "lexer.l"
+#line 152 "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 157 "lexer.l"
+#line 155 "lexer.l"
{ yylval.estr = es_newStrFromCStr(yytext, yyleng);
BEGIN INITIAL;
return NAME; }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 160 "lexer.l"
+#line 158 "lexer.l"
{ return '&'; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 161 "lexer.l"
+#line 159 "lexer.l"
{ return '{'; }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 162 "lexer.l"
+#line 160 "lexer.l"
{ return '}'; }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 163 "lexer.l"
+#line 161 "lexer.l"
{ return STOP; }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 164 "lexer.l"
+#line 162 "lexer.l"
{ return ELSE; }
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 165 "lexer.l"
+#line 163 "lexer.l"
{ BEGIN INCALL; return CALL; }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 166 "lexer.l"
+#line 164 "lexer.l"
{ BEGIN EXPR; return SET; }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 167 "lexer.l"
+#line 165 "lexer.l"
{ BEGIN EXPR; return UNSET; }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 168 "lexer.l"
+#line 166 "lexer.l"
{ return CONTINUE; }
YY_BREAK
/* line number support because the "preprocessor" combines lines and so needs
@@ -2029,23 +2027,23 @@ YY_RULE_SETUP
*/
case 51:
YY_RULE_SETUP
-#line 172 "lexer.l"
+#line 170 "lexer.l"
{ BEGIN LINENO; }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 173 "lexer.l"
+#line 171 "lexer.l"
{ yylineno = atoi(yytext) - 1; }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 174 "lexer.l"
+#line 172 "lexer.l"
{ BEGIN INITIAL; }
YY_BREAK
case 54:
/* rule 54 can match eol */
YY_RULE_SETUP
-#line 175 "lexer.l"
+#line 173 "lexer.l"
YY_BREAK
/* $IncludeConfig must be detected as part of CFSYSLINE, because this is
@@ -2054,12 +2052,12 @@ YY_RULE_SETUP
case 55:
/* rule 55 can match eol */
YY_RULE_SETUP
-#line 179 "lexer.l"
+#line 177 "lexer.l"
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 180 "lexer.l"
+#line 178 "lexer.l"
{ if(cnfDoInclude(yytext) != 0)
yyterminate();
BEGIN INITIAL; }
@@ -2067,76 +2065,76 @@ YY_RULE_SETUP
case 57:
/* rule 57 can match eol */
YY_RULE_SETUP
-#line 183 "lexer.l"
+#line 181 "lexer.l"
{ yylval.objType = CNFOBJ_MAINQ;
BEGIN INOBJ; return BEGINOBJ; }
YY_BREAK
case 58:
/* rule 58 can match eol */
YY_RULE_SETUP
-#line 185 "lexer.l"
+#line 183 "lexer.l"
{ yylval.objType = CNFOBJ_GLOBAL;
BEGIN INOBJ; return BEGINOBJ; }
YY_BREAK
case 59:
/* rule 59 can match eol */
YY_RULE_SETUP
-#line 187 "lexer.l"
+#line 185 "lexer.l"
{ yylval.objType = CNFOBJ_TPL;
BEGIN INOBJ; return BEGIN_TPL; }
YY_BREAK
case 60:
/* rule 60 can match eol */
YY_RULE_SETUP
-#line 189 "lexer.l"
+#line 187 "lexer.l"
{ yylval.objType = CNFOBJ_RULESET;
BEGIN INOBJ; return BEGIN_RULESET; }
YY_BREAK
case 61:
/* rule 61 can match eol */
YY_RULE_SETUP
-#line 191 "lexer.l"
+#line 189 "lexer.l"
{ yylval.objType = CNFOBJ_PROPERTY;
BEGIN INOBJ; return BEGIN_PROPERTY; }
YY_BREAK
case 62:
/* rule 62 can match eol */
YY_RULE_SETUP
-#line 193 "lexer.l"
+#line 191 "lexer.l"
{ yylval.objType = CNFOBJ_CONSTANT;
BEGIN INOBJ; return BEGIN_CONSTANT; }
YY_BREAK
case 63:
/* rule 63 can match eol */
YY_RULE_SETUP
-#line 195 "lexer.l"
+#line 193 "lexer.l"
{ yylval.objType = CNFOBJ_INPUT;
BEGIN INOBJ; return BEGINOBJ; }
YY_BREAK
case 64:
/* rule 64 can match eol */
YY_RULE_SETUP
-#line 197 "lexer.l"
+#line 195 "lexer.l"
{ yylval.objType = CNFOBJ_MODULE;
BEGIN INOBJ; return BEGINOBJ; }
YY_BREAK
case 65:
/* rule 65 can match eol */
YY_RULE_SETUP
-#line 199 "lexer.l"
+#line 197 "lexer.l"
{ yylval.objType = CNFOBJ_LOOKUP_TABLE;
BEGIN INOBJ; return BEGINOBJ; }
YY_BREAK
case 66:
/* rule 66 can match eol */
YY_RULE_SETUP
-#line 201 "lexer.l"
+#line 199 "lexer.l"
{ BEGIN INOBJ; return BEGIN_ACTION; }
YY_BREAK
case 67:
/* rule 67 can match eol */
YY_RULE_SETUP
-#line 202 "lexer.l"
+#line 200 "lexer.l"
{
yylval.s = strdup(rmLeadingSpace(yytext));
dbgprintf("lexer: propfilt is '%s'\n", yylval.s);
@@ -2145,57 +2143,57 @@ YY_RULE_SETUP
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 207 "lexer.l"
+#line 205 "lexer.l"
{ yylval.s = strdup(rmLeadingSpace(yytext)); return PRIFILT; }
YY_BREAK
case 69:
-#line 209 "lexer.l"
+#line 207 "lexer.l"
case 70:
-#line 210 "lexer.l"
+#line 208 "lexer.l"
case 71:
/* rule 71 can match eol */
-#line 211 "lexer.l"
+#line 209 "lexer.l"
case 72:
/* rule 72 can match eol */
-#line 212 "lexer.l"
+#line 210 "lexer.l"
case 73:
/* rule 73 can match eol */
-#line 213 "lexer.l"
+#line 211 "lexer.l"
case 74:
/* rule 74 can match eol */
-#line 214 "lexer.l"
+#line 212 "lexer.l"
case 75:
/* rule 75 can match eol */
YY_RULE_SETUP
-#line 214 "lexer.l"
+#line 212 "lexer.l"
{ yylval.s = yytext; return LEGACY_ACTION; }
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 215 "lexer.l"
+#line 213 "lexer.l"
{ BEGIN INITIAL; return ENDOBJ; }
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 216 "lexer.l"
+#line 214 "lexer.l"
{ yylval.estr = es_newStrFromCStr(yytext, yyleng);
return NAME; }
YY_BREAK
case 78:
-#line 219 "lexer.l"
+#line 217 "lexer.l"
case 79:
-#line 220 "lexer.l"
+#line 218 "lexer.l"
case 80:
-#line 221 "lexer.l"
+#line 219 "lexer.l"
case 81:
YY_RULE_SETUP
-#line 221 "lexer.l"
+#line 219 "lexer.l"
{ return(yytext[0]); }
YY_BREAK
case 82:
/* rule 82 can match eol */
YY_RULE_SETUP
-#line 222 "lexer.l"
+#line 220 "lexer.l"
{
yytext[yyleng-1] = '\0';
unescapeStr((uchar*)yytext+1, yyleng-2);
@@ -2206,28 +2204,28 @@ YY_RULE_SETUP
return VALUE; }*/
case 83:
YY_RULE_SETUP
-#line 229 "lexer.l"
+#line 227 "lexer.l"
{ preCommentState = YY_START; BEGIN COMMENT; }
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 230 "lexer.l"
+#line 228 "lexer.l"
{ preCommentState = YY_START; BEGIN COMMENT; }
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 231 "lexer.l"
+#line 229 "lexer.l"
{ preCommentState = YY_START; BEGIN COMMENT; }
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 232 "lexer.l"
+#line 230 "lexer.l"
{ BEGIN preCommentState; }
YY_BREAK
case 87:
/* rule 87 can match eol */
YY_RULE_SETUP
-#line 233 "lexer.l"
+#line 231 "lexer.l"
YY_BREAK
case 88:
@@ -2235,18 +2233,18 @@ case 88:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 234 "lexer.l"
+#line 232 "lexer.l"
/* skip comments in input */
YY_BREAK
case 89:
/* rule 89 can match eol */
YY_RULE_SETUP
-#line 235 "lexer.l"
+#line 233 "lexer.l"
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 236 "lexer.l"
+#line 234 "lexer.l"
{ parser_errmsg("invalid character '%s' in object definition "
"- is there an invalid escape sequence somewhere?",
yytext); }
@@ -2256,7 +2254,7 @@ case 91:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 239 "lexer.l"
+#line 237 "lexer.l"
{ /* see comment on $IncludeConfig above */
if(!strncasecmp(yytext, "$includeconfig ", 14)) {
yyless(14);
@@ -2274,7 +2272,7 @@ case 92:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 250 "lexer.l"
+#line 248 "lexer.l"
{ yylval.s = strdup(yytext); return BSD_TAG_SELECTOR; }
YY_BREAK
case 93:
@@ -2283,7 +2281,7 @@ case 93:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 251 "lexer.l"
+#line 249 "lexer.l"
{ yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; }
YY_BREAK
case 94:
@@ -2292,7 +2290,7 @@ case 94:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 252 "lexer.l"
+#line 250 "lexer.l"
{ yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; }
YY_BREAK
case 95:
@@ -2300,24 +2298,24 @@ case 95:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 253 "lexer.l"
+#line 251 "lexer.l"
{ yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; }
YY_BREAK
case 96:
/* rule 96 can match eol */
YY_RULE_SETUP
-#line 254 "lexer.l"
+#line 252 "lexer.l"
/* skip comments in input */
YY_BREAK
case 97:
/* rule 97 can match eol */
YY_RULE_SETUP
-#line 255 "lexer.l"
+#line 253 "lexer.l"
/* drop whitespace */
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 256 "lexer.l"
+#line 254 "lexer.l"
{ parser_errmsg("invalid character '%s' "
"- is there an invalid escape sequence somewhere?",
yytext); }
@@ -2329,15 +2327,15 @@ case YY_STATE_EOF(INCL):
case YY_STATE_EOF(LINENO):
case YY_STATE_EOF(INCALL):
case YY_STATE_EOF(EXPR):
-#line 259 "lexer.l"
+#line 257 "lexer.l"
{ if(popfile() != 0) yyterminate(); }
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 261 "lexer.l"
+#line 259 "lexer.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 2341 "lexer.c"
+#line 2339 "lexer.c"
case YY_END_OF_BUFFER:
{
@@ -3302,7 +3300,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 261 "lexer.l"
+#line 259 "lexer.l"
int
diff --git a/grammar/lexer.l b/grammar/lexer.l
index d264d6e..48dba22 100644
--- a/grammar/lexer.l
+++ b/grammar/lexer.l
@@ -13,21 +13,19 @@
*
* This file is part of the rsyslog runtime library.
*
- * The rsyslog runtime library is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * The rsyslog runtime library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the rsyslog runtime library. If not, see <http://www.gnu.org/licenses/>.
- *
- * A copy of the GPL can be found in the file "COPYING" in this distribution.
- * A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * -or-
+ * see COPYING.ASL20 in the source distribution
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
%{
diff --git a/grammar/parserif.h b/grammar/parserif.h
index 21da095..b66023d 100644
--- a/grammar/parserif.h
+++ b/grammar/parserif.h
@@ -1,3 +1,21 @@
+/* rsyslog parser interface.
+ *
+ * Copyright 2011-2014 Rainer Gerhards
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * -or-
+ * see COPYING.ASL20 in the source distribution
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef PARSERIF_H_DEFINED
#define PARSERIF_H_DEFINED
#include "rainerscript.h"
@@ -20,4 +38,4 @@ void cnfDoScript(struct cnfstmt *script);
void cnfDoCfsysline(char *ln);
void cnfDoBSDTag(char *ln);
void cnfDoBSDHost(char *ln);
-#endif
+ #endif
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index de0d1bd..d508f91 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -1385,7 +1385,7 @@ doFunc_re_extract(struct cnffunc *func, struct var *ret, void* usrptr)
matchnbr = (short) var2Number(&r[2], NULL);
submatchnbr = (size_t) var2Number(&r[3], NULL);
if(submatchnbr >= sizeof(pmatch)/sizeof(regmatch_t)) {
- DBGPRINTF("re_extract() submatch %d is too large\n", submatchnbr);
+ DBGPRINTF("re_extract() submatch %zd is too large\n", submatchnbr);
bHadNoMatch = 1;
goto finalize_it;
}
diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h
index c813264..63a0bb4 100644
--- a/grammar/rainerscript.h
+++ b/grammar/rainerscript.h
@@ -1,3 +1,21 @@
+/* rsyslog rainerscript definitions
+ *
+ * Copyright 2011-2014 Rainer Gerhards
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * -or-
+ * see COPYING.ASL20 in the source distribution
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef INC_UTILS_H
#define INC_UTILS_H
#include <stdio.h>