Example #1
0
 private void ReadIntoNext()
 {
     if (!_next.AtEOF())
     {
         _nextCursor++;
         _next = _cps.Read();
     }
 }
Example #2
0
        public void Advance()
        {
            if (!_curr.AtEOF(  ))
            {
                _cursor       = _nextCursor;
                _curr         = _next;
                _currLineMark = _nextLineMark;
                ReadIntoNext( );

                switch (_curr.Value)
                {
                case '\r':
                    _curr = new CodePoint(( byte )'\n');
                    if (_next.Value == '\n')
                    {
                        ReadIntoNext( );
                    }
                    goto case '\n';

                case '\n':
                    _line++;
                    _nextLineMark     = _nextCursor;
                    _indentationLevel = 0;
                    _nonBlankSeen     = false;
                    HandlePPDirectivesFromNormalMode( );
                    break;

                case ' ':
                    _indentationLevel++;
                    break;

                case '\t':
                    if ((_indentationLevel & 7) != 0)
                    {
                        throw new CompilationException("tab after space is illegal for indentation");
                    }
                    _indentationLevel += 8;                             // tab level
                    break;

                default:
                    _nonBlankSeen = true;
                    break;
                }
            }
        }