mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-27 23:27:20 +00:00
Support for comments in rules files
This commit is contained in:
parent
ffac848c89
commit
d62ea1df24
@ -177,9 +177,11 @@ end
|
|||||||
local G = {
|
local G = {
|
||||||
V"Start", -- Entry rule
|
V"Start", -- Entry rule
|
||||||
|
|
||||||
Start = V"Skip" * (V"MacroDef" / macro + V"Rule" / rule)^-1 * -1 + report_error();
|
Start = V"Skip" * (V"Comment" + V"MacroDef" / macro + V"Rule" / rule)^-1 * -1 + report_error();
|
||||||
|
|
||||||
-- Grammar
|
-- Grammar
|
||||||
|
Comment = P"#" * P(1)^0;
|
||||||
|
|
||||||
Rule = V"Filter" / filter * ((V"Skip" * V"Pipe" * V"Skip" * (P(1)^0 / outputformat) )^-1 );
|
Rule = V"Filter" / filter * ((V"Skip" * V"Pipe" * V"Skip" * (P(1)^0 / outputformat) )^-1 );
|
||||||
|
|
||||||
Filter = V"OrExpression";
|
Filter = V"OrExpression";
|
||||||
|
@ -27,6 +27,8 @@ function bad
|
|||||||
good " "
|
good " "
|
||||||
good " a"
|
good " a"
|
||||||
good "a and b"
|
good "a and b"
|
||||||
|
good "#a and b; a and b"
|
||||||
|
good "#a and b; # ; ; a and b"
|
||||||
good "(a)"
|
good "(a)"
|
||||||
good "(a and b)"
|
good "(a and b)"
|
||||||
good "(a.a exists and b)"
|
good "(a.a exists and b)"
|
||||||
|
@ -21,7 +21,7 @@ for str in string.gmatch(arg[1], "([^;]+)") do
|
|||||||
doit(str)
|
doit(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (ast) then
|
if (ast and ast.type) then
|
||||||
compiler.parser.print_ast(ast)
|
compiler.parser.print_ast(ast)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user