ClickHouse/dbms/include/DB/Parsers/ExpressionElementParsers.h

130 lines
3.4 KiB
C
Raw Normal View History

2011-09-04 05:14:52 +00:00
#pragma once
2010-06-24 19:12:10 +00:00
#include <DB/Parsers/IParserBase.h>
namespace DB
{
class ParserArray : public IParserBase
{
protected:
String getName() { return "array"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
/** Если в скобках выражение из одного элемента - возвращает в node этот элемент;
* иначе возвращает функцию tuple от содержимого скобок.
*/
class ParserParenthesisExpression : public IParserBase
{
protected:
String getName() { return "expression in parenthesis"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
2011-11-01 17:57:37 +00:00
/** Идентификатор, например, x_yz123 или `something special`
2010-06-24 19:12:10 +00:00
*/
class ParserIdentifier : public IParserBase
{
protected:
String getName() { return "identifier"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
2011-08-18 18:48:00 +00:00
/** Функция, например, f(x, y + 1, g(z))
2010-06-24 19:12:10 +00:00
*/
class ParserFunction : public IParserBase
{
protected:
String getName() { return "function"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
/** NULL.
*/
class ParserNull : public IParserBase
{
protected:
String getName() { return "NULL"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
/** Число.
*/
class ParserNumber : public IParserBase
{
protected:
String getName() { return "number"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
/** Строка в одинарных кавычках.
*/
class ParserStringLiteral : public IParserBase
{
protected:
String getName() { return "string literal"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
/** Литерал - одно из: NULL, UInt64, Int64, Float64, String.
*/
class ParserLiteral : public IParserBase
{
protected:
String getName() { return "literal"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
2011-11-06 04:21:09 +00:00
/** Алиас - идентификатор, перед которым идёт AS. Например: AS x_yz123.
*/
class ParserAlias : public IParserBase
{
protected:
String getName() { return "alias"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
2011-08-28 08:50:27 +00:00
/** Элемент выражения - одно из: выражение в круглых скобках, массив, литерал, функция, идентификатор, звёздочка.
2010-06-24 19:12:10 +00:00
*/
class ParserExpressionElement : public IParserBase
{
protected:
String getName() { return "element of expression"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
2011-11-06 04:21:09 +00:00
/** Элемент выражения, возможно, с алиасом, если уместно.
*/
class ParserExpressionElementWithOptionalAlias : public IParserBase
{
protected:
String getName() { return "element of expression with optional alias"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
2011-09-04 05:14:52 +00:00
/** Элемент выражения ORDER BY - то же самое, что и элемент выражения, но после него ещё может быть указано ASC[ENDING] | DESC[ENDING].
*/
class ParserOrderByElement : public IParserBase
{
protected:
String getName() { return "element of ORDER BY expression"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, String & expected);
};
2010-06-24 19:12:10 +00:00
2011-09-04 05:14:52 +00:00
}