From 1f69bcb67fad8920867120b8ad310b5f60a7cc62 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 30 Jun 2011 19:03:48 +0200 Subject: milestone: first shot at rules to read old config file objects --- grammar/debian.conf | 2 ++ grammar/rscript.l | 33 +++++++++++++++++++++++++++++++-- 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 %} @@ -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); } + +\* | +-\/[^ \t\n]+ | +\|[^ \t\n]+ | +\/[^ \t\n]+ { printf("old style action: '%s'\n", yytext); + BEGIN INITIAL; + } +[ \t\n] +.|\n { printf("invalid sequence in OLDACT mode: %s\n", + yytext); + } + + %% int -- cgit v1.2.3