+namespaces with direct resolution

+national chars in ids
This commit is contained in:
Sergey Chernov 2025-05-18 11:59:45 +04:00
parent 1f2afbbe38
commit 50986fbac5
2 changed files with 2 additions and 13 deletions

View File

@ -243,6 +243,7 @@ class Compiler {
* Parse keyword-starting statenment.
* @return parsed statement or null if, for example. [id] is not among keywords
*/
@Suppress("UNUSED_PARAMETER")
private fun parseKeywordStatement(id: Token, tokens: ListIterator<Token>): Statement? {
return null
}

View File

@ -12,6 +12,7 @@ fun Statement.raise(text: String): Nothing {
throw ScriptError(pos, text)
}
@Suppress("unused")
fun Statement.require(cond: Boolean, message: () -> String) {
if (!cond) raise(message())
}
@ -21,19 +22,6 @@ fun statement(pos: Pos, f: suspend (Context) -> Obj): Statement = object : State
override suspend fun execute(context: Context): Obj = f(context)
}
class IfStatement(
override val pos: Pos,
val cond: Statement, val ifTrue: Statement, val ifFalse: Statement?
) : Statement() {
override suspend fun execute(context: Context): Obj {
val c = cond.execute(context)
if (c !is ObjBool)
raise("if: condition must me boolean, got: $c")
return if (c.value) ifTrue.execute(context) else ifFalse?.execute(context) ?: ObjVoid
}
}
class LogicalAndStatement(
override val pos: Pos,
val left: Statement, val right: Statement