Mercurial > ~dholland > hg > ag > index.cgi
diff anagram/guisupport/tokentabdc.cpp @ 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/tokentabdc.cpp Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,85 @@ +/* + * AnaGram, A System for Syntax Directed Programming + * Copyright 1993-2002 Parsifal Software. All Rights Reserved. + * See the file COPYING for license and usage terms. + * + * tokentabdc.cpp + */ + +#include "dc.h" +#include "items.h" +#include "q1glbl.h" +#include "rule.h" +#include "stacks.h" +#include "tokentabdc.h" +#include "ut.h" +#include "ws.h" + + +static int token_table_tabs[] = {6,9,13,21,0}; + +token_table_dc::token_table_dc(void) + : dc("Token Table") +{ + tab_stops = token_table_tabs; + columnHeadTitle = "Token\tFlags\tPrec\tType\tName"; + //des->c_size = cursor_bar_size; + des->d_size.y = ntkns; + //getWidth(); + //resize_window(); +} + +void token_table_dc::getLine(unsigned ln) const { + token_number_map tm; + const char *zl; + char as; + char *ts; + char prbuf[20] = " "; + + ln++; + tm = map_token_number[ln]; + zl = tm.zero_length_flag ? "zl" : tm.non_terminal_flag ? "nt" : " "; + if (tm.precedence_level) { + as = tm.left_associative ? 'l' : tm.right_associative ? 'r' : 'n'; + sprintf(prbuf, "%c%02d", as, tm.precedence_level); + } + else if (tm.sticky) { + strcpy(prbuf, "s "); + } + //ts = dict_str(cast_dict,tm.value_type); + ts = Cast(tm.value_type)->pointer(); + ssprintf("T%03d\t%s\t%s\t(%s)\t", ln, zl, prbuf, ts); + atkn(ln); +} + +int token_table_dc::expansion_rules_ok(unsigned ln) { + return build_item_list_ok(ln+1); +} + +dc_ref token_table_dc::expansion_rules(unsigned ln) { + return build_item_list(ln+1); +} + +int token_table_dc::productions_ok(unsigned ln) { + return productions_window_ok(ln+1); +} + +dc_ref token_table_dc::productions(unsigned ln) { + return productions_window(ln+1); +} + +int token_table_dc::set_elements_ok(unsigned ln) { + return token_set_window_ok(ln+1); +} + +dc_ref token_table_dc::set_elements(unsigned ln) { + return token_set_window(ln+1); +} + +int token_table_dc::usage_ok(unsigned ln) { + return token_usage_window_ok(ln+1); +} + +dc_ref token_table_dc::usage(unsigned ln) { + return token_usage_window(ln+1); +}