CompletionSupport
adds completion capability to parsers.
Collection of data types allowing definition of structured parser completions.
Collection of data types allowing definition of structured parser completions.
A Completions
instance can contain multiple CompletionSet
s instances. A CompletionSet
provides a set of
Completion
entries and is tagged with a CompletionTag
.
Sets allow structuring the completion entries into groups, each group tagged with a label
(plus optional
description
and meta
, the latter allowing e.g. encoding visual attributes for the set).
Sets also feature a score, which defines the order between sets within the Completions
instance.
Each Completion
entry within a set has a value
, a score
and a meta
:
the score allows ordering the entries within a set, and the meta can e.g. be used to assign a representation style
for a particular completion entry.
Note that specifying tags and sets is optional: if no tag is specified upon creation,
Completions
instances create a unique default set with an empty tag.
This component extends RegexParsers
with completion capability.
This component extends RegexParsers
with completion capability. In particular,
it provides completions for the literal
parser.
Note that completions for the regex
parser are undefined by default and can be specified
with the %>
operator.
This trait adds specialized parsers for dealing with large lists of terms, both in terms of parsing (using a fast trie-based lookup) and completion (supporting fuzzy matching)
CompletionSupport
adds completion capability to parsers.When mixed-in, this trait extends the scala.util.parsing.combinator.Parsers.Parser type with the abstract method com.nexthink.utils.parsing.combinator.completion.CompletionSupport.Parser#completions which returns a instance of com.nexthink.utils.parsing.combinator.completion.CompletionTypes.Completions for a certain input.
Combinators are overloaded to cover the additional completion aspect, so that no change is required in the grammar.
Note that the derived trait com.nexthink.utils.parsing.combinator.completion.RegexCompletionSupport can be mixed-in with
RegexParsers
to automatically obtain completion behavior for string literals.A set of additional operators allow defining completions and specifying structural properties of completions (tag, score, meta, etc.) for a
Parser
.