Exemple #1
0
        public Token Read()
        {
            if (!_selfClosingFlagAcknowledged)
            {
                Error("Self closing flag not acknowledged");
                _selfClosingFlagAcknowledged = true;
            }

            while (!_isEmitPending)
            {
                _state.Read(this, _reader);
            }

            // if emit is pending, a non-character token was found: return any chars in buffer, and leave token for next read:
            if (_charBuffer.Length > 0)
            {
                string str = _charBuffer.ToString();
                _charBuffer.Remove(0, _charBuffer.Length);
                return(new Token.Character(str));
            }
            else
            {
                _isEmitPending = false;
                return(_emitPending);
            }
        }
Exemple #2
0
 internal Token Read()
 {
     if (!selfClosingFlagAcknowledged)
     {
         Error("Self closing flag not acknowledged");
         selfClosingFlagAcknowledged = true;
     }
     while (!isEmitPending)
     {
         state.Read(this, reader);
     }
     // if emit is pending, a non-character token was found: return any chars in buffer, and leave token for next read:
     if (charsBuilder.Length > 0)
     {
         String str = charsBuilder.ToString();
         charsBuilder.Delete(0, charsBuilder.Length);
         charsString = null;
         return(charPending.Data(str));
     }
     else
     {
         if (charsString != null)
         {
             Token token = charPending.Data(charsString);
             charsString = null;
             return(token);
         }
         else
         {
             isEmitPending = false;
             return(emitPending);
         }
     }
 }