Provide implementation for macro arguments containing parentheses.
authorCarl Worth <cworth@cworth.org>
Fri, 14 May 2010 23:53:52 +0000 (16:53 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 14 May 2010 23:53:52 +0000 (16:53 -0700)
We were correctly parsing this already, but simply not returning any
value (for no good reason). Fortunately the fix is quite simple.

This makes the test added in the previous commit now pass.

Makefile
glcpp-parse.y

index 550945abd304ae0bdfd7ac5d7f91d9ca58120339..3fa863c49b9575cd1cb5abbff92ba535702133db 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,5 +21,5 @@ test: glcpp
        @(cd tests; ./glcpp-test)
 
 clean:
-       rm -f glcpp-lex.c glcpp-parse.c *.o *~
+       rm -f glcpp glcpp-lex.c glcpp-parse.c *.o *~
        rm -f tests/*.out tests/*.gcc tests/*.expected tests/*~
index f972ec372b84cd10b417a0e956892bd061479f62..58afd724b6a8a986d22486358366bfe5ff3917bd 100644 (file)
@@ -177,13 +177,20 @@ argument:
 |      argument word {
                _string_list_append_item ($1, $2);
                talloc_free ($2);
+               $$ = $1;
        }
 |      argument SPACE word {
                _string_list_append_item ($1, " ");
                _string_list_append_item ($1, $3);
                talloc_free ($3);
+               $$ = $1;
+       }
+|      argument '(' argument ')' {
+               _string_list_append_item ($1, "(");
+               _string_list_append_list ($1, $3);
+               _string_list_append_item ($1, ")");
+               $$ = $1;
        }
-|      argument '(' argument ')'
 ;
 
 directive_with_newline: