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
|
||||
--indent=spaces=4
|
||||
--indent=spaces=2
|
||||
--indent-namespaces
|
||||
|
||||
--style=java
|
||||
--style=attach
|
||||
-A2
|
||||
--align-reference=type
|
||||
--align-pointer=type
|
||||
--pad-oper
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace hsql {
|
|||
}
|
||||
|
||||
|
||||
SQLParserResult* SQLParser::parseSQLString(const char *text) {
|
||||
SQLParserResult* SQLParser::parseSQLString(const char* text) {
|
||||
SQLParserResult* result = NULL;
|
||||
yyscan_t scanner;
|
||||
YY_BUFFER_STATE state;
|
||||
|
|
|
@ -122,9 +122,9 @@ namespace hsql {
|
|||
}
|
||||
|
||||
char* substr(const char* source, int from, int to) {
|
||||
int len = to-from;
|
||||
char* copy = new char[len+1];
|
||||
strncpy(copy, source+from, len);
|
||||
int len = to - from;
|
||||
char* copy = new char[len + 1];
|
||||
strncpy(copy, source + from, len);
|
||||
copy[len] = '\0';
|
||||
return copy;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace hsql {
|
|||
placeholders.push_back((Expr*) e);
|
||||
}
|
||||
// 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
|
||||
for (uintmax_t i = 0; i < placeholders.size(); ++i) placeholders[i]->ival = i;
|
||||
|
|
|
@ -39,20 +39,20 @@ namespace hsql {
|
|||
break;
|
||||
case kTableJoin:
|
||||
inprint("Join Table", numIndent);
|
||||
inprint("Left", numIndent+1);
|
||||
printTableRefInfo(table->join->left, numIndent+2);
|
||||
inprint("Right", numIndent+1);
|
||||
printTableRefInfo(table->join->right, numIndent+2);
|
||||
inprint("Join Condition", numIndent+1);
|
||||
printExpression(table->join->condition, numIndent+2);
|
||||
inprint("Left", numIndent + 1);
|
||||
printTableRefInfo(table->join->left, numIndent + 2);
|
||||
inprint("Right", numIndent + 1);
|
||||
printTableRefInfo(table->join->right, numIndent + 2);
|
||||
inprint("Join Condition", numIndent + 1);
|
||||
printExpression(table->join->condition, numIndent + 2);
|
||||
break;
|
||||
case kTableCrossProduct:
|
||||
for (TableRef* tbl : *table->list) printTableRefInfo(tbl, numIndent);
|
||||
break;
|
||||
}
|
||||
if (table->alias != NULL) {
|
||||
inprint("Alias", numIndent+1);
|
||||
inprint(table->alias, numIndent+2);
|
||||
inprint("Alias", numIndent + 1);
|
||||
inprint(table->alias, numIndent + 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,8 @@ namespace hsql {
|
|||
inprintU(expr->op_type, numIndent);
|
||||
break;
|
||||
}
|
||||
printExpression(expr->expr, numIndent+1);
|
||||
if (expr->expr2 != NULL) printExpression(expr->expr2, numIndent+1);
|
||||
printExpression(expr->expr, numIndent + 1);
|
||||
if (expr->expr2 != NULL) printExpression(expr->expr2, numIndent + 1);
|
||||
}
|
||||
|
||||
void printExpression(Expr* expr, uintmax_t numIndent) {
|
||||
|
@ -103,7 +103,7 @@ namespace hsql {
|
|||
break;
|
||||
case kExprFunctionRef:
|
||||
inprint(expr->name, numIndent);
|
||||
inprint(expr->expr->name, numIndent+1);
|
||||
inprint(expr->expr->name, numIndent + 1);
|
||||
break;
|
||||
case kExprOperator:
|
||||
printOperatorExpression(expr, numIndent);
|
||||
|
@ -113,40 +113,40 @@ namespace hsql {
|
|||
return;
|
||||
}
|
||||
if (expr->alias != NULL) {
|
||||
inprint("Alias", numIndent+1);
|
||||
inprint(expr->alias, numIndent+2);
|
||||
inprint("Alias", numIndent + 1);
|
||||
inprint(expr->alias, numIndent + 2);
|
||||
}
|
||||
}
|
||||
|
||||
void printSelectStatementInfo(SelectStatement* stmt, uintmax_t numIndent) {
|
||||
inprint("SelectStatement", numIndent);
|
||||
inprint("Fields:", numIndent+1);
|
||||
for (Expr* expr : *stmt->selectList) printExpression(expr, numIndent+2);
|
||||
inprint("Fields:", numIndent + 1);
|
||||
for (Expr* expr : *stmt->selectList) printExpression(expr, numIndent + 2);
|
||||
|
||||
inprint("Sources:", numIndent+1);
|
||||
printTableRefInfo(stmt->fromTable, numIndent+2);
|
||||
inprint("Sources:", numIndent + 1);
|
||||
printTableRefInfo(stmt->fromTable, numIndent + 2);
|
||||
|
||||
if (stmt->whereClause != NULL) {
|
||||
inprint("Search Conditions:", numIndent+1);
|
||||
printExpression(stmt->whereClause, numIndent+2);
|
||||
inprint("Search Conditions:", numIndent + 1);
|
||||
printExpression(stmt->whereClause, numIndent + 2);
|
||||
}
|
||||
|
||||
|
||||
if (stmt->unionSelect != NULL) {
|
||||
inprint("Union:", numIndent+1);
|
||||
printSelectStatementInfo(stmt->unionSelect, numIndent+2);
|
||||
inprint("Union:", numIndent + 1);
|
||||
printSelectStatementInfo(stmt->unionSelect, numIndent + 2);
|
||||
}
|
||||
|
||||
if (stmt->order != NULL) {
|
||||
inprint("OrderBy:", numIndent+1);
|
||||
printExpression(stmt->order->expr, numIndent+2);
|
||||
if (stmt->order->type == kOrderAsc) inprint("ascending", numIndent+2);
|
||||
else inprint("descending", numIndent+2);
|
||||
inprint("OrderBy:", numIndent + 1);
|
||||
printExpression(stmt->order->expr, numIndent + 2);
|
||||
if (stmt->order->type == kOrderAsc) inprint("ascending", numIndent + 2);
|
||||
else inprint("descending", numIndent + 2);
|
||||
}
|
||||
|
||||
if (stmt->limit != NULL) {
|
||||
inprint("Limit:", numIndent+1);
|
||||
inprint(stmt->limit->limit, numIndent+2);
|
||||
inprint("Limit:", numIndent + 1);
|
||||
inprint(stmt->limit->limit, numIndent + 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,34 +154,34 @@ namespace hsql {
|
|||
|
||||
void printImportStatementInfo(ImportStatement* stmt, uintmax_t numIndent) {
|
||||
inprint("ImportStatment", numIndent);
|
||||
inprint(stmt->filePath, numIndent+1);
|
||||
inprint(stmt->tableName, numIndent+1);
|
||||
inprint(stmt->filePath, numIndent + 1);
|
||||
inprint(stmt->tableName, numIndent + 1);
|
||||
}
|
||||
|
||||
void printCreateStatementInfo(CreateStatement* stmt, uintmax_t numIndent) {
|
||||
inprint("CreateStatment", numIndent);
|
||||
inprint(stmt->tableName, numIndent+1);
|
||||
inprint(stmt->filePath, numIndent+1);
|
||||
inprint(stmt->tableName, numIndent + 1);
|
||||
inprint(stmt->filePath, numIndent + 1);
|
||||
}
|
||||
|
||||
void printInsertStatementInfo(InsertStatement* stmt, uintmax_t numIndent) {
|
||||
inprint("InsertStatment", numIndent);
|
||||
inprint(stmt->tableName, numIndent+1);
|
||||
inprint(stmt->tableName, numIndent + 1);
|
||||
if (stmt->columns != NULL) {
|
||||
inprint("Columns", numIndent+1);
|
||||
inprint("Columns", numIndent + 1);
|
||||
for (char* col_name : *stmt->columns) {
|
||||
inprint(col_name, numIndent+2);
|
||||
inprint(col_name, numIndent + 2);
|
||||
}
|
||||
}
|
||||
switch (stmt->type) {
|
||||
case InsertStatement::kInsertValues:
|
||||
inprint("Values", numIndent+1);
|
||||
inprint("Values", numIndent + 1);
|
||||
for (Expr* expr : *stmt->values) {
|
||||
printExpression(expr, numIndent+2);
|
||||
printExpression(expr, numIndent + 2);
|
||||
}
|
||||
break;
|
||||
case InsertStatement::kInsertSelect:
|
||||
printSelectStatementInfo(stmt->select, numIndent+1);
|
||||
printSelectStatementInfo(stmt->select, numIndent + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ class TestsManager {
|
|||
// 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-on-first-use.html
|
||||
public:
|
||||
public:
|
||||
static std::vector<std::string>& testNames() {
|
||||
static std::vector<std::string>* _testNames = new std::vector<std::string>;
|
||||
return *_testNames;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
|
||||
class AssertionFailedException: public std::exception {
|
||||
public:
|
||||
public:
|
||||
AssertionFailedException(std::string msg) :
|
||||
std::exception(),
|
||||
_msg(msg) {};
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
return _msg.c_str();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
std::string _msg;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue