Signed-off-by: John Johansen <john.johan...@canonical.com>
---
 parser/parser_lex.l |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

--- 2.9-test.orig/parser/parser_lex.l
+++ 2.9-test/parser/parser_lex.l
@@ -52,7 +52,7 @@
 /* #define DEBUG */
 #ifdef DEBUG
 static int yy_top_state(void);
-#define PDEBUG(fmt, args...) printf("Lexer (Line %d) (state %s): " fmt, 
current_lineno, state_names[YY_START].c_str(), ## args)
+#define PDEBUG(fmt, args...) fprintf(stderr, "Lexer (Line %d) (state %s): " 
fmt, current_lineno, state_names[YY_START].c_str(), ## args)
 #else
 #define PDEBUG(fmt, args...)   /* Do nothing */
 #endif
@@ -70,7 +70,7 @@
 
 #define RETURN_TOKEN(X) \
 do { \
-       DUMP_AND_DEBUG("Matched: %s\n", yytext); \
+       DUMP_AND_DEBUG("Matched: '%s'   Returning(%s)\n", yytext, #X); \
        return (X); \
 } while (0)
 
@@ -277,12 +277,12 @@
                char *filename = strndup(yytext, yyleng - 1);
                include_filename(filename + 1, *filename == '<');
                free(filename);
-               yy_pop_state();
+               POP();
        }
 
        [^\<\>\" \t\n]+ {       /* filename */
                include_filename(yytext, 0);
-               yy_pop_state();
+               POP();
        }
 }
 
@@ -426,7 +426,7 @@
        \r?\n   {
                DUMP_PREPROCESS;
                current_lineno++;
-               yy_pop_state();
+               POP();
        }
 }
 
@@ -473,8 +473,7 @@
        read            { RETURN_TOKEN(TOK_READ); }
        write           { RETURN_TOKEN(TOK_WRITE); }
        {OPEN_PAREN}    {
-                       yy_push_state(LIST_VAL_MODE);
-                       RETURN_TOKEN(TOK_OPENPAREN);
+                       PUSH_AND_RETURN(LIST_VAL_MODE, TOK_OPENPAREN);
                        }
        (r|w|rw|wr)/([[:space:],])      {
                        yylval.mode = strdup(yytext);
@@ -492,8 +491,8 @@
 }
 
 #include/.*\r?\n       {
-       /* Don't use push here as we don't want #include echoed out. It needs
-        * to be handled specially
+       /* Don't use PUSH() macro here as we don't want #include echoed out.
+        * It needs to be handled specially
         */ 
        yy_push_state(INCLUDE);
 }
@@ -583,7 +582,7 @@
 <INITIAL,NETWORK_MODE,RLIMIT_MODE,MOUNT_MODE,DBUS_MODE,SIGNAL_MODE>{
        {END_OF_RULE}   {
                if (YY_START != INITIAL)
-                       yy_pop_state();
+                       POP();
                RETURN_TOKEN(TOK_END_OF_RULE);
        }
 


-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to