Mercurial > ~dholland > hg > ag > index.cgi
comparison 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 |
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 * tokentabdc.cpp | |
7 */ | |
8 | |
9 #include "dc.h" | |
10 #include "items.h" | |
11 #include "q1glbl.h" | |
12 #include "rule.h" | |
13 #include "stacks.h" | |
14 #include "tokentabdc.h" | |
15 #include "ut.h" | |
16 #include "ws.h" | |
17 | |
18 | |
19 static int token_table_tabs[] = {6,9,13,21,0}; | |
20 | |
21 token_table_dc::token_table_dc(void) | |
22 : dc("Token Table") | |
23 { | |
24 tab_stops = token_table_tabs; | |
25 columnHeadTitle = "Token\tFlags\tPrec\tType\tName"; | |
26 //des->c_size = cursor_bar_size; | |
27 des->d_size.y = ntkns; | |
28 //getWidth(); | |
29 //resize_window(); | |
30 } | |
31 | |
32 void token_table_dc::getLine(unsigned ln) const { | |
33 token_number_map tm; | |
34 const char *zl; | |
35 char as; | |
36 char *ts; | |
37 char prbuf[20] = " "; | |
38 | |
39 ln++; | |
40 tm = map_token_number[ln]; | |
41 zl = tm.zero_length_flag ? "zl" : tm.non_terminal_flag ? "nt" : " "; | |
42 if (tm.precedence_level) { | |
43 as = tm.left_associative ? 'l' : tm.right_associative ? 'r' : 'n'; | |
44 sprintf(prbuf, "%c%02d", as, tm.precedence_level); | |
45 } | |
46 else if (tm.sticky) { | |
47 strcpy(prbuf, "s "); | |
48 } | |
49 //ts = dict_str(cast_dict,tm.value_type); | |
50 ts = Cast(tm.value_type)->pointer(); | |
51 ssprintf("T%03d\t%s\t%s\t(%s)\t", ln, zl, prbuf, ts); | |
52 atkn(ln); | |
53 } | |
54 | |
55 int token_table_dc::expansion_rules_ok(unsigned ln) { | |
56 return build_item_list_ok(ln+1); | |
57 } | |
58 | |
59 dc_ref token_table_dc::expansion_rules(unsigned ln) { | |
60 return build_item_list(ln+1); | |
61 } | |
62 | |
63 int token_table_dc::productions_ok(unsigned ln) { | |
64 return productions_window_ok(ln+1); | |
65 } | |
66 | |
67 dc_ref token_table_dc::productions(unsigned ln) { | |
68 return productions_window(ln+1); | |
69 } | |
70 | |
71 int token_table_dc::set_elements_ok(unsigned ln) { | |
72 return token_set_window_ok(ln+1); | |
73 } | |
74 | |
75 dc_ref token_table_dc::set_elements(unsigned ln) { | |
76 return token_set_window(ln+1); | |
77 } | |
78 | |
79 int token_table_dc::usage_ok(unsigned ln) { | |
80 return token_usage_window_ok(ln+1); | |
81 } | |
82 | |
83 dc_ref token_table_dc::usage(unsigned ln) { | |
84 return token_usage_window(ln+1); | |
85 } |