mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
dbms: development.
This commit is contained in:
parent
c788fd5bcc
commit
e3d91b90f2
@ -31,7 +31,8 @@ namespace DB
|
||||
*/
|
||||
namespace ExpressionGrammarTypes
|
||||
{
|
||||
typedef boost::variant<UInt64, Int64, Float64> NumberConstant; /// 1, -1, 0.1
|
||||
/// с тем, какой конкретно тип у числа, будем разбираться потом
|
||||
typedef Float64 NumberConstant; /// 1, -1, 0.1
|
||||
typedef String StringConstant; /// 'abc', 'ab\'c', 'abc\\'
|
||||
typedef Null NullConstant; /// NULL, null, NuLl
|
||||
|
||||
@ -103,7 +104,7 @@ struct ExpressionGrammar : qi::grammar<Iterator, ExpressionGrammarTypes::Express
|
||||
name %= raw[lexeme[alpha >> -*(alnum | '_')]];
|
||||
constant %= number | string | null;
|
||||
function %= name >> '(' >> expression >> ')';
|
||||
number %= ulong_long | long_long | double_;
|
||||
number %= double_;
|
||||
null = eps[_val = boost::none] >> no_case["NULL"];
|
||||
string %= raw[lexeme['\'' >> *((char_ - (char_('\\') | '\'')) | (char_('\'') >> char_)) >> '\'']];
|
||||
}
|
||||
|
@ -12,31 +12,12 @@ namespace ascii = boost::spirit::ascii;
|
||||
|
||||
typedef DB::ExpressionGrammarTypes::Expression Expr;
|
||||
|
||||
class dumpNumber : public boost::static_visitor<>
|
||||
{
|
||||
public:
|
||||
void operator() (const DB::UInt64 & x) const
|
||||
{
|
||||
std::cout << "UInt64: " << x << std::endl;
|
||||
}
|
||||
|
||||
void operator() (const DB::Int64 & x) const
|
||||
{
|
||||
std::cout << "Int64: " << x << std::endl;
|
||||
}
|
||||
|
||||
void operator() (const DB::Float64 & x) const
|
||||
{
|
||||
std::cout << "Float64: " << x << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
class dumpConst : public boost::static_visitor<>
|
||||
{
|
||||
public:
|
||||
void operator() (const DB::ExpressionGrammarTypes::NumberConstant & x) const
|
||||
{
|
||||
boost::apply_visitor(dumpNumber(), x);
|
||||
std::cout << "Number: " << x << std::endl;
|
||||
}
|
||||
|
||||
void operator() (const DB::ExpressionGrammarTypes::StringConstant & x) const
|
||||
|
Loading…
Reference in New Issue
Block a user