Logo Search packages:      
Sourcecode: lttoolbox version File versions

unsigned short FSTProcessor::readSAO ( FILE *  input  )  [private]

Read text from stream (SAO version)

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

Definition at line 1330 of file FSTProcessor.C.

References Buffer< T >::add(), blankqueue, escaped_chars, input_buffer, Buffer< T >::isEmpty(), isEscaped(), 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;
  }

  if(escaped_chars.find(val) != escaped_chars.end())
  {
    if(val == '<')
    {
      string str = readFullBlock(input, '<', '>');
      if(str.substr(0, 9) == "<![CDATA[")
      {
        while(str.substr(str.size()-3) != "]]>")
        {
          str.append(readFullBlock(input, '<', '>').substr(1));
        }
        blankqueue.push(str);
        input_buffer.add(' ');
        return static_cast<unsigned short>(' ');
      }
      else
      {
        streamError();
      }
    }
    else if (val == '\\') {
      val = static_cast<unsigned short>(fgetc_unlocked(input));
      if(isEscaped(val))
      {
        input_buffer.add(val);
        return val;
      }
      else
        streamError();
    }
    else
    {
      streamError();
    }                   
  }

  input_buffer.add(val);
  return val;
}


Generated by  Doxygen 1.6.0   Back to index