Logo Search packages:      
Sourcecode: lttoolbox version File versions

unsigned short 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 146 of file FSTProcessor.C.

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();
  }

  unsigned short val = static_cast<unsigned short>(fgetc_unlocked(input));
  if(feof(input))
  {
    return 0;
  }

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

    case '[':
      blankqueue.push(readFullBlock(input, '[', ']'));
      input_buffer.add(' ');
      return static_cast<unsigned short>(' ');
        
    case '\\':
      val = static_cast<unsigned short>(fgetc_unlocked(input));
      if(escaped_chars.find(val) == escaped_chars.end())
      {
        streamError();
      }
      input_buffer.add(val);
      return val;

    default:
      input_buffer.add(val);
      return val;
  }
}


Generated by  Doxygen 1.6.0   Back to index