-
Notifications
You must be signed in to change notification settings - Fork 0
Parsing
Parsing in KWCommands is the first and most important step in Command Dispatch Process, the CommandParser
takes the Command Line String and translates into a TokenList of Inputs
, then based on this list, it tries to find command and argument combinations that matches the Inputs
list.
Currently, no, maybe in the future? I'm not sure. KWCommands Parsing System was written in a way that minor changes would enable it to be extended, but I don't have plans to do so. Also this would make KWCommands have no standard way of writing command line string, but suggestions of new object formats to be integrated in KWCommands are welcome.
Input tokens does not change after parsed, and cannot be changed, but if you look into ListArgumentType
, it takes a ListInput
, but you could pass a sequence of SingleInput
and it treats as ListInput
, it happens because ListInput
is treated specially, the parsing post-processing wraps SingleInput
into ListInput
when applicable, but it does not change the original stream of tokens, and it is not particularly for ListArgumentType
, this applies to any ArgumentType
that takes ListInput
. This does not happens with Maps
, they must have {
and }
enclosing them.
Without hacks, no, Input token stream is not currently exposed through API, you surely could access Input token, but only through ArgumentParser, and not the entire stream.