Exemplo n.º 1
0
	// peek
	// . Returns (but does not remove) the next token on the queue.
	Token& Scanner::peek()
	{
		EnsureTokensInQueue();
		assert(!m_tokens.empty());  // should we be asserting here? I mean, we really just be checking
		                            // if it's empty before peeking.

		return m_tokens.front();
	}
Exemplo n.º 2
0
	// pop
	// . Simply removes the next token on the queue.
	void Scanner::pop()
	{
		EnsureTokensInQueue();
		if(!m_tokens.empty()) {
			// Saved anchors shouldn't survive popping the document end marker
			if (m_tokens.front().type == Token::DOC_END) {
				ClearAnchors();
			}
			m_tokens.pop();
		}
	}
Exemplo n.º 3
0
Token& Scanner::peek() {
  EnsureTokensInQueue();
  assert(!m_tokens.empty());  // should we be asserting here? I mean, we really
                              // just be checking
                              // if it's empty before peeking.

#if 0
  static Token *pLast = 0;
  if (pLast != &m_tokens.front())
    std::cerr << "peek: " << m_tokens.front() << "\n";
  pLast = &m_tokens.front();
#endif

  return m_tokens.front();
}
Exemplo n.º 4
0
void Scanner::pop() {
  EnsureTokensInQueue();
  if (!m_tokens.empty())
    m_tokens.pop();
}
Exemplo n.º 5
0
bool Scanner::empty() {
  EnsureTokensInQueue();
  return m_tokens.empty();
}