nondescript/config.nim

31 lines
875 B
Nim
Raw Normal View History

2022-01-20 21:54:11 +01:00
type
LineEditorChoice = enum
leBasic, leRdstdin
ReadlineInterruptedException* = object of CatchableError
# choose debug options here
2022-01-21 01:51:55 +01:00
const debugVM* = false
2022-01-20 21:54:11 +01:00
const debugScanner* = false
const debugCompiler* = false
2022-01-21 01:51:55 +01:00
const debugDumpChunk* = false
2022-01-20 21:54:11 +01:00
const assertionsVM* = true # sanity checks in the VM, such as the stack being empty at the end
2022-01-21 01:51:55 +01:00
const assertionsCompiler* = true # sanity checks in the compiler
2022-01-20 21:54:11 +01:00
# choose a line editor for the repl
const lineEditor = leRdstdin
when lineEditor == leRdstdin:
import rdstdin
proc konLineEditor*: string =
proc ctrlc =
raise newException(ReadlineInterruptedException, "Ctrl+C/D pressed.")
when lineEditor == leBasic:
write stdout, "\r-> "
result = stdin.readLine()
when lineEditor == leRdstdin:
var line: string
let ok = readLineFromStdin("-> ", line)
if not ok:
ctrlc()
return line