+namespaces with direct resolution
+national chars in ids
This commit is contained in:
1 parent
1f2afbbe38
commit
50986fbac5
2 files changed
+2
-13
No files matched your search
@@ -243,6 +243,7 @@ class Compiler {
|
|||||||
* Parse keyword-starting statenment.
|
* Parse keyword-starting statenment.
|
||||||
* @return parsed statement or null if, for example. [id] is not among keywords
|
* @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? {
|
private fun parseKeywordStatement(id: Token, tokens: ListIterator<Token>): Statement? {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ fun Statement.raise(text: String): Nothing {
|
|||||||
throw ScriptError(pos, text)
|
throw ScriptError(pos, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
fun Statement.require(cond: Boolean, message: () -> String) {
|
fun Statement.require(cond: Boolean, message: () -> String) {
|
||||||
if (!cond) raise(message())
|
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)
|
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(
|
class LogicalAndStatement(
|
||||||
override val pos: Pos,
|
override val pos: Pos,
|
||||||
val left: Statement, val right: Statement
|
val left: Statement, val right: Statement
|
||||||
|
|||||||
Reference in new issue
Block a user