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

com.skillw.asahi.internal.parser.prefix.top.PrefixCallParser.kt Maven / Gradle / Ivy

The newest version!
package com.skillw.asahi.internal.parser.prefix.top

import com.skillw.asahi.api.annotation.AsahiTopParser
import com.skillw.asahi.api.member.context.AsahiContext
import com.skillw.asahi.api.member.lexer.AsahiLexer
import com.skillw.asahi.api.member.parser.prefix.TopPrefixParser
import com.skillw.asahi.api.member.quest.Quester

@AsahiTopParser
internal object PrefixCallParser : TopPrefixParser("call-function", 999) {
    override fun AsahiLexer.canParse(token: String): Boolean {
        return hasPrefix(token)
    }

    override fun AsahiLexer.parse(token: String): Quester? {
        return getPrefix(token)?.parseWith(this@parse) as Quester?
    }

    override fun  Quester.topQuester(): Quester {
        return object : Quester {
            override fun AsahiContext.execute(): R {
                return [email protected](this)
            }

            override fun toString(): String {
                return "Prefix Quester - $key ${this@topQuester}"
            }
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy