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.
true if and only if tokens
is in the language.
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.).
The string to use for calculation of the Brzozowski derivative.
Brzozowski derivative wrapped in an UIO instance.
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:
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.
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.
true if and only if this language contains the empty string.
Cat(left, right)
represents the concatenation of two regular languages.