summaryrefslogtreecommitdiffstats
path: root/grammar
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-06-30 19:03:48 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-06-30 19:03:48 +0200
commit1f69bcb67fad8920867120b8ad310b5f60a7cc62 (patch)
treeb385a52d3c4bd1547662f6f30dc4d90f33b76bce /grammar
parent0a1f27bba26c436b1c7042a2d3cc479dc1512e0a (diff)
downloadrsyslog-1f69bcb67fad8920867120b8ad310b5f60a7cc62.tar.gz
rsyslog-1f69bcb67fad8920867120b8ad310b5f60a7cc62.tar.xz
rsyslog-1f69bcb67fad8920867120b8ad310b5f60a7cc62.zip
milestone: first shot at rules to read old config file objects
Diffstat (limited to 'grammar')
-rw-r--r--grammar/debian.conf2
-rw-r--r--grammar/rscript.l33
2 files changed, 33 insertions, 2 deletions
diff --git a/grammar/debian.conf b/grammar/debian.conf
index ad5d2217..e5e54fde 100644
--- a/grammar/debian.conf
+++ b/grammar/debian.conf
@@ -115,3 +115,5 @@ daemon.*;mail.*;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
+# samples added to get full "flavor" of what we need to support...
+:msg, contains, "error" /var/log/somelog
diff --git a/grammar/rscript.l b/grammar/rscript.l
index 18286d5e..dd86fbe9 100644
--- a/grammar/rscript.l
+++ b/grammar/rscript.l
@@ -1,3 +1,8 @@
+%option noyywrap nodefault case-insensitive
+ /*%option noyywrap nodefault case-insensitive */
+
+%x OLDACT
+ /* old-style action expected -- need to parse differently */
%{
#include <libestr.h>
%}
@@ -5,8 +10,32 @@
%%
-^[ \t]*[\*a-z]+.[!=;.\*a-z]+ { printf("PRI: '%s'\n", yytext); }
-. { printf("%s", yytext); }
+\$[a-z]+.*$ { printf("CFSYSLINE: '%s'\n", yytext); }
+
+^[ \t]*:\$?[a-z]+[ ]*,[ ]*!?[a-z]+[ ]*,[ ]*\".*\" {
+ printf("PROP-FILT: '%s'\n", yytext);
+ BEGIN OLDACT;
+ }
+
+^[ \t]*[,\*a-z]+\.[,!=;\.\*a-z]+ { printf("PRI-FILT: '%s'\n", yytext);
+ BEGIN OLDACT;
+ }
+
+#.*\n /* skip comments in input */
+.|\n { if(yytext[0] != '\n') printf("%s", yytext); }
+
+<OLDACT>\* |
+<OLDACT>-\/[^ \t\n]+ |
+<OLDACT>\|[^ \t\n]+ |
+<OLDACT>\/[^ \t\n]+ { printf("old style action: '%s'\n", yytext);
+ BEGIN INITIAL;
+ }
+<OLDACT>[ \t\n]
+<OLDACT>.|\n { printf("invalid sequence in OLDACT mode: %s\n",
+ yytext);
+ }
+
+
%%
int