Logo Search packages:      
Sourcecode: lttoolbox version File versions  Download package

int FSTProcessor::readPostgeneration ( FILE *  input  )  [private]

Read text from stream (postgeneration version)

Parameters:
input the stream to read
Returns:
the next symbol in the stream

Definition at line 147 of file fst_processor.cc.

References Buffer< T >::add(), alphabet, blankqueue, escaped_chars, input_buffer, Buffer< T >::isEmpty(), Buffer< T >::next(), readFullBlock(), and streamError().

{
  if(!input_buffer.isEmpty())
  {
    return input_buffer.next();
  }

  wchar_t val = static_cast<wchar_t>(fgetwc_unlocked(input));
  int altval = 0;
  if(feof(input))
  {
    return 0;
  }

  switch(val)
  {
    case L'<':
      altval = static_cast<int>(alphabet(readFullBlock(input, L'<', L'>')));
      input_buffer.add(altval);
      return altval;

    case L'[':
      blankqueue.push(readFullBlock(input, L'[', L']'));
      input_buffer.add(static_cast<int>(L' '));
      return static_cast<int>(L' ');
        
    case L'\\':
      val = static_cast<wchar_t>(fgetwc_unlocked(input));
      if(escaped_chars.find(val) == escaped_chars.end())
      {
        streamError();
      }
      input_buffer.add(static_cast<int>(val));
      return val;
      
    default:
      input_buffer.add(val);
      return val;
  }
}


Generated by  Doxygen 1.6.0   Back to index