1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -37,7 +37,8 @@
#include "parsetree.h"
#include "operator.h"
namespace execplan {
namespace execplan
{
/**
* type define
@ -46,44 +47,49 @@ typedef std::stack<ParseTree*> OperandStack;
typedef std::stack<TreeNode*> OperatorStack;
/**@brief util struct for converting string to lower case
*
*
*/
struct to_lower
{
char operator() (char c) const { return tolower(c); }
char operator() (char c) const
{
return tolower(c);
}
};
/**@brief a structure to respent a token accepted by the parser
*
*
* token structure
*/
struct Token {
struct Token
{
TreeNode* value;
bool is_operator() const
{
if (value == 0) return false;
return (typeid(*value) == typeid(Operator));
bool is_operator() const
{
if (value == 0) return false;
return (typeid(*value) == typeid(Operator));
}
Token() : value(0) {}
Token(TreeNode* v) : value(v) {}
Token() : value(0) {}
Token(TreeNode* v) : value(v) {}
private:
// technically, these should be defined since Token is used in a
// std::vector, but it appears to work okay...ownership of the
// value ptr is dubious
//Token(const Token& rhs);
//Token& operator=(const Token& rhs);
// technically, these should be defined since Token is used in a
// std::vector, but it appears to work okay...ownership of the
// value ptr is dubious
//Token(const Token& rhs);
//Token& operator=(const Token& rhs);
};
/**
* @brief this class builds an expression tree
*
* This struct parse the incomming tokens from an expression and
* build a expression tree according to the pre-defined precedence
* rules. The operators handled are: +, -, *, /, ||, (, ), func (,
* This struct parse the incomming tokens from an expression and
* build a expression tree according to the pre-defined precedence
* rules. The operators handled are: +, -, *, /, ||, (, ), func (,
* func ), and, or.
*/
class ExpressionParser : public expression::default_expression_parser_error_policy
class ExpressionParser : public expression::default_expression_parser_error_policy
{
public:
/**
@ -91,47 +97,47 @@ public:
*/
ExpressionParser();
virtual ~ExpressionParser();
/**
* Operations
*/
/*
* Error handling
*/
static void invalid_operator_position(TreeNode* oper);
static void invalid_operator_position(TreeNode* oper);
static void invalid_operator_position(const Token& oper);
static void invalid_operand_position(ParseTree* operand);
static void unbalanced_confix(TreeNode* oper);
static void missing_operand(const Token& oper);
/**
* Syntax and precedence rules
*/
static int positions(Token t);
static int position(TreeNode* op);
inline static bool is_operator(const Token& t)
{
inline static bool is_operator(const Token& t)
{
return t.is_operator();
}
static ParseTree* as_operand(Token t);
static TreeNode* as_operator(Token t, int pos);
static expression::precedence precedence (TreeNode* op1, TreeNode* op2);
static expression::associativity associativity(TreeNode* op1, TreeNode* op2);
/**
* Build an expression tree with the tokens
*/
static ParseTree* reduce(TreeNode* op, ParseTree* value);
static ParseTree* reduce(TreeNode* op, ParseTree* lhs, ParseTree* rhs);
// parenthesis
static ParseTree* reduce(TreeNode* a, TreeNode* b, ParseTree* value);
// function call
static ParseTree* reduce(ParseTree* a, TreeNode* b, ParseTree* value, TreeNode* d);
/**
* to clean up operator and operand stack when exception throws.
* this is to be used by Calpont execplan project, where the operator
@ -150,7 +156,7 @@ private:
* @return true iff every member of t1 is a duplicate copy of every member of t2; false otherwise
*/
bool operator==(const ParseTree& t1,
const ParseTree& t2);
const ParseTree& t2);
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -158,7 +164,7 @@ bool operator==(const ParseTree& t1,
* @return false iff every member of t1 is a duplicate copy of every member of t2; true otherwise
*/
bool operator!=(const ParseTree& t1,
const ParseTree& t2);
const ParseTree& t2);
} // namespace execplan