indenting
This commit is contained in:
30
parser.cpp
30
parser.cpp
@@ -433,39 +433,39 @@ namespace usql {
|
|||||||
|
|
||||||
// function call
|
// function call
|
||||||
if (token_typcol == TokenType::identifier && m_lexer.nextTokenType() == TokenType::open_paren) {
|
if (token_typcol == TokenType::identifier && m_lexer.nextTokenType() == TokenType::open_paren) {
|
||||||
std::string function_name = m_lexer.consumeToken(TokenType::identifier).token_string;
|
std::string function_name = m_lexer.consumeToken(TokenType::identifier).token_string;
|
||||||
std::vector<std::unique_ptr<Node>> pars;
|
std::vector<std::unique_ptr<Node>> pars;
|
||||||
|
|
||||||
m_lexer.skipToken(TokenType::open_paren);
|
m_lexer.skipToken(TokenType::open_paren);
|
||||||
while (m_lexer.tokenType() != TokenType::close_paren && m_lexer.tokenType() != TokenType::eof) {
|
while (m_lexer.tokenType() != TokenType::close_paren && m_lexer.tokenType() != TokenType::eof) {
|
||||||
pars.push_back(parse_expression());
|
pars.push_back(parse_expression());
|
||||||
m_lexer.skipTokenOptional(TokenType::comma);
|
m_lexer.skipTokenOptional(TokenType::comma);
|
||||||
}
|
}
|
||||||
m_lexer.skipToken(TokenType::close_paren);
|
m_lexer.skipToken(TokenType::close_paren);
|
||||||
return std::make_unique<FunctionNode>(function_name, std::move(pars));
|
return std::make_unique<FunctionNode>(function_name, std::move(pars));
|
||||||
}
|
}
|
||||||
|
|
||||||
// numbers and strings
|
// numbers and strings
|
||||||
std::string tokenString = m_lexer.consumeToken().token_string;
|
std::string tokenString = m_lexer.consumeToken().token_string;
|
||||||
|
|
||||||
if (token_typcol == TokenType::int_number)
|
if (token_typcol == TokenType::int_number)
|
||||||
return std::make_unique<IntValueNode>(std::stoi(tokenString));
|
return std::make_unique<IntValueNode>(std::stoi(tokenString));
|
||||||
if (token_typcol == TokenType::double_number)
|
if (token_typcol == TokenType::double_number)
|
||||||
return std::make_unique<DoubleValueNode>(std::stod(tokenString));
|
return std::make_unique<DoubleValueNode>(std::stod(tokenString));
|
||||||
if (token_typcol == TokenType::string_literal)
|
if (token_typcol == TokenType::string_literal)
|
||||||
return std::make_unique<StringValueNode>(tokenString);
|
return std::make_unique<StringValueNode>(tokenString);
|
||||||
|
|
||||||
// db column
|
// db column
|
||||||
if (token_typcol == TokenType::identifier)
|
if (token_typcol == TokenType::identifier)
|
||||||
return std::make_unique<DatabaseValueNode>(tokenString);
|
return std::make_unique<DatabaseValueNode>(tokenString);
|
||||||
|
|
||||||
// null
|
// null
|
||||||
if (token_typcol == TokenType::keyword_null)
|
if (token_typcol == TokenType::keyword_null)
|
||||||
return std::make_unique<NullValueNode>();
|
return std::make_unique<NullValueNode>();
|
||||||
|
|
||||||
// true / false
|
// true / false
|
||||||
if (token_typcol == TokenType::keyword_true || token_typcol == TokenType::keyword_false)
|
if (token_typcol == TokenType::keyword_true || token_typcol == TokenType::keyword_false)
|
||||||
return std::make_unique<BooleanValueNode>(token_typcol == TokenType::keyword_true);
|
return std::make_unique<BooleanValueNode>(token_typcol == TokenType::keyword_true);
|
||||||
|
|
||||||
// token * for count(*)
|
// token * for count(*)
|
||||||
if (token_typcol == TokenType::multiply)
|
if (token_typcol == TokenType::multiply)
|
||||||
|
|||||||
Reference in New Issue
Block a user