-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Hierarchical parsing of command line arguments with the built-in command-line #16
Comments
Just realized this doesn't fit the purpose of Syntax Parse Bee, sorry! I may try to enhance it to make it a worthwhile example... if I get the time (and an idea). Feel free to discard it. |
Hm? This looks like a perfect fit to me --- two useful syntax-parse macros. It's fine that these would work as normal syntax rules. |
bennn
added a commit
to syntax-objects/syntax-parse-example
that referenced
this issue
Oct 28, 2021
bennn
added a commit
to syntax-objects/syntax-parse-example
that referenced
this issue
Nov 1, 2021
bennn
added a commit
to syntax-objects/syntax-parse-example
that referenced
this issue
Nov 1, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Macro
The purpose of the first macro is to make it easy to parse command line arguments in a hierarchical way using the built-in
command-line
form. The second macro is an additional helper that displays the help message automatically when no command-line argument is specified at this level, which avoids the case where the user tries one argument is then has no information about what to do next.Example
Before and After
I've heard several times that
command-line
can't parse arguments hierarchically. Well, turns out it's easy withsyntax-parse
! (although admittedly,syntax-rules
would have worked too. But at least withsyntax-parse
it's easy to extend the macro to parse additional keywords, such as if one wants to shift the arguments by more than 1.)These macros were written for a PR to
resyntax
. See the diff there.Licence
Yes.
Yes.
The text was updated successfully, but these errors were encountered: