Take modutil_MySQL_bypass_whitespace into use
This commit is contained in:
@ -608,106 +608,7 @@ private:
|
||||
|
||||
void bypass_whitespace()
|
||||
{
|
||||
while (m_pI != m_pEnd)
|
||||
{
|
||||
if (isspace(*m_pI))
|
||||
{
|
||||
++m_pI;
|
||||
}
|
||||
else if (*m_pI == '/') // Might be a comment
|
||||
{
|
||||
if ((m_pI + 1 != m_pEnd) && (*(m_pI + 1) == '*')) // Indeed it was
|
||||
{
|
||||
m_pI += 2;
|
||||
|
||||
while (m_pI != m_pEnd)
|
||||
{
|
||||
if (*m_pI == '*') // Might be the end of the comment
|
||||
{
|
||||
++m_pI;
|
||||
|
||||
if (m_pI != m_pEnd)
|
||||
{
|
||||
if (*m_pI == '/') // Indeed it was
|
||||
{
|
||||
++m_pI;
|
||||
break; // Out of this inner while.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// It was not the end of the comment.
|
||||
++m_pI;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Was not a comment, so we'll bail out.
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*m_pI == '-') // Might be the start of a comment to the end of line
|
||||
{
|
||||
bool is_comment = false;
|
||||
|
||||
if (m_pI + 1 != m_pEnd)
|
||||
{
|
||||
if (*(m_pI + 1) == '-') // Might be, yes.
|
||||
{
|
||||
if (m_pI + 2 != m_pEnd)
|
||||
{
|
||||
if (isspace(*(m_pI + 2))) // Yes, it is.
|
||||
{
|
||||
is_comment = true;
|
||||
|
||||
m_pI += 3;
|
||||
|
||||
while ((m_pI != m_pEnd) && (*m_pI != '\n'))
|
||||
{
|
||||
++m_pI;
|
||||
}
|
||||
|
||||
if (m_pI != m_pEnd)
|
||||
{
|
||||
ss_dassert(*m_pI == '\n');
|
||||
++m_pI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_comment)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*m_pI == '#')
|
||||
{
|
||||
++m_pI;
|
||||
|
||||
while ((m_pI != m_pEnd) && (*m_pI != '\n'))
|
||||
{
|
||||
++m_pI;
|
||||
}
|
||||
|
||||
if (m_pI != m_pEnd)
|
||||
{
|
||||
ss_dassert(*m_pI == '\n');
|
||||
++m_pI;
|
||||
}
|
||||
|
||||
m_pI = m_pEnd;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Neither whitespace not start of a comment, so we bail out.
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_pI = modutil_MySQL_bypass_whitespace(const_cast<char*>(m_pI), m_pEnd - m_pI);
|
||||
}
|
||||
|
||||
token_t next_token(token_required_t required = TOKEN_NOT_REQUIRED)
|
||||
|
Reference in New Issue
Block a user