groc icon indicating copy to clipboard operation
groc copied to clipboard

support Java @param annotations

Open pmlopes opened this issue 12 years ago • 6 comments

In java the format is:

@param varname text

there is no type data, this breaks groc with:

! Failed to parse doc tags /home/.../Engine.java: Cannot read property '1' of null
   TypeError: Cannot read property '1' of null
      at Object.module.exports.DOC_TAGS.param.parseValue (/home/paulo/Projects/oss/groc/lib/doc_tags.coffee:125:31)
      at Object.module.exports.Utils.parseDocTags (/home/paulo/Projects/oss/groc/lib/utils.coffee:472:41)
      at Default.module.exports.Base.renderFile (/home/paulo/Projects/oss/groc/lib/styles/base.coffee:31:20)
      at /home/paulo/Projects/oss/groc/lib/project.coffee:74:24
      at fs.js:266:14
      at Object.oncomplete (fs.js:107:15)

The issue is that there is no {type} and the regex seems to always expect it... can it be optional? the reason behind it is that forcing to add {type} to existing javadoc will break javadoc...

pmlopes avatar Oct 04 '13 10:10 pmlopes

+1

pampul avatar Oct 10 '13 16:10 pampul

I did some further tests and this also requires changes to:

@return Where i get a similar exception

pmlopes avatar Oct 10 '13 18:10 pmlopes

+1

sevanspace avatar Nov 26 '13 19:11 sevanspace

Could you please test if my fork works for you: https://github.com/sjorek/groc … I appreciate any feedback …

:smile:

sjorek avatar Nov 26 '13 20:11 sjorek

@sjorek Hm, I couldn't get your fork to solve this issue.

sevanspace avatar Nov 27 '13 00:11 sevanspace

… sorry, to hear; I guess the problem isn't changing the corresponding regular expressions (esp. making the type optional is really easy). It is more the lack of a proper code-structure to collect all the differences in doctag-implementations in a clean and maintainable way. My fork does is a first attempt to collect these diversities. If you take a look at the language definition file lib/languages.coffee you will notice, that some language definitions have a doc_tags entry, and some don't … so in order to make it run NOW with Java-doctags, you could fork my version, duplicate lib/doc_tags.coffee, alter the new file accordingly, and add this new entry to the Java-Registration in either your own language-definition file or in the original language definition file. I promise to take care of these changes, if you offer a pull-request back to me and I'll try to push it further into the original implementation.

Well, I have to admit, that this only works, if one of you is willing to do so … :smiley:

sjorek avatar Nov 27 '13 14:11 sjorek