mirror of https://github.com/status-im/NimYAML.git
support -d:yamlDebug at CT
This commit is contained in:
parent
45321cad13
commit
fcae534148
|
@ -125,11 +125,6 @@ proc afterPairValue(c: Context, e: var Event): bool
|
|||
proc emitCached(c: Context, e: var Event): bool
|
||||
{.pop.}
|
||||
|
||||
template debug(message: string) {.dirty.} =
|
||||
when defined(yamlDebug):
|
||||
try: styledWriteLine(stdout, fgBlue, message)
|
||||
except ValueError, IOError: discard
|
||||
|
||||
template pushLevel(c: Context, newState: State, newIndent: int) =
|
||||
debug("parser: push " & newState.astToStr & ", indent = " & $newIndent)
|
||||
c.levels.add(Level(state: newState, indentation: newIndent))
|
||||
|
|
|
@ -167,10 +167,13 @@ proc streamEnd(lex: var Lexer): bool {.raises: [].}
|
|||
|
||||
# helpers
|
||||
|
||||
template debug(message: string) {.dirty.} =
|
||||
template debug*(message: string) =
|
||||
when defined(yamlDebug):
|
||||
try: styledWriteLine(stdout, fgBlue, message)
|
||||
except ValueError, IOError: discard
|
||||
when nimvm:
|
||||
echo "yamlDebug: ", message
|
||||
else:
|
||||
try: styledWriteLine(stdout, fgBlue, message)
|
||||
except ValueError, IOError: discard
|
||||
|
||||
proc generateError(lex: Lexer, message: string):
|
||||
ref LexerError {.raises: [].} =
|
||||
|
|
Loading…
Reference in New Issue