Skip to content

Commit

Permalink
be more careful about final LUs in analysis mode (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-martian committed Oct 20, 2020
1 parent 340887b commit fb9a05f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lttoolbox/fst_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1498,8 +1498,10 @@ FSTProcessor::analysis(FILE *input, FILE *output)
bool firstupper = false, uppercase = false;
map<int, set<int> >::iterator rcx_map_ptr;

while(wchar_t val = readAnalysis(input))
wchar_t val;
do
{
val = readAnalysis(input);
// test for final states
if(current_state.isFinal(all_finals))
{
Expand Down Expand Up @@ -1627,7 +1629,10 @@ FSTProcessor::analysis(FILE *input, FILE *output)

if(current_state.size() != 0)
{
alphabet.getSymbol(sf, val);
if(val)
{
alphabet.getSymbol(sf, val);
}
}
else
{
Expand All @@ -1651,7 +1656,10 @@ FSTProcessor::analysis(FILE *input, FILE *output)
{
fputwc_unlocked(L'\\', output);
}
fputwc_unlocked(val, output);
if(val)
{
fputwc_unlocked(val, output);
}
}
}
else if(last_postblank)
Expand Down Expand Up @@ -1780,6 +1788,7 @@ FSTProcessor::analysis(FILE *input, FILE *output)
last_preblank = false;
}
}
while(val);

// print remaining blanks
flushBlanks(output);
Expand Down

0 comments on commit fb9a05f

Please sign in to comment.