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
|
proc emitCached(c: Context, e: var Event): bool
|
||||||
{.pop.}
|
{.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) =
|
template pushLevel(c: Context, newState: State, newIndent: int) =
|
||||||
debug("parser: push " & newState.astToStr & ", indent = " & $newIndent)
|
debug("parser: push " & newState.astToStr & ", indent = " & $newIndent)
|
||||||
c.levels.add(Level(state: newState, indentation: newIndent))
|
c.levels.add(Level(state: newState, indentation: newIndent))
|
||||||
|
|
|
@ -167,10 +167,13 @@ proc streamEnd(lex: var Lexer): bool {.raises: [].}
|
||||||
|
|
||||||
# helpers
|
# helpers
|
||||||
|
|
||||||
template debug(message: string) {.dirty.} =
|
template debug*(message: string) =
|
||||||
when defined(yamlDebug):
|
when defined(yamlDebug):
|
||||||
try: styledWriteLine(stdout, fgBlue, message)
|
when nimvm:
|
||||||
except ValueError, IOError: discard
|
echo "yamlDebug: ", message
|
||||||
|
else:
|
||||||
|
try: styledWriteLine(stdout, fgBlue, message)
|
||||||
|
except ValueError, IOError: discard
|
||||||
|
|
||||||
proc generateError(lex: Lexer, message: string):
|
proc generateError(lex: Lexer, message: string):
|
||||||
ref LexerError {.raises: [].} =
|
ref LexerError {.raises: [].} =
|
||||||
|
|
Loading…
Reference in New Issue