diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/agcore/keyword.h	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,67 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * keyword.h - keywords
+ */
+
+#ifndef KEYWORD_H
+#define KEYWORD_H
+
+#include "agarray.h"
+#include "register.h"
+
+
+class KeywordDescriptor; // below
+
+class Keyword : public KeyedObjectRegister<KeywordDescriptor> {
+public:
+  Keyword();
+  Keyword(const char *x);
+  Keyword(unsigned x);
+  Keyword(const Keyword &t);
+
+  static void reset();
+  static Keyword create();
+  static Keyword sorted(int x);
+  static const int first;
+
+  class Map;
+  friend class Map;
+
+  class Map {
+  public:
+    KeywordDescriptor &operator [] (unsigned x);
+  };
+
+  class Dict {
+  public:
+    Keyword add_string(const char *s);
+  };
+};
+
+#include "agstring.h"
+#include "token.h"
+#include "tree.h"
+
+class KeywordDescriptor {
+public:
+  AgString string;
+  Token token_number;
+  int reserve;
+
+  KeywordDescriptor();
+  KeywordDescriptor(const char *s);
+  int operator < (const KeywordDescriptor &d) const;
+};
+
+Keyword add_string_dict(const char *s, Keyword::Dict &d);
+
+void append_key(int kn);
+void build_key_tables(void);
+void check_key_reserve(void);
+int keyword_problem(unsigned, const AgArray<int>, Keyword);
+
+
+#endif /* KEYWORD_H */