-
Notifications
You must be signed in to change notification settings - Fork 9
Failed to parse formal usage specification? #76
Comments
I admit the error message could be better, but it's a simple fix: simply add the "options" title, that indicates to neodoc/docopt to start parsing options: #!/usr/bin/env node
"use strict";
var syntax;
syntax = `\
Usage: animal.js [options]
options:
--cow Pretend to be a cow.
`;
require("neodoc").run(syntax); Checkout testcases.docopt to see what else is possible :) Edit: remember you can also quickly try things out here: https://felixschl.github.io/neodoc |
Incidentally, I removed the spaces before
I was about to append this to my issue here, but your reply was first. I will add the options heading to simply make this work, but that seems contrary to what docopt documents on their website:
Further, it appears that they only require leading hyphens on a line.
Why is it required to have the "options:" header? Is this parser not compliant with docopt's style? |
Yes, there is a difference in behavior currently, but I certainly see the appeal Some other differences that might interest you:
I have been toying with the idea to make the scanning phase extensible, to allow On a related note, there are plans to expand options by their section name #57, |
Ok. Well, since this is a known deviation from the spec, I suppose that I should close this issue. It would be nice to get some of these documented in the README so others don't have the same issues as I had. I really appreciate the thoroughness in your answer. |
I will update the README accordingly, thank you for reporting this issue. |
I'm trying to find a good parser for JavaScript and I am struggling. docopt (npm module) really doesn't like my syntax even though the website's Python parser thinks this is splendid. neodoc also chokes. Is there something I can do to fix this?
Here's my code:
And here's the message.
The text was updated successfully, but these errors were encountered: