comparison anagram/agcore/keyword.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 * keyword.h - keywords
7 */
8
9 #ifndef KEYWORD_H
10 #define KEYWORD_H
11
12 #include "agarray.h"
13 #include "register.h"
14
15
16 class KeywordDescriptor; // below
17
18 class Keyword : public KeyedObjectRegister<KeywordDescriptor> {
19 public:
20 Keyword();
21 Keyword(const char *x);
22 Keyword(unsigned x);
23 Keyword(const Keyword &t);
24
25 static void reset();
26 static Keyword create();
27 static Keyword sorted(int x);
28 static const int first;
29
30 class Map;
31 friend class Map;
32
33 class Map {
34 public:
35 KeywordDescriptor &operator [] (unsigned x);
36 };
37
38 class Dict {
39 public:
40 Keyword add_string(const char *s);
41 };
42 };
43
44 #include "agstring.h"
45 #include "token.h"
46 #include "tree.h"
47
48 class KeywordDescriptor {
49 public:
50 AgString string;
51 Token token_number;
52 int reserve;
53
54 KeywordDescriptor();
55 KeywordDescriptor(const char *s);
56 int operator < (const KeywordDescriptor &d) const;
57 };
58
59 Keyword add_string_dict(const char *s, Keyword::Dict &d);
60
61 void append_key(int kn);
62 void build_key_tables(void);
63 void check_key_reserve(void);
64 int keyword_problem(unsigned, const AgArray<int>, Keyword);
65
66
67 #endif /* KEYWORD_H */