mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-10-10 16:19:37 +00:00
Implement token node attribution and a Dart compiler.
This commit is contained in:
16
src/main/kotlin/gay/pizza/pork/cli/GenerateDartCommand.kt
Normal file
16
src/main/kotlin/gay/pizza/pork/cli/GenerateDartCommand.kt
Normal file
@ -0,0 +1,16 @@
|
||||
package gay.pizza.pork.cli
|
||||
|
||||
import com.github.ajalt.clikt.core.CliktCommand
|
||||
import com.github.ajalt.clikt.parameters.arguments.argument
|
||||
import com.github.ajalt.clikt.parameters.types.path
|
||||
import gay.pizza.pork.compiler.DartCompiler
|
||||
import gay.pizza.pork.frontend.FileFrontend
|
||||
|
||||
class GenerateDartCommand : CliktCommand(help = "Generate Dart Code", name = "generate-dart") {
|
||||
val path by argument("file").path(mustExist = true, canBeDir = false)
|
||||
|
||||
override fun run() {
|
||||
val frontend = FileFrontend(path)
|
||||
println(frontend.visit(DartCompiler()))
|
||||
}
|
||||
}
|
@ -14,7 +14,8 @@ class RootCommand : CliktCommand(
|
||||
TokenizeCommand(),
|
||||
ReprintCommand(),
|
||||
AstCommand(),
|
||||
GenerateKotlinCommand()
|
||||
GenerateKotlinCommand(),
|
||||
GenerateDartCommand()
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user