Mercurial > ~dholland > hg > ag > index.cgi
view anagram/guisupport/ruletabdc.cpp @ 22:5581ef01f993
Regen all the AG output.
This also fixes the line number output in the tools
(cgbigen/helpgen/help2html), apparently because those files weren't
regenerated last go.
author | David A. Holland |
---|---|
date | Mon, 13 Jun 2022 00:06:39 -0400 |
parents | 13d2b8934445 |
children |
line wrap: on
line source
/* * AnaGram, A System for Syntax Directed Programming * Copyright 1993-2002 Parsifal Software. All Rights Reserved. * See the file COPYING for license and usage terms. * * ruletabdc.cpp */ #include "dc.h" #include "items.h" #include "q1a.h" #include "q1glbl.h" #include "ruletabdc.h" #include "stacks.h" #include "token.h" #include "ut.h" #include "wm1.h" #include "ws.h" //#define INCLUDE_LOGGING #include "log.h" rule_table_dc::localize::localize(unsigned ln) { LOGSECTION("rule_table_dc::localize::localize"); int rn = 1; unsigned nc = ibnfn[1] + 1; int lc = 0; while (nc <= ln) { lc = nc; nc += ibnfn[++rn] + 1; } rule = rn; index = ln-lc; LOGV(ln) LCV(rule) LCV(index) LCV(lc) LCV(nc); } int rule_table_dc::expansion_rules_ok(unsigned ln) { localize x(ln); return build_item_list_ok(x.token()); } dc_ref rule_table_dc::expansion_rules(unsigned ln) { localize x(ln); return build_item_list(x.token()); } int rule_table_dc::productions_ok(unsigned ln) { localize x(ln); return productions_window_ok(x.token()); } dc_ref rule_table_dc::productions(unsigned ln) { localize x(ln); return productions_window(x.token()); } int rule_table_dc::usage_ok(unsigned ln) { localize x(ln); return token_usage_window_ok(x.token()); } dc_ref rule_table_dc::usage(unsigned ln) { localize x(ln); return token_usage_window(x.token()); } dc_ref rule_table_dc::rule_context(unsigned ln) { localize x(ln); return rule_context_window(x.rule); } static int rule_table_tabs[] = {7,0}; void rule_table_dc::getLine(unsigned ln) const { LOGSECTION("rule_table_dc::getLine"); localize x(ln); unsigned nt = ibnfn[x.rule]; LOGV(ln) LCV(nt); if (x.index < nt) { int tn = ibnfs[ibnfb[x.rule] + x.index]; ssprintf("T%03d:\t", tn); atkn(tn); return; } sss("\t -> "); append_item(x.rule, -1); } void rule_table_dc::synchCursor(unsigned ln) const { LOGSECTION("rule_table_dc::synchCursor"); LOGV(ln); localize x(ln); if (x.rule) { set_rule_line(x.rule); } } rule_table_dc::rule_table_dc(void) : dc("Rule Table") { int lc = 0; unsigned fn = 0; tab_stops = rule_table_tabs; columnHeadTitle = "Token\tProduction"; while (fn++ < nforms) { lc += ibnfn[fn] + 1; } des->d_size.y = lc; des->d_size.x = rule_table_tabs[1] + item_length; }