comparison anagram/guisupport/conflictdc.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
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 * conflictdc.h - conflicts
7 */
8
9 #ifndef CONFLICTDC_H
10 #define CONFLICTDC_H
11
12 #include "agarray.h"
13 #include "data.h"
14 #include "dc.h"
15 #include "tsd.h"
16
17
18 class conflict_table_dc : public dc {
19 protected:
20 AgArray<int> permutation;
21 tsd *conflict_table;
22
23 public:
24
25 conflict_table_dc(void) : permutation() {}
26 conflict_table_dc(const char *name)
27 : dc(name), permutation() {}
28
29 conflict_table_dc(conflict_table_dc &x)
30 : dc(x), permutation(x.permutation) {}
31
32
33 void init(void);
34 virtual void synchCursor(unsigned) const;
35
36 unsigned sort_con(void);
37 dc_ref new_derive_token (int sn, int tn, int fn);
38
39 static MenuOption *auxTable[];
40 virtual MenuOption **getAuxWinMenu(void) { return auxTable; }
41
42 virtual dc_ref select_conflict(unsigned);
43 virtual dc_ref expansion_chain(unsigned);
44 virtual dc_ref problem_states(unsigned);
45 virtual dc_ref reduction_states(unsigned);
46 virtual dc_ref reduction_trace(unsigned);
47 virtual dc_ref rule_context(unsigned);
48 virtual dc_ref derive_rule(unsigned);
49 virtual dc_ref state_definition(unsigned);
50 virtual dc_ref state_expansion(unsigned);
51 virtual dc_ref derive_token(unsigned);
52 virtual dc_ref usage(unsigned);
53
54 virtual int expansion_chain_ok(unsigned);
55 virtual int reduction_states_ok(unsigned k);
56 virtual int derive_rule_ok(unsigned);
57 virtual int state_definition_ok(unsigned k) { return derive_rule_ok(k); }
58 virtual int state_expansion_ok(unsigned k) { return derive_rule_ok(k); }
59 virtual int usage_ok(unsigned k) { return derive_rule_ok(k); }
60
61 virtual int reduction_trace_ok(unsigned k) { return derive_rule_ok(k); }
62
63 int screen_rule(unsigned ln, int *snp, int *tnp, int *fnp, int *fxp);
64 int locate_conflict(unsigned ln, int *snp, int *tnp, int *fnp, int *fxp);
65 };
66
67 class res_con_dc : public conflict_table_dc {
68 public:
69 res_con_dc(void)
70 : conflict_table_dc("Resolved Conflicts") {
71 conflict_table = res_con;
72 init();
73 }
74 virtual void getLine(unsigned) const;
75 /*
76 virtual dc_ref onCloneKey(void) {
77 return dc_ref(new res_con_dc(*this));
78 }
79 */
80 };
81
82 class unres_con_dc : public conflict_table_dc {
83 public:
84 unres_con_dc(void)
85 : conflict_table_dc("Conflicts")
86 {
87 conflict_table = unres_con;
88 init();
89 }
90 virtual void getLine(unsigned) const;
91 /*
92 virtual dc_ref onCloneKey(void) {
93 return dc_ref(new unres_con_dc(*this));
94 }
95 */
96 };
97
98 class derivation_dc : public dc {
99 public:
100 static MenuOption *auxTable[];
101 MenuOption **getAuxWinMenu(void) {return auxTable;}
102
103 tsd *derivation;
104 int bracket;
105
106 derivation_dc(tsd* td, const AgString head, const AgString foot, int brkt);
107 derivation_dc(derivation_dc &x)
108 : dc(x), derivation(copy_tuple_set(x.derivation)), bracket(x.bracket)
109 {}
110
111 ~derivation_dc(void);
112 virtual void getLine(unsigned) const;
113 virtual void synchCursor(unsigned) const ;
114 /*
115 virtual dc_ref onCloneKey(void) {
116 return dc_ref(new derivation_dc(*this));
117 }
118 */
119
120 virtual unsigned token(unsigned);
121 virtual dc_ref expansion_rules(unsigned);
122 virtual dc_ref productions(unsigned);
123 virtual dc_ref rule_context(unsigned);
124 virtual dc_ref set_elements(unsigned);
125 virtual dc_ref usage(unsigned);
126
127 virtual int expansion_rules_ok(unsigned);
128 virtual int productions_ok(unsigned);
129 //virtual int rule_context_ok(unsigned);
130 virtual int set_elements_ok(unsigned);
131 virtual int usage_ok(unsigned);
132 };
133
134
135 dc_ref build_rule_derivation(int, int);
136
137
138 #endif /* CONFLICTDC_H */