mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-19 21:03:51 +00:00
38 lines
830 B
C++
38 lines
830 B
C++
#include <Parsers/IParserBase.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
bool IParserBase::parse(Pos & pos, ASTPtr & node, Expected & expected)
|
|
{
|
|
expected.add(pos, getName());
|
|
|
|
return wrapParseImpl(pos, IncreaseDepthTag{}, [&]
|
|
{
|
|
const char * begin = pos->begin;
|
|
bool res = parseImpl(pos, node, expected);
|
|
if (res)
|
|
{
|
|
Highlight type = highlight();
|
|
if (pos->begin > begin && type != Highlight::none)
|
|
{
|
|
Pos prev_token = pos;
|
|
--prev_token;
|
|
|
|
HighlightedRange range;
|
|
range.begin = begin;
|
|
range.end = prev_token->end;
|
|
range.highlight = type;
|
|
|
|
expected.highlight(range);
|
|
}
|
|
}
|
|
else
|
|
node = nullptr;
|
|
return res;
|
|
});
|
|
}
|
|
|
|
}
|