forked from OSchip/llvm-project
Fix a couple of potential issues in the lexer where we were ignoring the putback data
llvm-svn: 216304
This commit is contained in:
parent
300bdb35d4
commit
3ee335a762
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue