Mercurial > ~dholland > hg > ag > index.cgi
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/anagram/guisupport/conflictdc.h Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,138 @@ +/* + * AnaGram, A System for Syntax Directed Programming + * Copyright 1993-2002 Parsifal Software. All Rights Reserved. + * See the file COPYING for license and usage terms. + * + * conflictdc.h - conflicts + */ + +#ifndef CONFLICTDC_H +#define CONFLICTDC_H + +#include "agarray.h" +#include "data.h" +#include "dc.h" +#include "tsd.h" + + +class conflict_table_dc : public dc { +protected: + AgArray<int> permutation; + tsd *conflict_table; + +public: + + conflict_table_dc(void) : permutation() {} + conflict_table_dc(const char *name) + : dc(name), permutation() {} + + conflict_table_dc(conflict_table_dc &x) + : dc(x), permutation(x.permutation) {} + + + void init(void); + virtual void synchCursor(unsigned) const; + + unsigned sort_con(void); + dc_ref new_derive_token (int sn, int tn, int fn); + + static MenuOption *auxTable[]; + virtual MenuOption **getAuxWinMenu(void) { return auxTable; } + + virtual dc_ref select_conflict(unsigned); + virtual dc_ref expansion_chain(unsigned); + virtual dc_ref problem_states(unsigned); + virtual dc_ref reduction_states(unsigned); + virtual dc_ref reduction_trace(unsigned); + virtual dc_ref rule_context(unsigned); + virtual dc_ref derive_rule(unsigned); + virtual dc_ref state_definition(unsigned); + virtual dc_ref state_expansion(unsigned); + virtual dc_ref derive_token(unsigned); + virtual dc_ref usage(unsigned); + + virtual int expansion_chain_ok(unsigned); + virtual int reduction_states_ok(unsigned k); + virtual int derive_rule_ok(unsigned); + virtual int state_definition_ok(unsigned k) { return derive_rule_ok(k); } + virtual int state_expansion_ok(unsigned k) { return derive_rule_ok(k); } + virtual int usage_ok(unsigned k) { return derive_rule_ok(k); } + + virtual int reduction_trace_ok(unsigned k) { return derive_rule_ok(k); } + + int screen_rule(unsigned ln, int *snp, int *tnp, int *fnp, int *fxp); + int locate_conflict(unsigned ln, int *snp, int *tnp, int *fnp, int *fxp); +}; + +class res_con_dc : public conflict_table_dc { +public: + res_con_dc(void) + : conflict_table_dc("Resolved Conflicts") { + conflict_table = res_con; + init(); + } + virtual void getLine(unsigned) const; +/* + virtual dc_ref onCloneKey(void) { + return dc_ref(new res_con_dc(*this)); + } +*/ +}; + +class unres_con_dc : public conflict_table_dc { +public: + unres_con_dc(void) + : conflict_table_dc("Conflicts") + { + conflict_table = unres_con; + init(); + } + virtual void getLine(unsigned) const; +/* + virtual dc_ref onCloneKey(void) { + return dc_ref(new unres_con_dc(*this)); + } +*/ +}; + +class derivation_dc : public dc { +public: + static MenuOption *auxTable[]; + MenuOption **getAuxWinMenu(void) {return auxTable;} + + tsd *derivation; + int bracket; + + derivation_dc(tsd* td, const AgString head, const AgString foot, int brkt); + derivation_dc(derivation_dc &x) + : dc(x), derivation(copy_tuple_set(x.derivation)), bracket(x.bracket) + {} + + ~derivation_dc(void); + virtual void getLine(unsigned) const; + virtual void synchCursor(unsigned) const ; +/* + virtual dc_ref onCloneKey(void) { + return dc_ref(new derivation_dc(*this)); + } +*/ + + virtual unsigned token(unsigned); + virtual dc_ref expansion_rules(unsigned); + virtual dc_ref productions(unsigned); + virtual dc_ref rule_context(unsigned); + virtual dc_ref set_elements(unsigned); + virtual dc_ref usage(unsigned); + + virtual int expansion_rules_ok(unsigned); + virtual int productions_ok(unsigned); + //virtual int rule_context_ok(unsigned); + virtual int set_elements_ok(unsigned); + virtual int usage_ok(unsigned); +}; + + +dc_ref build_rule_derivation(int, int); + + +#endif /* CONFLICTDC_H */