From fffca2ffa00d86b0f3a11eea066cf651486331ea Mon Sep 17 00:00:00 2001 From: John Johansen Date: Fri, 12 Jun 2020 02:05:35 -0700 Subject: [PATCH] parser: split newline and end of rule handling into separate rules Split the newline processing into a separate rule block so that it can be shared with states that need to process newlines without processing end of rule conditions. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/569 Signed-off-by: John Johansen Acked-by: Steve Beattie --- parser/parser_lex.l | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parser/parser_lex.l b/parser/parser_lex.l index c1598eff3..b2318f667 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -476,6 +476,7 @@ GT > \\\n { DUMP_PREPROCESS; current_lineno++ ; } \r?\n { + /* don't use shared rule because we need POP() here */ DUMP_PREPROCESS; current_lineno++; POP(); @@ -702,8 +703,10 @@ include/{WS} { POP_NODUMP(); RETURN_TOKEN(TOK_END_OF_RULE); } +} - \r?\n { +{ + \r?\n { DUMP_PREPROCESS; current_lineno++; }