-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing issues when option has separator attribute and when empty value provided... fails #420
Comments
my fix public static IEnumerable<Token> Partition(
IEnumerable<Token> tokens,
Func<string, Maybe<TypeDescriptor>> typeLookup)
{
return from tseq in tokens.Pairwise(
(f, s) =>
f.IsName() /*&& s.IsValue() fix*/ public static Result<IEnumerable<Token>, Error> ExplodeOptionList(
Result<IEnumerable<Token>, Error> tokenizerResult,
Func<string, Maybe<char>> optionSequenceWithSeparatorLookup)
{
var tokens = tokenizerResult.SucceededWith().Memorize();
var replaces = tokens.Select((t, i) =>
optionSequenceWithSeparatorLookup(t.Text)
.MapValueOrDefault(sep => Tuple.Create(i + 1, sep),
Tuple.Create(-1, '\0'))).SkipWhile(x => x.Item1 < 0).Memorize();
var exploded = tokens.Select((t, i) =>
{
return replaces.FirstOrDefault(x =>
{
return x.Item1 == i && t.IsValue();//fix
}).ToMaybe() |
Separately found and fixed this issue and happy to put a PR in if you're happy? |
wo-roberts
pushed a commit
to wo-roberts/commandline
that referenced
this issue
Jul 28, 2020
…umerable types with separator char
wo-roberts
added a commit
to wo-roberts/commandline
that referenced
this issue
Jul 28, 2020
…umerable types with separator char
wo-roberts
added a commit
to wo-roberts/commandline
that referenced
this issue
Jul 28, 2020
…umerable types with separator char
wo-roberts
added a commit
to wo-roberts/commandline
that referenced
this issue
Jul 28, 2020
…umerable types with separator char
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ProcessBooks -b -v NO
If option has separator attribute and when empty value provided... fails; it considers other argument as its values..
In this case; -b has value -v and NO;
The text was updated successfully, but these errors were encountered: