diff anagram/agcore/token.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/token.h	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,88 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * token.h
+ */
+
+#ifndef TOKEN_H
+#define TOKEN_H
+
+#include "register.h"
+class Rule;
+
+
+struct token_number_map;
+
+class Token : public ObjectRegister<token_number_map> {
+public:
+  Token() {}
+  Token(int x);
+  Token(const Token &t);
+  static Token create();
+  static const int first;
+  static void reset();
+  class Map;
+  friend class Map;
+  int isLeadingToken(const Token) const;
+  int isExpansionToken(const Token) const;
+  int isExpansionRule(const Rule) const;
+  Token leadingToken(int) const;
+  Token follower(int) const ;
+  Rule expansionRule(int) const;
+  Rule rule(int) const;
+
+  class Map {
+  public:
+    token_number_map &operator [] (unsigned x);
+  };
+};
+
+extern Token::Map map_token_number;
+
+#include "keyword.h"
+#include "symbol.h"
+#include "tree.h"
+
+struct token_number_map {
+  AgArray<Rule> ruleList;
+  AgArray<Token> followerList;
+  AgArray<Rule> expansionRuleList;
+  AgArray<Token> leadingTokenList;
+  //unsigned key;
+  Keyword key;
+  Symbol token_name;
+  ParseTree parse_tree;
+  unsigned
+    vp_prod_number,
+    value_type,
+    token_set_id,
+    part_number,
+    precedence_level;
+  unsigned sticky : 1;
+  unsigned zero_length_flag : 1;
+  unsigned non_terminal_flag : 1;
+  unsigned sem_det_flag : 1;
+  unsigned fine_structure: 1;
+  unsigned left_associative: 1;
+  unsigned right_associative: 1;
+  unsigned rp_arg: 1;
+  unsigned pure: 1;
+  unsigned junky: 1;
+  unsigned reserve: 1;
+  unsigned reserved_word: 1;
+  unsigned subgrammar: 1;
+  unsigned lexeme: 1;
+  unsigned lexical: 1;
+  unsigned immediate_action: 1;
+  unsigned operatorCandidate: 1;
+  unsigned disregard: 1;
+
+  token_number_map();
+  int operator < (const token_number_map &t) const {
+    return token_name < t.token_name;
+  }
+};
+
+#endif /* TOKEN_H */