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

app.cash.sqldelight.dialects.sqlite_3_18.grammar.SqliteParserUtil.kt Maven / Gradle / Ivy

The newest version!
package app.cash.sqldelight.dialects.sqlite_3_18.grammar

import app.cash.sqldelight.dialects.sqlite_3_18.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 type_name: GeneratedParserUtilBase.Parser? = null

  public var text_data_type: GeneratedParserUtilBase.Parser? = null

  public var blob_data_type: GeneratedParserUtilBase.Parser? = null

  public var int_data_type: GeneratedParserUtilBase.Parser? = null

  public var real_data_type: GeneratedParserUtilBase.Parser? = null

  public var bind_parameter: GeneratedParserUtilBase.Parser? = null

  public var alter_table_stmt: GeneratedParserUtilBase.Parser? = null

  @JvmStatic
  public fun overridesExt(
    builder: PsiBuilder,
    level: Int,
    overrides: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.overrides ?: overrides).parse(builder, level)

  @JvmStatic
  public fun typeNameExt(
    builder: PsiBuilder,
    level: Int,
    type_name: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.type_name ?: type_name).parse(builder, level)

  @JvmStatic
  public fun textDataTypeExt(
    builder: PsiBuilder,
    level: Int,
    text_data_type: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.text_data_type ?: text_data_type).parse(builder, level)

  @JvmStatic
  public fun blobDataTypeExt(
    builder: PsiBuilder,
    level: Int,
    blob_data_type: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.blob_data_type ?: blob_data_type).parse(builder, level)

  @JvmStatic
  public fun intDataTypeExt(
    builder: PsiBuilder,
    level: Int,
    int_data_type: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.int_data_type ?: int_data_type).parse(builder, level)

  @JvmStatic
  public fun realDataTypeExt(
    builder: PsiBuilder,
    level: Int,
    real_data_type: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.real_data_type ?: real_data_type).parse(builder, level)

  @JvmStatic
  public fun bindParameterExt(
    builder: PsiBuilder,
    level: Int,
    bind_parameter: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.bind_parameter ?: bind_parameter).parse(builder, level)

  @JvmStatic
  public fun alterTableStmtExt(
    builder: PsiBuilder,
    level: Int,
    alter_table_stmt: GeneratedParserUtilBase.Parser,
  ): Boolean = (this.alter_table_stmt ?: alter_table_stmt).parse(builder, level)

  public fun reset(): Unit {
    createElement = { SqliteTypes.Factory.createElement(it) }
    overrides = null
    type_name = null
    text_data_type = null
    blob_data_type = null
    int_data_type = null
    real_data_type = null
    bind_parameter = null
    alter_table_stmt = null
  }

  public fun overrideSqlParser(): Unit {
    SqlParserUtil.type_name = Parser { psiBuilder, i -> type_name?.parse(psiBuilder, i) ?:
        SqliteParser.type_name_real(psiBuilder, i) }
    SqlParserUtil.bind_parameter = Parser { psiBuilder, i -> bind_parameter?.parse(psiBuilder, i) ?:
        SqliteParser.bind_parameter_real(psiBuilder, i) }
    SqlParserUtil.alter_table_stmt = Parser { psiBuilder, i -> alter_table_stmt?.parse(psiBuilder,
        i) ?: SqliteParser.alter_table_stmt_real(psiBuilder, i) }
    val currentCreateElement = SqlParserUtil.createElement
    SqlParserUtil.createElement = {
      try {
        createElement(it)
      } catch(e: AssertionError) {
        currentCreateElement(it)
      }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy