Open KathleenDollard opened 8 months ago
I worry about how "isolating parser support" will affect completions, especially when the completion list of an option should depend on arguments of the command. (Imagine supporting completions for msbuild project.csproj -target:
where the set of available targets depends on what the project defines.)
I think that would be as easy. The parser would parse that, and then the values would be available to the completions subsystem.
It may be valuable to have a single
ValueResult
. This is a working document to help with that decision.A benefit is that binding and other calling code, including that directly using the core parser, would not need to worry about two types.
It is also desirable, or perhaps necessary, to separate the public surface from the internal surface of the parser.
Existing differences:
internal
`IdentifierToken (passed to constructor)Implicit
property and support for it via theCliToken
Option
andArgument
symbolsOnlyTake
as a public method for custom parsing. It is problematic after parsing.An alternate design:
internal class ParsingOptionResult
ValueResult
Implicit
means and who needs it (code differs from what I thought I understood)internal class ParsingArgumentResult
ValueResult
OnlyTake
that does not put it on the publicValueResult
internal class ParsingCommandResult
CommandResult
public class ValueResult
GetRawValue()
GetValueOrDefault<T>()
ToString()
Symbol
Parent
(this is needed as a symbol can be parented to multiple commands)Location
ParseResult
, not as a method on all resultsGetValue
andGetValueOrDefault
or provide names that are more clear, asGetValue
also returns the default valuepublic class CommandResult
Command
ToString()
Parent
(this is needed as a symbol can be parented to multiple commands)Location
Children
The internal types would be used during parsing (when the tokens are converted to results) and then the
ValueResult
instances collected into the publicParseResult
.