Further event output improvements

This commit is contained in:
Felix Krause 2017-02-14 22:08:38 +01:00
parent 2bb32139c4
commit 8abe91cb32
2 changed files with 3 additions and 3 deletions

View File

@ -1090,14 +1090,14 @@ proc anchorName*(p: YamlParser, anchor: AnchorId): string {.raises: [].} =
proc renderAttrs(p: YamlParser, tag: TagId, anchor: AnchorId, proc renderAttrs(p: YamlParser, tag: TagId, anchor: AnchorId,
isPlain: bool): string = isPlain: bool): string =
result = "" result = ""
if anchor != yAnchorNone: result &= " &" & p.anchorName(anchor)
case tag case tag
of yTagQuestionmark: discard of yTagQuestionmark: discard
of yTagExclamationmark: of yTagExclamationmark:
when defined(yamlScalarRepInd): when defined(yamlScalarRepInd):
if isPlain: result &= " <!>" if isPlain: result &= " <!>"
else: else:
result = "<" & p.taglib.uri(tag) & ">" result = " <" & p.taglib.uri(tag) & ">"
if anchor != yAnchorNone: result &= " &" & p.anchorName(anchor)
proc display*(p: YamlParser, event: YamlStreamEvent): string proc display*(p: YamlParser, event: YamlStreamEvent): string
{.raises: [KeyError].} = {.raises: [KeyError].} =

View File

@ -251,11 +251,11 @@ proc `==`*(left: YamlStreamEvent, right: YamlStreamEvent): bool {.raises: [].} =
proc renderAttrs(tag: TagId, anchor: AnchorId): string = proc renderAttrs(tag: TagId, anchor: AnchorId): string =
result = "" result = ""
if anchor != yAnchorNone: result &= " &" & $anchor
case tag case tag
of yTagQuestionmark: discard of yTagQuestionmark: discard
of yTagExclamationmark: result &= " !" of yTagExclamationmark: result &= " !"
else: result &= " <" & $tag & ">" else: result &= " <" & $tag & ">"
if anchor != yAnchorNone: result &= " &" & $anchor
proc `$`*(event: YamlStreamEvent): string {.raises: [].} = proc `$`*(event: YamlStreamEvent): string {.raises: [].} =
## outputs a human-readable string describing the given event. ## outputs a human-readable string describing the given event.