W401 Flag that is never set or never testedΒΆ
A flag does something only where one place sets it with %on and another tests it with %if. This flag lacks one of the two. Never set, it is clear everywhere, so every test of it gives the same answer. Never tested, setting it changes no test. It only keeps apart the results that the parser remembers and the left recursions it grows, which hold for the flags they were found with: a rule called inside the %on starts anew where it was called outside it, and a left recursion that runs through the %on does not grow. Clearing a flag with %off is neither setting nor testing it.
start: line*
line: (NAME | group)+ NEWLINE
group: "(" %on(bracket, NAME* ")")
NAME: [a-z]+
NEWLINE: "\n"
%ignore " "
%flag bracket
grammar.fpeg:7:7: warning[W401]: the flag bracket is set with %on and never tested with %if
Add the missing half, or remove the flag. Here the flag was meant to let a group run over several lines.
start: line*
line: (NAME | group)+ NEWLINE
group: "(" %on(bracket, NAME* ")")
NAME: [a-z]+
NEWLINE: "\n"
%ignore " " | %if(bracket) "\n"
%flag bracket