[eros-cvs] cvs commit: eros/src/base/cross/bin/capidl SymTab.cxx SymTab.hxx gram.y
shap@eros.cs.jhu.edu
shap@eros.cs.jhu.edu
Wed, 31 Jan 2001 18:00:48 -0500
shap 01/01/31 18:00:48
Modified: src/base/cross/bin/capidl SymTab.cxx SymTab.hxx gram.y
Log:
Checkin of intermediate state so I can examine Charlie's patch
Revision Changes Path
1.5 +1 -0 eros/src/base/cross/bin/capidl/SymTab.cxx
Index: SymTab.cxx
===================================================================
RCS file: /cvs/eros/src/base/cross/bin/capidl/SymTab.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SymTab.cxx 2001/01/25 03:30:20 1.4
+++ SymTab.cxx 2001/01/31 23:00:48 1.5
@@ -92,6 +92,7 @@
Symbol::Symbol(const InternedString &nm, SymClass sc)
{
name = nm;
+ qualifiedName = nm; /* until otherwise proven */
cls = sc;
type = 0; /* unknown type */
mpz_init(v.i);
1.6 +10 -0 eros/src/base/cross/bin/capidl/SymTab.hxx
Index: SymTab.hxx
===================================================================
RCS file: /cvs/eros/src/base/cross/bin/capidl/SymTab.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SymTab.hxx 2001/01/31 19:07:31 1.5
+++ SymTab.hxx 2001/01/31 23:00:48 1.6
@@ -61,10 +61,12 @@
sc_formal, /* formal parameter name */
sc_outformal, /* OUT formal parameter name */
sc_exception, /* exception name */
+ sc_interface, /* interface name */
};
struct Symbol {
InternedString name;
+ InternedString qualifiedName;
Symbol *parent; /* containing scope */
Symbol *next; /* in same scope */
@@ -126,6 +128,14 @@
void Dump();
public:
void DumpTree(int indent = 0);
+
+ inline bool IsTypeSymbol()
+ {
+ return (cls == sc_enum ||
+ cls == sc_primtype ||
+ cls == sc_interface);
+ }
+
};
1.7 +16 -1 eros/src/base/cross/bin/capidl/gram.y
Index: gram.y
===================================================================
RCS file: /cvs/eros/src/base/cross/bin/capidl/gram.y,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- gram.y 2001/01/31 19:07:31 1.6
+++ gram.y 2001/01/31 23:00:48 1.7
@@ -277,6 +277,12 @@
}
| OPSCOPE ident { /* global? */
$$ = GlobalScope->LookupChild($2.is);
+ char *nm =
+ new char [strlen($2.is.str()) + strlen("::") + 1];
+ strcpy(nm, "::");
+ strcat(nm, $2.is.str());
+ $$->qualifiedName = nm;
+ delete nm;
}
| scoped_name OPSCOPE ident { /* qualified */
/* NOTE that yacc does not deal well with left recursion,
@@ -612,13 +618,22 @@
* reasonable. Let's say 0..255.
*/
switch_type:
- integer_type /* subranges of INTEGER */
+ integer_type /* subranges of INTEGER */ {
+ $$ = $1;
+ }
| char_type /* subranges of Unicode WCHAR */ {
+ $$ = $1;
}
| BOOLEAN /* TRUE or FALSE */ {
$$ = KeywordScope->LookupChild(".bool");
}
| scoped_name { /* must name one of the other switch_types */
+ if (! $1->IsTypeSymbol() ) {
+ Diag::printf("%s:%d: not a type name: %s\n",
+ current_file.str(), current_line,
+ $1->qualifiedName.str());
+ $$ = $1;
+ }
}
;