Merge branch 'devel' of https://github.com/Araq/Nimrod into devel

This commit is contained in:
Araq
2014-04-08 00:34:35 +02:00
4 changed files with 33 additions and 4 deletions

View File

@@ -9,7 +9,7 @@
## This module implements an AST for the `reStructuredText`:idx: parser.
import strutils
import strutils, json
type
TRstNodeKind* = enum ## the possible node kinds of an PRstNode
@@ -286,3 +286,27 @@ proc renderRstToRst*(n: PRstNode, result: var string) =
var d: TRenderContext
renderRstToRst(d, n, result)
proc renderRstToJsonNode(node: PRstNode): PJsonNode =
result =
%[
(key: "kind", val: %($node.kind)),
(key: "level", val: %BiggestInt(node.level))
]
if node.text != nil:
result.add("text", %node.text)
if node.sons != nil and len(node.sons) > 0:
var accm = newSeq[PJsonNode](len(node.sons))
for i, son in node.sons:
accm[i] = renderRstToJsonNode(son)
result.add("sons", %accm)
proc renderRstToJson*(node: PRstNode): string =
## Writes the given RST node as JSON that is in the form
## ::
## {
## "kind":string node.kind,
## "text":optional string node.text,
## "level":optional int node.level,
## "sons":optional node array
## }
renderRstToJsonNode(node).pretty

View File

@@ -922,7 +922,7 @@ macro async*(prc: stmt): stmt {.immediate.} =
result[6] = outerProcBody
echo(toStrLit(result))
#echo(toStrLit(result))
proc recvLine*(socket: TAsyncFD): PFuture[string] {.async.} =
## Reads a line of data from ``socket``. Returned future will complete once

View File

@@ -657,7 +657,12 @@ type
D4*: array [0..7, int8]
const
ERROR_IO_PENDING* = 997
ERROR_IO_PENDING* = 997 # a.k.a WSA_IO_PENDING
WSAECONNABORTED* = 10053
WSAECONNRESET* = 10054
WSAEDISCON* = 10101
WSAENETRESET* = 10052
WSAETIMEDOUT* = 10060
proc CreateIoCompletionPort*(FileHandle: THANDLE, ExistingCompletionPort: THANDLE,
CompletionKey: DWORD,

View File

@@ -3,7 +3,7 @@ discard """
WARNING: false first asseertion from bar
ERROR: false second assertion from bar
-1
tests/assert/tfailedassert.nim:27 false assertion from foo
tfailedassert.nim:27 false assertion from foo
'''
"""