summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-14 16:53:52 -0700
committerCarl Worth <cworth@cworth.org>2010-05-14 16:53:52 -0700
commit3596bb149e107ad12df4fee0723caf91819c0758 (patch)
treed4d0baece7e4c711345f8af176b1c7c948b35f3c
parentf6ae186cfd2c7006656ac55446247b569b92a721 (diff)
Provide implementation for macro arguments containing parentheses.
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.
-rw-r--r--Makefile2
-rw-r--r--glcpp-parse.y9
2 files changed, 9 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 550945abd3..3fa863c49b 100644
--- 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/*~
diff --git a/glcpp-parse.y b/glcpp-parse.y
index f972ec372b..58afd724b6 100644
--- a/glcpp-parse.y
+++ b/glcpp-parse.y
@@ -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: