mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-10 13:11:50 +09:00
kinda working AST building?
This commit is contained in:
@@ -60,8 +60,8 @@ class VMGUI(val appConfig: LwjglApplicationConfiguration) : ApplicationAdapter()
|
||||
fr1.close()
|
||||
|
||||
//val fr = FileReader("./assets/tvdos/command.js")
|
||||
//val fr = FileReader("./assets/tbas/basic.js")
|
||||
val fr = FileReader("./assets/jscon.js")
|
||||
val fr = FileReader("./assets/tbas/basic.js")
|
||||
//val fr = FileReader("./assets/jscon.js")
|
||||
val prg = fr.readText()
|
||||
fr.close()
|
||||
|
||||
|
||||
@@ -76,4 +76,4 @@ object VMRunnerFactory {
|
||||
}
|
||||
|
||||
fun toSingleLine(code: String) = code.replace(Regex("//[^\\n]*"), "").replace('\n', ' ')
|
||||
fun sanitiseJS(code: String) = "eval('${toSingleLine(code)}')"
|
||||
fun sanitiseJS(code: String) = "eval('${toSingleLine(code).replace("\\", "\\\\")}')"
|
||||
|
||||
@@ -223,7 +223,7 @@ class IOSpace(val vm: VM) : PeriBase, InputProcessor {
|
||||
|
||||
override fun keyTyped(p0: Char): Boolean {
|
||||
if (keyboardInputRequested && !ttySpecialKeyLatched && p0.toInt() > 0) {
|
||||
println("[IO] Key typed: ${p0.toInt()}")
|
||||
//println("[IO] Key typed: ${p0.toInt()}")
|
||||
keyboardBuffer.appendHead(p0.toByte())
|
||||
return true
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class IOSpace(val vm: VM) : PeriBase, InputProcessor {
|
||||
private var specialKey = listOf(19,20,21,22).toSortedSet()
|
||||
override fun keyDown(p0: Int): Boolean {
|
||||
if (keyboardInputRequested && !ttySpecialKeyLatched && p0 in specialKey) {
|
||||
println("[IO] Key down: $p0")
|
||||
//println("[IO] Key down: $p0")
|
||||
keyboardBuffer.appendHead(p0.toByte())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user