ClickHouse/src/Parsers/CommonParsers.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
896 B
C++
Raw Normal View History

#include <Parsers/CommonParsers.h>
2021-10-02 07:13:14 +00:00
#include <base/find_symbols.h>
2016-11-20 12:43:20 +00:00
namespace DB
{
2021-12-25 12:23:00 +00:00
2021-09-06 15:59:46 +00:00
bool ParserKeyword::parseImpl(Pos & pos, [[maybe_unused]] ASTPtr & node, Expected & expected)
{
if (pos->type != TokenType::BareWord)
return false;
const char * current_word = s.begin();
while (true)
{
expected.add(pos, current_word);
2021-09-06 15:59:46 +00:00
if (pos->type != TokenType::BareWord)
return false;
2021-09-06 15:59:46 +00:00
const char * const next_whitespace = find_first_symbols<' ', '\0'>(current_word, s.end());
const size_t word_length = next_whitespace - current_word;
if (word_length != pos->size())
return false;
2020-03-18 02:02:24 +00:00
if (0 != strncasecmp(pos->begin, current_word, word_length))
return false;
++pos;
if (!*next_whitespace)
break;
current_word = next_whitespace + 1;
}
return true;
}
2021-12-25 12:23:00 +00:00
2016-11-12 17:55:40 +00:00
}