예제 #1
0
파일: Lexer.cs 프로젝트: VRCMG/CumLoader
        // Peek one char ahead
        private char32 PeekChar()
        {
            if (_preview1 == null)
            {
                var saved = _current;
                NextChar();
                _preview1 = _current;
                _current  = saved;
            }

            return(_preview1.Value.CurrentChar);
        }
예제 #2
0
파일: Lexer.cs 프로젝트: VRCMG/CumLoader
 private void Reset()
 {
     // Initialize the position at -1 when starting
     _preview1 = null;
     _current  = new LexerInternalState {
         Position = new TextPosition(_reader.Start, 0, 0)
     };
     // It is important to initialize this separately from the previous line
     _current.CurrentChar = NextCharFromReader();
     _token  = new SyntaxTokenValue();
     _errors = null;
 }
예제 #3
0
파일: Lexer.cs 프로젝트: VRCMG/CumLoader
        private void NextChar()
        {
            // If we have a character in preview
            if (_preview1 != null)
            {
                _current  = _preview1.Value;
                _preview1 = null;
                return;
            }

            // Else move to the next position
            _current.Position     = _current.NextPosition;
            _current.PreviousChar = _current.CurrentChar; // save the previous character
            _current.CurrentChar  = NextCharFromReader();
        }