This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

Commit ac157dd0 authored by jdev52's avatar jdev52

moved typeinfo to symboltableentry

parent 90da42e3
......@@ -17,15 +17,6 @@ using namespace std;
#define STR_OR_BOOL 6
#define INT_OR_STR_OR_BOOL 7
#define NOT_APPLICABLE -1
typedef struct
{
int type;
// one of the above type codes
int numParams;
// numParams and returnType only applicable if type == FUNCTION
int returnType;
} TYPE_INFO;
class SYMBOL_TABLE
{
......@@ -61,6 +52,16 @@ public:
else return(true);
}
SYMBOL_TABLE_ENTRY getEntry(string theName)
{
return hashTable.find(theName)->first;
}
int count()
{
return(hashTable.size());
}
};
#endif // SYMBOL_TABLE_H
......@@ -6,26 +6,41 @@ using namespace std;
#define UNDEFINED -1
typedef struct
{
int type;
// one of the above type codes
int numParams;
// numParams and returnType only applicable if type == FUNCTION
int returnType;
} TYPE_INFO;
class SYMBOL_TABLE_ENTRY
{
private:
// Member variables
string name;
int typeCode;
TYPE_INFO typeInfo;
public:
// Constructors
SYMBOL_TABLE_ENTRY( ) { name = ""; typeCode = UNDEFINED; }
SYMBOL_TABLE_ENTRY( ) {
name = "";
typeInfo.type = UNDEFINED;
typeInfo.numParams = UNDEFINED;
typeInfo.returnType = UNDEFINED;
}
SYMBOL_TABLE_ENTRY(const string theName, const int theType)
{
SYMBOL_TABLE_ENTRY(const string theName, const TYPE_INFO theType) {
name = theName;
typeCode = theType;
typeInfo.type = theType.type;
typeInfo.returnType = theType.returnType;
typeInfo.numParams = theType.numParams;
}
// Accessors
string getName() const { return name; }
int getTypeCode() const { return typeCode; }
TYPE_INFO getTypeCode() const { return typeInfo; }
};
#endif // SYMBOL_TABLE_ENTRY_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment