mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
add debug mode
This commit is contained in:
@ -9,6 +9,7 @@ import com.github.ajalt.clikt.parameters.options.option
|
||||
import com.github.ajalt.clikt.parameters.types.enum
|
||||
import gay.pizza.dough.fs.PlatformFsProvider
|
||||
import gay.pizza.pork.ast.gen.Symbol
|
||||
import gay.pizza.pork.execution.ExecutionOptions
|
||||
import gay.pizza.pork.execution.InternalNativeProvider
|
||||
import gay.pizza.pork.execution.NativeRegistry
|
||||
import gay.pizza.pork.ffi.FfiNativeProvider
|
||||
@ -20,6 +21,7 @@ class RunCommand : CliktCommand("run") {
|
||||
val loop by option("--loop", help = "Loop Program").flag()
|
||||
val measure by option("--measure", help = "Measure Time").flag()
|
||||
val quiet by option("--quiet", help = "Silence Prints").flag()
|
||||
val debug by option("--debug", help = "Debug Mode").flag()
|
||||
val executionType by option("--execution-type", "-E")
|
||||
.enum<ExecutionType> { it.id }
|
||||
.default(ExecutionType.VirtualMachine)
|
||||
@ -33,7 +35,10 @@ class RunCommand : CliktCommand("run") {
|
||||
nativeRegistry.add("internal", InternalNativeProvider(quiet = quiet))
|
||||
nativeRegistry.add("java", JavaNativeProvider())
|
||||
nativeRegistry.add("ffi", FfiNativeProvider())
|
||||
val main = tool.createExecutionContext(executionType, Symbol("main"), nativeRegistry)
|
||||
val main = tool.createExecutionContext(executionType, Symbol("main"), ExecutionOptions(
|
||||
nativeRegistry = nativeRegistry,
|
||||
debug = debug,
|
||||
))
|
||||
maybeLoopAndMeasure(loop, measure) {
|
||||
main.execute()
|
||||
}
|
||||
|
Reference in New Issue
Block a user