ID and POST_VAR_ID define a set of characters that is reused, pull this out to avoid making mistakes when updating the character set.
Signed-off-by: John Johansen <john.johan...@canonical.com> --- parser/parser_lex.l | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/parser/parser_lex.l b/parser/parser_lex.l index 1d59f43..a246d9f 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -179,12 +179,18 @@ MODE_CHARS ([RrWwaLlMmkXx])|(([Pp]|[Cc])[Xx])|(([Pp]|[Cc])?([IiUu])[Xx]) MODES {MODE_CHARS}+ WS [[:blank:]] NUMBER [[:digit:]]+ -ID [^ \t\n"!,]|(,[^ \t\n"!]) -POST_VAR_ID [^ =\+\t\n"!,]|(,[^ =\+\t\n"!]) -IP {NUMBER}\.{NUMBER}\.{NUMBER}\.{NUMBER} + +ID_CHARS [^ \t\n"!,] +ID {ID_CHARS}|(,{ID_CHARS}) +IDS {ID}+ +POST_VAR_ID_CHARS [^ \t\n"!,]{-}[=\+] +POST_VAR_ID {POST_VAR_ID_CHARS}|(,{POST_VAR_ID_CHARS}) + ALLOWED_QUOTED_ID [^\0"]|\\\" QUOTED_ID \"{ALLOWED_QUOTED_ID}*\" +IP {NUMBER}\.{NUMBER}\.{NUMBER}\.{NUMBER} + HAT hat{WS}* PROFILE profile{WS}* KEYWORD [[:alpha:]_]+ @@ -246,9 +252,9 @@ LT_EQUAL <= } <SUB_NAME>{ - ({ID}+|{QUOTED_ID}) { + ({IDS}|{QUOTED_ID}) { /* Ugh, this is a gross hack. I used to use - * {ID}+ to match all TOK_IDs, but that would + * {IDS} to match all TOK_IDs, but that would * also match TOK_MODE + TOK_END_OF_RULE * without any spaces in between (because it's * a longer match). So now, when I want to @@ -311,7 +317,7 @@ LT_EQUAL <= <ASSIGN_MODE>{ {WS}+ { DUMP_PREPROCESS; /* Eat whitespace */ } - ({ID}+|{QUOTED_ID}) { + ({IDS}|{QUOTED_ID}) { DUMP_PREPROCESS; yylval.var_val = processid(yytext, yyleng); PDEBUG("Found assignment value: \"%s\"\n", yylval.var_val); @@ -341,7 +347,7 @@ LT_EQUAL <= <NETWORK_MODE>{ {WS}+ { DUMP_PREPROCESS; /* Eat whitespace */ } - {ID}+ { + {IDS} { DUMP_PREPROCESS; yylval.id = strdup(yytext); return TOK_ID; @@ -371,9 +377,9 @@ LT_EQUAL <= return TOK_ARROW; } - ({ID}+|{QUOTED_ID}) { + ({IDS}|{QUOTED_ID}) { /* Ugh, this is a gross hack. I used to use - * {ID}+ to match all TOK_IDs, but that would + * {IDS} to match all TOK_IDs, but that would * also match TOK_MODE + TOK_END_OF_RULE * without any spaces in between (because it's * a longer match). So now, when I want to -- 1.7.9 -- AppArmor mailing list AppArmor@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor