From 32f8248e243d8296ff3a5a24b392a645b104abdc Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 28 Jan 2013 07:06:37 +0000 Subject: Fix shift/shift and shift/reduce errors around variadic templates since merge --- Source/CParse/parser.y | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index ed698e4ca..f5b5f6e2b 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1772,7 +1772,8 @@ static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) { %type

typemap_parm tm_list tm_tail ; %type

templateparameter ; %type templcpptype cpptype access_specifier; -%type base_specifier +%type base_specifier; +%type ellipsis variadic; %type type rawtype type_right anon_bitfield_type decltype ; %type base_list inherit raw_inherit; %type definetype def_args etype; @@ -6429,6 +6430,19 @@ exprcompound : expr PLUS expr { } ; +ellipsis : PERIOD PERIOD PERIOD { + $$ = NewString("..."); + } + ; + +variadic : ellipsis { + $$ = $1; + } + | empty { + $$ = 0; + } + ; + inherit : raw_inherit { $$ = $1; } @@ -6466,7 +6480,7 @@ base_list : base_specifier { base_specifier : opt_virtual { $$ = cparse_line; - } idcolon { + } idcolon variadic { $$ = NewHash(); Setfile($$,cparse_file); Setline($$,$2); @@ -6479,10 +6493,12 @@ base_specifier : opt_virtual { } else { Setattr($$,"access","public"); } + if ($4) + SetFlag($$, "variadic"); } | opt_virtual access_specifier { $$ = cparse_line; - } opt_virtual idcolon { + } opt_virtual idcolon variadic { $$ = NewHash(); Setfile($$,cparse_file); Setline($$,$3); @@ -6493,30 +6509,8 @@ base_specifier : opt_virtual { if (Strcmp($2,"public") != 0) { Swig_warning(WARN_PARSE_PRIVATE_INHERIT, Getfile($$), Getline($$), "%s inheritance from base '%s' (ignored).\n", $2, SwigType_namestr($5)); } - } - | opt_virtual idcolon PERIOD PERIOD PERIOD { /* Variadic inheritance */ - $$ = NewHash(); - Setfile($$,cparse_file); - Setline($$,cparse_line); - Setattr($$,"name",$2); - if (last_cpptype && (Strcmp(last_cpptype,"struct") != 0)) { - Setattr($$,"access","private"); - Swig_warning(WARN_PARSE_NO_ACCESS,cparse_file,cparse_line, - "No access specifier given for base class %s (ignored).\n",$2); - } else { - Setattr($$,"access","public"); - } - } - | opt_virtual access_specifier opt_virtual idcolon PERIOD PERIOD PERIOD { /* Variadic inheritance */ - $$ = NewHash(); - Setfile($$,cparse_file); - Setline($$,cparse_line); - Setattr($$,"name",$4); - Setattr($$,"access",$2); - if (Strcmp($2,"public") != 0) { - Swig_warning(WARN_PARSE_PRIVATE_INHERIT, cparse_file, - cparse_line,"%s inheritance ignored.\n", $2); - } + if ($6) + SetFlag($$, "variadic"); } ; -- cgit v1.2.1