mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 16:50:51 +08:00
Fix a couple of potential issues in the lexer where we were ignoring the putback data
llvm-svn: 216304
This commit is contained in:
@@ -55,7 +55,9 @@ StringLexer::Next ()
|
||||
bool
|
||||
StringLexer::HasAtLeast (Size s)
|
||||
{
|
||||
return m_data.size()-m_position >= s;
|
||||
auto in_m_data = m_data.size()-m_position;
|
||||
auto in_putback = m_putback_data.size();
|
||||
return (in_m_data + in_putback >= s);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +70,10 @@ StringLexer::PutBack (Character c)
|
||||
bool
|
||||
StringLexer::HasAny (Character c)
|
||||
{
|
||||
const auto begin(m_putback_data.begin());
|
||||
const auto end(m_putback_data.end());
|
||||
if (std::find(begin, end, c) != end)
|
||||
return true;
|
||||
return m_data.find(c, m_position) != std::string::npos;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user