comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * symbol.h
7 */
8
9 #ifndef SYMBOL_H
10 #define SYMBOL_H
11
12 #include "register.h"
13
14
15 class SymbolDescriptor; // below
16
17 class Symbol : public KeyedObjectRegister<SymbolDescriptor> {
18 public:
19 Symbol() {}
20 Symbol(const char *x);
21 Symbol(unsigned x);
22 Symbol(const Symbol &t);
23 static void reset();
24 static Symbol create();
25 static Symbol sorted(int x);
26
27 class Map;
28 friend class Map;
29
30 class Map {
31 public:
32 SymbolDescriptor &operator [] (unsigned x);
33 };
34
35 class Dict {
36 public:
37 Symbol add_string(const char *s);
38 };
39 };
40
41 #include "agstring.h"
42 #include "token.h"
43 #include "tree.h"
44
45 class SymbolDescriptor {
46 public:
47 AgString string;
48 Token token_number;
49 unsigned token_list_id;
50 ParseTree parse_tree;
51
52 SymbolDescriptor();
53 SymbolDescriptor(const char *s);
54 int operator < (const SymbolDescriptor &d) const;
55 };
56
57 extern Symbol::Map map_token_name;
58 extern Symbol::Dict tkn_dict;
59
60 typedef SymbolDescriptor token_name_map;
61
62 Symbol add_string_dict(const char *s, Symbol::Dict &d);
63
64
65 #endif /* SYMBOL_H */