mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
29 lines
591 B
C++
29 lines
591 B
C++
#include "parseIdentifierOrStringLiteral.h"
|
|
|
|
#include "ExpressionElementParsers.h"
|
|
#include "ASTLiteral.h"
|
|
#include "ASTIdentifier.h"
|
|
#include <Common/typeid_cast.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
bool parseIdentifierOrStringLiteral(IParser::Pos & pos, Expected & expected, String & result)
|
|
{
|
|
ASTPtr res;
|
|
|
|
if (!ParserIdentifier().parse(pos, res, expected))
|
|
{
|
|
if (!ParserStringLiteral().parse(pos, res, expected))
|
|
return false;
|
|
|
|
result = res->as<ASTLiteral &>().value.safeGet<String>();
|
|
}
|
|
else
|
|
result = getIdentifierName(res);
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|