|
|
|
|
|
by jawher
4152 days ago
|
|
Parser combinators would certainly have been easier for me, the library author but not necessarily so for the end user. Contrast how it is done now: [-R [-H | -L | -P]] [-fi | -n] [-apvX] SRC... DST
With a parser combinator based approach: and(
optional(and('-R', or('-H', '-L', '-P'))),
optional(or(
'-fi',
'-n'
)
),
optional('-apvX'),
repeatable('SRC'),
'DST')
And this didn't even handle the fact that options order is not important. |
|