Index: branches/apertium-separable/src/lsx_processor.cc =================================================================== --- branches/apertium-separable/src/lsx_processor.cc (revision 80941) +++ branches/apertium-separable/src/lsx_processor.cc (revision 80942) @@ -27,7 +27,7 @@ { if(argc != 2) { - wcout << L"./lsx-proc " << endl; + wcout << L"./lsx-comp " << endl; exit(0); } @@ -86,6 +86,7 @@ vector new_states; vector alive_states; + list blanks; alive_states.push_back(*initial_state); @@ -148,8 +149,10 @@ continue; } - if(val == L'<' && !outOfWord) // tag + if(!outOfWord) { + if(val == L'<') // tag + { wstring tag = readFullBlock(input, L'<', L'>'); if(!alphabet.isSymbolDefined(tag)) { @@ -158,9 +161,11 @@ val = static_cast(alphabet(tag)); in += tag; } - else if(!outOfWord) + else { in += (wchar_t) val; + } + new_states.clear(); wstring res = L""; for(vector::const_iterator it = alive_states.begin(); it != alive_states.end(); it++) @@ -173,7 +178,7 @@ } else if(val > 0) { - s.step_override(val, alphabet(L""), val); // deal with cases! + s.step_override(val, alphabet(L""), val); // FIXME deal with cases! } if(s.size() > 0) @@ -191,38 +196,49 @@ for (int i=0; i < (int) out.size(); i++) { wchar_t c = out[i]; - if(c == L'/') - { - out[i] = L'^'; + /* FIXME these hacks */ + // if(c == L'/') + // { + // out[i] = L'^'; + // } + // else if(c == L'$') + // { + // out[i-1] = L'$'; + // out[i] = L' '; + // out[i+1] = L'^'; + // } } - else if(c == L'$') - { - out[i-1] = L'$'; - out[i] = L' '; - out[i+1] = L'^'; - } - } out = out.substr(0, out.length()-3); // remove extra trailing '$ ^' : '^ ' is excess, '$' will be added in the next loop with fputws(in,output) - if(leading) { - fputwc(L' ', output); - } + /* FIXME another hack */ + // if(leading) { + // fputwc(L' ', output); + // } fputws(out.c_str(), output); } } alive_states.swap(new_states); } - - if(outOfWord) // need to deal with superblank stuff + else if(outOfWord) // FIXME need to deal with superblank stuff { + if(val == L'[') // tag + { + wstring blank = readFullBlock(input, L'[', L']'); + blanks.push_back(blank); + } + else + { fputwc(val, output); continue; } } - - if (!finalFound) - { - fputws(in.c_str(), output); } + /* FIXME removed */ + // if (!finalFound) + // { + // fputws(in.c_str(), output); + // fflush(output); + // wcout << in; + // } return 0; -} +} \ No newline at end of file