change indent to spaces=2 and indent access modifiers. minor style changes
This commit is contained in:
parent
8582c7f901
commit
28214e8043
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
|
--style=google
|
||||||
|
|
||||||
# indentation
|
# indentation
|
||||||
--indent=spaces=4
|
--indent=spaces=2
|
||||||
--indent-namespaces
|
--indent-namespaces
|
||||||
|
|
||||||
--style=java
|
--align-reference=type
|
||||||
--style=attach
|
--align-pointer=type
|
||||||
-A2
|
--pad-oper
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace hsql {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SQLParserResult* SQLParser::parseSQLString(const char *text) {
|
SQLParserResult* SQLParser::parseSQLString(const char* text) {
|
||||||
SQLParserResult* result = NULL;
|
SQLParserResult* result = NULL;
|
||||||
yyscan_t scanner;
|
yyscan_t scanner;
|
||||||
YY_BUFFER_STATE state;
|
YY_BUFFER_STATE state;
|
||||||
|
|
|
@ -122,9 +122,9 @@ namespace hsql {
|
||||||
}
|
}
|
||||||
|
|
||||||
char* substr(const char* source, int from, int to) {
|
char* substr(const char* source, int from, int to) {
|
||||||
int len = to-from;
|
int len = to - from;
|
||||||
char* copy = new char[len+1];
|
char* copy = new char[len + 1];
|
||||||
strncpy(copy, source+from, len);
|
strncpy(copy, source + from, len);
|
||||||
copy[len] = '\0';
|
copy[len] = '\0';
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace hsql {
|
||||||
placeholders.push_back((Expr*) e);
|
placeholders.push_back((Expr*) e);
|
||||||
}
|
}
|
||||||
// Sort by col-id
|
// Sort by col-id
|
||||||
std::sort(placeholders.begin(), placeholders.end(), [](Expr* i, Expr* j) -> bool { return (i->ival < j->ival); });
|
std::sort(placeholders.begin(), placeholders.end(), [](Expr * i, Expr * j) -> bool { return (i->ival < j->ival); });
|
||||||
|
|
||||||
// Set the placeholder id on the Expr. This replaces the previously stored column id
|
// Set the placeholder id on the Expr. This replaces the previously stored column id
|
||||||
for (uintmax_t i = 0; i < placeholders.size(); ++i) placeholders[i]->ival = i;
|
for (uintmax_t i = 0; i < placeholders.size(); ++i) placeholders[i]->ival = i;
|
||||||
|
|
|
@ -39,20 +39,20 @@ namespace hsql {
|
||||||
break;
|
break;
|
||||||
case kTableJoin:
|
case kTableJoin:
|
||||||
inprint("Join Table", numIndent);
|
inprint("Join Table", numIndent);
|
||||||
inprint("Left", numIndent+1);
|
inprint("Left", numIndent + 1);
|
||||||
printTableRefInfo(table->join->left, numIndent+2);
|
printTableRefInfo(table->join->left, numIndent + 2);
|
||||||
inprint("Right", numIndent+1);
|
inprint("Right", numIndent + 1);
|
||||||
printTableRefInfo(table->join->right, numIndent+2);
|
printTableRefInfo(table->join->right, numIndent + 2);
|
||||||
inprint("Join Condition", numIndent+1);
|
inprint("Join Condition", numIndent + 1);
|
||||||
printExpression(table->join->condition, numIndent+2);
|
printExpression(table->join->condition, numIndent + 2);
|
||||||
break;
|
break;
|
||||||
case kTableCrossProduct:
|
case kTableCrossProduct:
|
||||||
for (TableRef* tbl : *table->list) printTableRefInfo(tbl, numIndent);
|
for (TableRef* tbl : *table->list) printTableRefInfo(tbl, numIndent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (table->alias != NULL) {
|
if (table->alias != NULL) {
|
||||||
inprint("Alias", numIndent+1);
|
inprint("Alias", numIndent + 1);
|
||||||
inprint(table->alias, numIndent+2);
|
inprint(table->alias, numIndent + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ namespace hsql {
|
||||||
inprintU(expr->op_type, numIndent);
|
inprintU(expr->op_type, numIndent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printExpression(expr->expr, numIndent+1);
|
printExpression(expr->expr, numIndent + 1);
|
||||||
if (expr->expr2 != NULL) printExpression(expr->expr2, numIndent+1);
|
if (expr->expr2 != NULL) printExpression(expr->expr2, numIndent + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printExpression(Expr* expr, uintmax_t numIndent) {
|
void printExpression(Expr* expr, uintmax_t numIndent) {
|
||||||
|
@ -103,7 +103,7 @@ namespace hsql {
|
||||||
break;
|
break;
|
||||||
case kExprFunctionRef:
|
case kExprFunctionRef:
|
||||||
inprint(expr->name, numIndent);
|
inprint(expr->name, numIndent);
|
||||||
inprint(expr->expr->name, numIndent+1);
|
inprint(expr->expr->name, numIndent + 1);
|
||||||
break;
|
break;
|
||||||
case kExprOperator:
|
case kExprOperator:
|
||||||
printOperatorExpression(expr, numIndent);
|
printOperatorExpression(expr, numIndent);
|
||||||
|
@ -113,40 +113,40 @@ namespace hsql {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (expr->alias != NULL) {
|
if (expr->alias != NULL) {
|
||||||
inprint("Alias", numIndent+1);
|
inprint("Alias", numIndent + 1);
|
||||||
inprint(expr->alias, numIndent+2);
|
inprint(expr->alias, numIndent + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printSelectStatementInfo(SelectStatement* stmt, uintmax_t numIndent) {
|
void printSelectStatementInfo(SelectStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("SelectStatement", numIndent);
|
inprint("SelectStatement", numIndent);
|
||||||
inprint("Fields:", numIndent+1);
|
inprint("Fields:", numIndent + 1);
|
||||||
for (Expr* expr : *stmt->selectList) printExpression(expr, numIndent+2);
|
for (Expr* expr : *stmt->selectList) printExpression(expr, numIndent + 2);
|
||||||
|
|
||||||
inprint("Sources:", numIndent+1);
|
inprint("Sources:", numIndent + 1);
|
||||||
printTableRefInfo(stmt->fromTable, numIndent+2);
|
printTableRefInfo(stmt->fromTable, numIndent + 2);
|
||||||
|
|
||||||
if (stmt->whereClause != NULL) {
|
if (stmt->whereClause != NULL) {
|
||||||
inprint("Search Conditions:", numIndent+1);
|
inprint("Search Conditions:", numIndent + 1);
|
||||||
printExpression(stmt->whereClause, numIndent+2);
|
printExpression(stmt->whereClause, numIndent + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stmt->unionSelect != NULL) {
|
if (stmt->unionSelect != NULL) {
|
||||||
inprint("Union:", numIndent+1);
|
inprint("Union:", numIndent + 1);
|
||||||
printSelectStatementInfo(stmt->unionSelect, numIndent+2);
|
printSelectStatementInfo(stmt->unionSelect, numIndent + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stmt->order != NULL) {
|
if (stmt->order != NULL) {
|
||||||
inprint("OrderBy:", numIndent+1);
|
inprint("OrderBy:", numIndent + 1);
|
||||||
printExpression(stmt->order->expr, numIndent+2);
|
printExpression(stmt->order->expr, numIndent + 2);
|
||||||
if (stmt->order->type == kOrderAsc) inprint("ascending", numIndent+2);
|
if (stmt->order->type == kOrderAsc) inprint("ascending", numIndent + 2);
|
||||||
else inprint("descending", numIndent+2);
|
else inprint("descending", numIndent + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stmt->limit != NULL) {
|
if (stmt->limit != NULL) {
|
||||||
inprint("Limit:", numIndent+1);
|
inprint("Limit:", numIndent + 1);
|
||||||
inprint(stmt->limit->limit, numIndent+2);
|
inprint(stmt->limit->limit, numIndent + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,34 +154,34 @@ namespace hsql {
|
||||||
|
|
||||||
void printImportStatementInfo(ImportStatement* stmt, uintmax_t numIndent) {
|
void printImportStatementInfo(ImportStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("ImportStatment", numIndent);
|
inprint("ImportStatment", numIndent);
|
||||||
inprint(stmt->filePath, numIndent+1);
|
inprint(stmt->filePath, numIndent + 1);
|
||||||
inprint(stmt->tableName, numIndent+1);
|
inprint(stmt->tableName, numIndent + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printCreateStatementInfo(CreateStatement* stmt, uintmax_t numIndent) {
|
void printCreateStatementInfo(CreateStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("CreateStatment", numIndent);
|
inprint("CreateStatment", numIndent);
|
||||||
inprint(stmt->tableName, numIndent+1);
|
inprint(stmt->tableName, numIndent + 1);
|
||||||
inprint(stmt->filePath, numIndent+1);
|
inprint(stmt->filePath, numIndent + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printInsertStatementInfo(InsertStatement* stmt, uintmax_t numIndent) {
|
void printInsertStatementInfo(InsertStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("InsertStatment", numIndent);
|
inprint("InsertStatment", numIndent);
|
||||||
inprint(stmt->tableName, numIndent+1);
|
inprint(stmt->tableName, numIndent + 1);
|
||||||
if (stmt->columns != NULL) {
|
if (stmt->columns != NULL) {
|
||||||
inprint("Columns", numIndent+1);
|
inprint("Columns", numIndent + 1);
|
||||||
for (char* col_name : *stmt->columns) {
|
for (char* col_name : *stmt->columns) {
|
||||||
inprint(col_name, numIndent+2);
|
inprint(col_name, numIndent + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (stmt->type) {
|
switch (stmt->type) {
|
||||||
case InsertStatement::kInsertValues:
|
case InsertStatement::kInsertValues:
|
||||||
inprint("Values", numIndent+1);
|
inprint("Values", numIndent + 1);
|
||||||
for (Expr* expr : *stmt->values) {
|
for (Expr* expr : *stmt->values) {
|
||||||
printExpression(expr, numIndent+2);
|
printExpression(expr, numIndent + 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case InsertStatement::kInsertSelect:
|
case InsertStatement::kInsertSelect:
|
||||||
printSelectStatementInfo(stmt->select, numIndent+1);
|
printSelectStatementInfo(stmt->select, numIndent + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ class TestsManager {
|
||||||
// Note: static initialization fiasco
|
// Note: static initialization fiasco
|
||||||
// http://www.parashift.com/c++-faq-lite/static-init-order.html
|
// http://www.parashift.com/c++-faq-lite/static-init-order.html
|
||||||
// http://www.parashift.com/c++-faq-lite/static-init-order-on-first-use.html
|
// http://www.parashift.com/c++-faq-lite/static-init-order-on-first-use.html
|
||||||
public:
|
public:
|
||||||
static std::vector<std::string>& testNames() {
|
static std::vector<std::string>& testNames() {
|
||||||
static std::vector<std::string>* _testNames = new std::vector<std::string>;
|
static std::vector<std::string>* _testNames = new std::vector<std::string>;
|
||||||
return *_testNames;
|
return *_testNames;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
class AssertionFailedException: public std::exception {
|
class AssertionFailedException: public std::exception {
|
||||||
public:
|
public:
|
||||||
AssertionFailedException(std::string msg) :
|
AssertionFailedException(std::string msg) :
|
||||||
std::exception(),
|
std::exception(),
|
||||||
_msg(msg) {};
|
_msg(msg) {};
|
||||||
|
@ -40,7 +40,7 @@ public:
|
||||||
return _msg.c_str();
|
return _msg.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string _msg;
|
std::string _msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue