Mercurial > ~dholland > hg > ag > index.cgi
diff anagram/agcore/symbol.h @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children | 607e3be6bad8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/anagram/agcore/symbol.h Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,65 @@ +/* + * AnaGram, A System for Syntax Directed Programming + * Copyright 1993-2002 Parsifal Software. All Rights Reserved. + * See the file COPYING for license and usage terms. + * + * symbol.h + */ + +#ifndef SYMBOL_H +#define SYMBOL_H + +#include "register.h" + + +class SymbolDescriptor; // below + +class Symbol : public KeyedObjectRegister<SymbolDescriptor> { +public: + Symbol() {} + Symbol(const char *x); + Symbol(unsigned x); + Symbol(const Symbol &t); + static void reset(); + static Symbol create(); + static Symbol sorted(int x); + + class Map; + friend class Map; + + class Map { + public: + SymbolDescriptor &operator [] (unsigned x); + }; + + class Dict { + public: + Symbol add_string(const char *s); + }; +}; + +#include "agstring.h" +#include "token.h" +#include "tree.h" + +class SymbolDescriptor { +public: + AgString string; + Token token_number; + unsigned token_list_id; + ParseTree parse_tree; + + SymbolDescriptor(); + SymbolDescriptor(const char *s); + int operator < (const SymbolDescriptor &d) const; +}; + +extern Symbol::Map map_token_name; +extern Symbol::Dict tkn_dict; + +typedef SymbolDescriptor token_name_map; + +Symbol add_string_dict(const char *s, Symbol::Dict &d); + + +#endif /* SYMBOL_H */