kinda working AST building?

This commit is contained in:
minjaesong
2020-06-07 09:17:01 +09:00
parent 6d71277410
commit 2eb6a4a99e
9 changed files with 147 additions and 21 deletions

View File

@@ -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()

View File

@@ -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("\\", "\\\\")}')"

View File

@@ -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())
}