char SkipWhiteSpace() { while (!m_text_buffer.Eof()) { char code = Tokenizer.GetCode(m_text_buffer.Char()); switch (code) { case WhiteSpace: break; case Error: m_error = true; LogWrapper.LogError("Expression: Tokenizer.SkipWhiteSpace(), illegal character in the buffer, index = ", m_text_buffer.CurrentIndex, ", char = ", m_text_buffer.Char()); return(code); default: return(code); } m_text_buffer.NextChar(); } RecyclableObject.Recycle(m_text_buffer); m_text_buffer = null; return(Eof); }
public override bool Get(TextBuffer text_buffer) { char ch = text_buffer.Char(); switch (ch) { case '+': m_type = TokenType.PLUS; text_buffer.NextChar(); break; case '-': m_type = TokenType.MINUS; text_buffer.NextChar(); break; case '*': m_type = TokenType.STAR; text_buffer.NextChar(); break; case '/': m_type = TokenType.SLASH; text_buffer.NextChar(); break; case '(': m_type = TokenType.LEFT_PAREN; text_buffer.NextChar(); break; case ')': m_type = TokenType.RIGHT_PAREN; text_buffer.NextChar(); break; case '[': m_type = TokenType.LEFT_BRACKET; text_buffer.NextChar(); break; case ']': m_type = TokenType.RIGHT_BRACKET; text_buffer.NextChar(); break; case '.': m_type = TokenType.PERIOD; text_buffer.NextChar(); break; case ',': m_type = TokenType.COMMA; text_buffer.NextChar(); break; case '?': m_type = TokenType.QUESTION; text_buffer.NextChar(); break; case ':': m_type = TokenType.SEMICOLON; text_buffer.NextChar(); break; case '=': m_type = TokenType.EQUAL; ch = text_buffer.NextChar(); if (ch == '=') { m_type = TokenType.EQUAL_EQUAL; text_buffer.NextChar(); } break; case '!': m_type = TokenType.NOT; ch = text_buffer.NextChar(); if (ch == '=') { m_type = TokenType.NOT_EQUAL; text_buffer.NextChar(); } break; case '>': m_type = TokenType.GREATER; ch = text_buffer.NextChar(); if (ch == '=') { m_type = TokenType.GREATER_EQUAL; text_buffer.NextChar(); } break; case '<': m_type = TokenType.LESS; ch = text_buffer.NextChar(); if (ch == '=') { m_type = TokenType.LESS_EQUAL; text_buffer.NextChar(); } break; case '&': m_type = TokenType.AND_BITWISE; ch = text_buffer.NextChar(); if (ch == '&') { m_type = TokenType.AND; text_buffer.NextChar(); } break; case '|': m_type = TokenType.OR_BITWISE; ch = text_buffer.NextChar(); if (ch == '|') { m_type = TokenType.OR; text_buffer.NextChar(); } break; default: LogWrapper.LogError("Expression: SymbolToken.Get(), illegal symbol, index = ", text_buffer.CurrentIndex, ", char = ", text_buffer.Char()); m_type = TokenType.ERROR; return(false); } return(true); }