Skip to content

Commit

Permalink
Fixing null flush for lsx
Browse files Browse the repository at this point in the history
  • Loading branch information
xavivars committed Mar 9, 2019
1 parent 59e66e6 commit 85fbf5c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lttoolbox/fst_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -882,22 +882,19 @@ FSTProcessor::lsx(FILE *input, FILE *output)

alive_states.push_back(initial_state);

while(!feof(input))
{
int val = fgetwc_unlocked(input);
int val = -1;

if (val == 0) {
blankqueue.push(blank);
break;
}
while(!feof(input) && val != 0)
{
val = fgetwc_unlocked(input);

if(val == L'+' && isEscaped(val) && !outOfWord)
{
val = L'$';
plus_thing = true;
}

if((val == L'^' && isEscaped(val) && outOfWord) || feof(input))
if((val == L'^' && isEscaped(val) && outOfWord) || feof(input) || val == 0)
{
blankqueue.push(blank);

Expand Down Expand Up @@ -940,15 +937,15 @@ FSTProcessor::lsx(FILE *input, FILE *output)
continue;
}

//wcerr << L"\n[!] " << (wchar_t)val << L" ||| " << outOfWord << endl;
// wcerr << L"\n[!] " << (wchar_t)val << L" ||| " << outOfWord << endl;

if(outOfWord)
{
blank += val;
continue;
}

if((feof(input) || val == L'$') && !outOfWord) // && isEscaped(val)
if((val == 0 || feof(input) || val == L'$') && !outOfWord) // && isEscaped(val)
{
new_states.clear();
for(vector<State>::const_iterator it = alive_states.begin(); it != alive_states.end(); it++)
Expand Down

0 comments on commit 85fbf5c

Please sign in to comment.