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

io.getquill.codegen.util.ScalaLangUtil.scala Maven / Gradle / Ivy

The newest version!
package io.getquill.codegen.util

object ScalaLangUtil {
  def escape(str: String) =
    if (isKeyword(str)) s"`${str}`" else str

  def isKeyword(word: String) = keywords.contains(word.trim)
  private val keywords = Set(
    "abstract",
    "case",
    "catch",
    "class",
    "def",
    "do",
    "else",
    "extends",
    "false",
    "final",
    "finally",
    "for",
    "forSome",
    "if",
    "implicit",
    "import",
    "lazy",
    "match",
    "new",
    "null",
    "object",
    "override",
    "package",
    "private",
    "protected",
    "return",
    "sealed",
    "super",
    "this",
    "throw",
    "trait",
    "try",
    "true",
    "type",
    "val",
    "var",
    "while",
    "with",
    "yield"
  )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy