Added constructor

This commit is contained in:
waldemar%netscape.com 2000-01-25 22:59:28 +00:00
parent 599c4a7106
commit 131c15eedd
4 changed files with 26 additions and 2 deletions

View File

@ -31,3 +31,9 @@ JS::StringAtom &JS::StringAtomTable::operator[](const String &s)
else
return ht.insert(r, s);
}
JS::World::World()
{
initKeywords(*this);
}

View File

@ -22,6 +22,7 @@
#include "utilities.h"
#include "hash.h"
#include "parser.h"
namespace JavaScript {
@ -35,7 +36,9 @@ namespace JavaScript {
class StringAtom: public String {
public:
explicit StringAtom(const String &s): String(s) {}
Token::Kind tokenKind; // Token::Kind if this is a keyword; Token::Id if not
explicit StringAtom(const String &s): String(s), tokenKind(Token::Id) {}
private:
StringAtom(const StringAtom&); // No copy constructor
void operator=(const StringAtom&); // No assignment operator
@ -55,7 +58,10 @@ namespace JavaScript {
class World {
public:
StringAtomTable identifiers;
World();
};
}
#endif

View File

@ -31,3 +31,9 @@ JS::StringAtom &JS::StringAtomTable::operator[](const String &s)
else
return ht.insert(r, s);
}
JS::World::World()
{
initKeywords(*this);
}

View File

@ -22,6 +22,7 @@
#include "utilities.h"
#include "hash.h"
#include "parser.h"
namespace JavaScript {
@ -35,7 +36,9 @@ namespace JavaScript {
class StringAtom: public String {
public:
explicit StringAtom(const String &s): String(s) {}
Token::Kind tokenKind; // Token::Kind if this is a keyword; Token::Id if not
explicit StringAtom(const String &s): String(s), tokenKind(Token::Id) {}
private:
StringAtom(const StringAtom&); // No copy constructor
void operator=(const StringAtom&); // No assignment operator
@ -55,7 +58,10 @@ namespace JavaScript {
class World {
public:
StringAtomTable identifiers;
World();
};
}
#endif