From cfa568f6f24c340078987386df0301fc857ec786 Mon Sep 17 00:00:00 2001 From: helly Date: Sat, 8 Apr 2006 18:42:37 +0000 Subject: [PATCH] - Add some comments - Store maxFillIndexes only once where needed --- code.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code.cc b/code.cc index fb38a711..53820f82 100644 --- a/code.cc +++ b/code.cc @@ -1255,7 +1255,7 @@ void DFA::emit(std::ostream &o, uint ind) saves[s->rule->accept] = nSaves++; } - (void) new Save(s, saves[s->rule->accept]); + (void) new Save(s, saves[s->rule->accept]); // sets s->action continue; } } @@ -1363,7 +1363,8 @@ void DFA::emit(std::ostream &o, uint ind) s->label = label++; } - uint maxFillIndexes = vFillIndexes; + // Save 'vFillIndexes' and compute information about code generation + // while writing to null device. uint orgVFillIndexes = vFillIndexes; null_stream null_dev; @@ -1373,9 +1374,10 @@ void DFA::emit(std::ostream &o, uint ind) s->emit(null_dev, ind, readCh); s->go.genGoto(null_dev, ind, s, s->next, readCh); } - maxFillIndexes = vFillIndexes; + uint maxFillIndexes = vFillIndexes; vFillIndexes = orgVFillIndexes; + // Generate prolog o << "\n" << outputFileInfo; if (hasFillLabels == false) @@ -1409,6 +1411,7 @@ void DFA::emit(std::ostream &o, uint ind) o << "yyNext:\n"; } + // Generate code for (s = head; s; s = s->next) { bool readCh = false; @@ -1416,12 +1419,14 @@ void DFA::emit(std::ostream &o, uint ind) s->go.genGoto(o, ind, s, s->next, readCh); } + // Generate epilog o << indent(--ind) << "}\n"; if (bitmap_brace) { o << indent(--ind) << "}\n"; } + // Cleanup if (BitMap::first) { delete BitMap::first; -- 2.40.0