diff options
author | Araq <rumpf_a@web.de> | 2012-04-26 01:16:50 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-04-26 01:16:50 +0200 |
commit | ce1138dfa74ec6f304fee6e5a96ab217020740cb (patch) | |
tree | 67c4a4a09077f4cd02f6ec1bd15c0810480d84bc | |
parent | afd8ca2f156aa76f621145fe0040f7da8be7b126 (diff) | |
download | Nim-ce1138dfa74ec6f304fee6e5a96ab217020740cb.tar.gz |
some code formating
-rwxr-xr-x | compiler/rst.nim | 16 | ||||
-rwxr-xr-x | lib/impure/db_sqlite.nim | 5 |
2 files changed, 10 insertions, 11 deletions
diff --git a/compiler/rst.nim b/compiler/rst.nim index 168ac4496..395c27119 100755 --- a/compiler/rst.nim +++ b/compiler/rst.nim @@ -776,10 +776,10 @@ proc parseInline(p: var TRstParser, father: PRstNode) = of tkAdornment, tkOther, tkWhite: addSon(father, newLeaf(p)) inc(p.idx) - else: assert(false) + else: nil proc getDirective(p: var TRstParser): string = - if (p.tok[p.idx].kind == tkWhite) and (p.tok[p.idx + 1].kind == tkWord): + if p.tok[p.idx].kind == tkWhite and p.tok[p.idx+1].kind == tkWord: var j = p.idx inc(p.idx) result = p.tok[p.idx].symbol @@ -788,7 +788,7 @@ proc getDirective(p: var TRstParser): string = if p.tok[p.idx].symbol == "::": break add(result, p.tok[p.idx].symbol) inc(p.idx) - if (p.tok[p.idx].kind == tkWhite): inc(p.idx) + if p.tok[p.idx].kind == tkWhite: inc(p.idx) if p.tok[p.idx].symbol == "::": inc(p.idx) if (p.tok[p.idx].kind == tkWhite): inc(p.idx) @@ -814,8 +814,8 @@ proc parseComment(p: var TRstParser): PRstNode = else: nil inc(p.idx) - else: - while not (p.tok[p.idx].kind in {tkIndent, tkEof}): inc(p.idx) + else: + while p.tok[p.idx].kind notin {tkIndent, tkEof}: inc(p.idx) result = nil type @@ -941,9 +941,9 @@ proc isLineBlock(p: TRstParser): bool = proc predNL(p: TRstParser): bool = result = true - if (p.idx > 0): - result = (p.tok[p.idx - 1].kind == tkIndent) and - (p.tok[p.idx - 1].ival == currInd(p)) + if p.idx > 0: + result = p.tok[p.idx-1].kind == tkIndent and + p.tok[p.idx-1].ival == currInd(p) proc isDefList(p: TRstParser): bool = var j = tokenAfterNewline(p) diff --git a/lib/impure/db_sqlite.nim b/lib/impure/db_sqlite.nim index d800a2317..3f5be772c 100755 --- a/lib/impure/db_sqlite.nim +++ b/lib/impure/db_sqlite.nim @@ -162,15 +162,14 @@ proc ExecAffectedRows*(db: TDbConn, query: TSqlQuery, proc Close*(db: TDbConn) = ## closes the database connection. - if sqlite3.close(db) != SQLITE_OK: - dbError(db) + if sqlite3.close(db) != SQLITE_OK: dbError(db) proc Open*(connection, user, password, database: string): TDbConn = ## opens a database connection. Raises `EDb` if the connection could not ## be established. Only the ``connection`` parameter is used for ``sqlite``. var db: TDbConn if sqlite3.open(connection, db) == SQLITE_OK: - return db + result = db else: dbError(db) |