Closed lyingdragon closed 4 years ago
That's cool. But as I remember it is using javascript parser under the hood.
ref: https://github.com/jonschlinkert/extract-comments/blob/master/package.json#L28-L31
So it won't be that easy to support general langs. Your in house language probably is similar to JS and that's why it is working.
Thanks for reply. I suppose I misunderstood the phrase "Javascript and any language that uses the same format." Now I know that it's a javascript parser and could be no plan for other format of languages. So I'll continue to use my local repo for my project. As you said, the in-house language's comment block is almost same to js only except the start/end string of comment. No much modification needed for it. Thanks! 👍
Yea, probably should be better to be removed from the description :)
As you said, the in-house language's comment block is almost same to js
I meant that esprima parser successfully parses your language (otherwise this package would throw? hm, interesting), so it's something similar to js. But anyway ;]
@jonschlinkert might be open for "general purpose"? He is god and obsessed with parsers! :laughing:
It is really helpful even though it doesn't support all languages. Inspiring by it, I figured out a way how improve my complex API docs generation using multi-languages. Thanks, @tunnckoCore and @jonschlinkert, god of parsers :)
@lyingdragon sorry for the late reply! FWIW, I was planning on updating this library, and extract-comments to support other languages. I already started going down this path with strip-comments, and as @tunnckoCore I really enjoy parsing lol (I don't think I deserve that high of praise but I appreciate it!).
If there is anything I can do to help or provide guidance I would be happy to.
might be open for "general purpose"?
Yes, I would definitely be interested. I think this would ideally be accomplished with two different parsers and/or tokenizers: one for very quickly extracting comments (and creating code context, like line numbers, etc), and one for actually parsing the comment so it can be used with documentation libs. The first step for me would be to refactor extract-comments
to do something like what I did in strip-comments
(even if we don't use that code here, it would be a useful exercise to figure out the API). Next, we'd do the comment parsing here. I'm open to suggestions and/or PRs on any of it.
Hello, this project is really helpful for me. I suppose that it could be better to support any custom comment strings instead of fixed string
/*
becauseparse-comments
aims to support any languages, I believe.I'm working on source code based API doc generation. My project uses an in-house language which uses
(*
for comment blocks. I forked this and modified to handle it. It worked for me, but the reason why I didn't do PR is I ignored an original optionallowSingleStar
.I'd appreciate if you officially support it.
parse-comments
version I used: v1.0.0