All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.skillw.asahi.internal.namespacing.prefix.lang.util.Logic.kt Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
package com.skillw.asahi.internal.namespacing.prefix.lang.util

import com.skillw.asahi.api.annotation.AsahiPrefix
import com.skillw.asahi.api.prefixParser
import com.skillw.asahi.api.quest
import com.skillw.asahi.util.cast

/**
 * @className Logic
 *
 * @author Glom
 * @date 2023/1/14 0:15 Copyright 2024 Glom.
 */
@AsahiPrefix(["not"], "lang")
private fun not() = prefixParser {
    val bool = quest()
    result { !bool.get() }
}

@AsahiPrefix(["all"], "lang")
private fun all() = prefixParser {
    val array = quest>()
    result {
        array.get().all { it.cast() }
    }

}

@AsahiPrefix(["any"], "lang")
private fun any() = prefixParser {
    val array = quest>()
    result {
        array.get().any { it.cast() }
    }
}

@AsahiPrefix(["check", "?"], "lang")
private fun check() = prefixParser {
    val a = quest()
    val symbol = next()
    val b = quest()
    result {
        com.skillw.asahi.util.check(a.get(), symbol, b.get())
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy