summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-13 12:58:49 -0700
committerCarl Worth <cworth@cworth.org>2010-05-14 09:53:50 -0700
commit7f9aa36bbcf457e1a221ab6447de3bec30908000 (patch)
treec06229bad590f84b5dcfb5ec669dfefa5816ed75
parent30140733112b09d531d949a9bfbd9daf0cae4781 (diff)
Fix case of a macro formal parameter matching a defined macro.
Simply need to allow for a macro name to appear in the parameter list. This makes the recently-added test pass.
-rw-r--r--glcpp-parse.y12
1 files changed, 9 insertions, 3 deletions
diff --git a/glcpp-parse.y b/glcpp-parse.y
index 4b4a754f82..1b6c939a26 100644
--- a/glcpp-parse.y
+++ b/glcpp-parse.y
@@ -93,7 +93,7 @@ _list_length (list_t *list);
%lex-param {void *scanner}
%token DEFINE FUNC_MACRO IDENTIFIER NEWLINE OBJ_MACRO SPACE TOKEN UNDEF
-%type <str> FUNC_MACRO IDENTIFIER OBJ_MACRO TOKEN word word_or_symbol
+%type <str> FUNC_MACRO IDENTIFIER identifier_perhaps_macro OBJ_MACRO TOKEN word word_or_symbol
%type <list> argument argument_list parameter_list replacement_list
%%
@@ -215,18 +215,24 @@ parameter_list:
/* empty */ {
$$ = _list_create (parser);
}
-| IDENTIFIER {
+| identifier_perhaps_macro {
$$ = _list_create (parser);
_list_append_item ($$, $1);
talloc_free ($1);
}
-| parameter_list ',' IDENTIFIER {
+| parameter_list ',' identifier_perhaps_macro {
_list_append_item ($1, $3);
talloc_free ($3);
$$ = $1;
}
;
+identifier_perhaps_macro:
+ IDENTIFIER { $$ = $1; }
+| FUNC_MACRO { $$ = $1; }
+| OBJ_MACRO { $$ = $1; }
+;
+
word_or_symbol:
word { $$ = $1; }
| '(' { $$ = xtalloc_strdup (parser, "("); }