FirstOfByArgIndex
Will take all parsers specified, each attempting to parse the remaining arguments. If none succeed, will return the errors from all parsers. If only one succeeds, will return the success of that parser. If multiple succeed, will return the first success order wise.
Multi example: --key-1=value-1 --key-2=value-2 Both succeed with Key1("value-1")
and Key2("value-2")
. Key1("value-1")
would be the success that is returned.
This is useful when you want to be able to parse an ADT, and have the results come back in a fixed order. In the above example, if you had 2 separate list parsers for key-1
and key-2
, you would not know what order they were parsed in. But, if you combined them into an ADT, used Params.firstOf, and Params.repeated, then you would be able to know what order things were parsed in:
- --key-1=value-1 --key-2=value-2 ->
List(Key1("value-1"), Key2("value-2"))
- --key-2=value-2 --key-1=value-1 ->
List(Key2("value-2"), Key1("value-1"))
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Attributes
- Definition Classes
Attributes
- Definition Classes
Inherited methods
Attributes
- See also
- Inherited from:
- Params
Attributes
- Inherited from:
- Parser
Attributes
- Inherited from:
- Parser
Attributes
- Inherited from:
- Parser
Attributes
- Inherited from:
- Parser
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Params
Attributes
- Inherited from:
- Params
Attributes
- Inherited from:
- Params
Attributes
- See also
- Inherited from:
- Params