app.cash.sqldelight.dialects.sqlite_3_33.grammar.SqliteParserUtil.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sqlite-3-33-dialect Show documentation
Show all versions of sqlite-3-33-dialect Show documentation
The SQLite v3.33 Dialect for SQLDelight
package app.cash.sqldelight.dialects.sqlite_3_33.grammar
import app.cash.sqldelight.dialects.sqlite_3_33.grammar.psi.SqliteTypes
import com.alecstrong.sql.psi.core.SqlParserUtil
import com.intellij.lang.ASTNode
import com.intellij.lang.PsiBuilder
import com.intellij.lang.parser.GeneratedParserUtilBase
import com.intellij.psi.PsiElement
import java.lang.AssertionError
import kotlin.Boolean
import kotlin.Int
import kotlin.Unit
import kotlin.jvm.JvmStatic
public object SqliteParserUtil : GeneratedParserUtilBase() {
public var createElement: (ASTNode) -> PsiElement = { SqliteTypes.Factory.createElement(it) }
public var overrides: GeneratedParserUtilBase.Parser? = null
public var update_stmt: GeneratedParserUtilBase.Parser? = null
public var update_stmt_limited: GeneratedParserUtilBase.Parser? = null
@JvmStatic
public fun overridesExt(
builder: PsiBuilder,
level: Int,
overrides: GeneratedParserUtilBase.Parser,
): Boolean = (this.overrides ?: overrides).parse(builder, level)
@JvmStatic
public fun updateStmtExt(
builder: PsiBuilder,
level: Int,
update_stmt: GeneratedParserUtilBase.Parser,
): Boolean = (this.update_stmt ?: update_stmt).parse(builder, level)
@JvmStatic
public fun updateStmtLimitedExt(
builder: PsiBuilder,
level: Int,
update_stmt_limited: GeneratedParserUtilBase.Parser,
): Boolean = (this.update_stmt_limited ?: update_stmt_limited).parse(builder, level)
public fun reset(): Unit {
createElement = { SqliteTypes.Factory.createElement(it) }
overrides = null
update_stmt = null
update_stmt_limited = null
}
public fun overrideSqlParser(): Unit {
SqlParserUtil.update_stmt = Parser { psiBuilder, i -> update_stmt?.parse(psiBuilder, i) ?:
SqliteParser.update_stmt_real(psiBuilder, i) }
SqlParserUtil.update_stmt_limited = Parser { psiBuilder, i ->
update_stmt_limited?.parse(psiBuilder, i) ?:
SqliteParser.update_stmt_limited_real(psiBuilder, i) }
val currentCreateElement = SqlParserUtil.createElement
SqlParserUtil.createElement = {
try {
createElement(it)
} catch(e: AssertionError) {
currentCreateElement(it)
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy