third attempo to commit, same changes, ie director + nested but no extra shift/reduce

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6518 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-10-26 06:53:04 +00:00
commit 0a1dd2a422
2 changed files with 8 additions and 9 deletions

View file

@ -9,7 +9,6 @@ class A { int x; };
class B { class B {
class C { int y; }; //generates a warning class C { int y; }; //generates a warning
class D : public A { int z; }; //ok class D : public A { int z; }; //ok
class E : public A { int z; } e; //ok
}; };
%} %}

View file

@ -3559,27 +3559,27 @@ cpp_nested : storage_class cpptype ID LBRACE { cparse_start_line = cparse_line;
} }
} }
/***** /*****
This fix derived_nested.i, but it introduces an extra shift/reduce, This fix derived_nested.i, but it is limited. Anyway, we are
should we keep it? waiting for the nested class support.
*****/ *****/
| storage_class cpptype ID COLON base_list LBRACE { cparse_start_line = cparse_line; skip_balanced('{','}'); | storage_class cpptype declarator COLON base_list LBRACE { cparse_start_line = cparse_line; skip_balanced('{','}');
} nested_decl SEMI { } SEMI {
$$ = 0; $$ = 0;
if (cplus_mode == CPLUS_PUBLIC) { if (cplus_mode == CPLUS_PUBLIC) {
if (strcmp($2,"class") == 0) { if (strcmp($2,"class") == 0) {
Swig_warning(WARN_PARSE_NESTED_CLASS,cparse_file, cparse_line,"Nested class not currently supported (ignored)\n"); Swig_warning(WARN_PARSE_NESTED_CLASS,cparse_file, cparse_line,"Nested class not currently supported (ignored)\n");
/* Generate some code for a new class */ /* Generate some code for a new class */
} else if ($8.id) { } else if ($3.id) {
/* Generate some code for a new class */ /* Generate some code for a new class */
Nested *n = (Nested *) malloc(sizeof(Nested)); Nested *n = (Nested *) malloc(sizeof(Nested));
n->code = NewString(""); n->code = NewString("");
Printv(n->code, "typedef ", $2, " " , Printv(n->code, "typedef ", $2, " " ,
Char(scanner_ccode), " $classname_", $8.id, ";\n",NIL); Char(scanner_ccode), " $classname_", $3.id, ";\n",NIL);
n->name = Swig_copy_string($8.id); n->name = Swig_copy_string($3.id);
n->line = cparse_start_line; n->line = cparse_start_line;
n->type = NewString(""); n->type = NewString("");
n->kind = $2; n->kind = $2;
SwigType_push(n->type,$8.type); SwigType_push(n->type,$3.type);
n->next = 0; n->next = 0;
add_nested(n); add_nested(n);
} else { } else {