Trait/Object

zio.cli.completion

RegularLanguage

Related Docs: object RegularLanguage | package completion

Permalink

sealed trait RegularLanguage extends Product with Serializable

RegularLanguage is an implementation of "Parsing With Derivatives" (Might et al. 2011) that is used for CLI tab completion. Unlike your usual regular languages that are sets of strings of symbols, our regular languages are sets of lists of tokens, where tokens can be strings or zio.cli.PrimType instances. (If you think about it, zio.cli.PrimType.validate is an intensional definition of a set of strings.)

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RegularLanguage
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def canEqual(that: Any): Boolean

    Permalink
    Definition Classes
    Equals
  2. abstract def derive(token: String, cliConfig: CliConfig): UIO[RegularLanguage]

    Permalink

    Calculate the Brzozowski derivative of this language with respect to the given string.

    Calculate the Brzozowski derivative of this language with respect to the given string. This is an effectful function because it can call PrimType.validate (e.g., when validating file paths, etc.).

    token

    The string to use for calculation of the Brzozowski derivative.

    returns

    Brzozowski derivative wrapped in an UIO instance.

  3. abstract def firstTokens(prefix: String, compgen: Compgen): UIO[Set[String]]

    Permalink

    Returns a set consisting of the first token of all strings in this language that are useful for CLI tab completion.

    Returns a set consisting of the first token of all strings in this language that are useful for CLI tab completion. For infinite or unwieldly languages, it is perfectly fine to return the empty set: This will simply not display any completions to the user.

    If you'd like the cursor to advance to the next word when tab completion unambiguously matches the prefix to a token, append a space (" ") character to the end of the returned token. Otherwise, the cursor will skip to the end of the completed token in the terminal.

    Some examples of different use cases:

    1. Completing file/directory names:
      • Append a space to the ends of file names (e.g., "bippy.pdf"). This is because we want the cursor to jump to the next argument position if tab completion unambiguously succeeds.
      • Do not append a space to the end of a directory name (e.g., "foo/"). This is because we want the user to be able to press tab again to gradually complete a lengthy file path.
      • Append a space to the ends of string tokens.

    You may be asking why we don't try to use the -o nospace setting of compgen and complete. The answer is they appear to be all or nothing: For a given tab completion execution, you have to choose one behavior or the other. This does not work well when completing both file names and directory names at the same time.

  4. abstract def isNullable: Boolean

    Permalink

    This is the delta (δ) predicate from "Parsing With Derivatives", indicating whether this language contains the empty string.

    This is the delta (δ) predicate from "Parsing With Derivatives", indicating whether this language contains the empty string.

    returns

    true if and only if this language contains the empty string.

  5. abstract def productArity: Int

    Permalink
    Definition Classes
    Product
  6. abstract def productElement(n: Int): Any

    Permalink
    Definition Classes
    Product

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def *: RegularLanguage

    Permalink
  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. def ?: Alt

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def contains(tokens: List[String], cliConfig: CliConfig): UIO[Boolean]

    Permalink

    Checks to see if the input token list is a member of the language.

    Checks to see if the input token list is a member of the language.

    returns

    true if and only if tokens is in the language.

  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def productIterator: Iterator[Any]

    Permalink
    Definition Classes
    Product
  19. def productPrefix: String

    Permalink
    Definition Classes
    Product
  20. def rep(min: Option[Int] = None, max: Option[Int] = None): RegularLanguage

    Permalink
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  22. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. def |(other: String): RegularLanguage

    Permalink
  27. def |(other: RegularLanguage): RegularLanguage

    Permalink
  28. def ~(other: String): RegularLanguage

    Permalink
  29. def ~(other: RegularLanguage): RegularLanguage

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped