musiKk / plyj

A Java parser written in Python using PLY.
Other
150 stars 69 forks source link

Can I get comments in the code? #48

Open WeiFoo opened 8 years ago

WeiFoo commented 8 years ago

This is a great tool for python. Actually, I wanna have the block comments in the java code. Is it possible to that infomation?

Thanks,

WARNING: Token 'BLOCK_COMMENT' defined, but not used
WARNING: Token 'LINE_COMMENT' defined, but not used
WARNING: There are 2 unused tokens
Generating LALR tables
musiKk commented 8 years ago

As you found out, there are already tokens in place for comments which are not used. I'm not exactly sure how one would go about putting comments in the model as they can appear basically everywhere. So every source element would need a comment array and additionally a trailing comment array for the trailing comments of parsed code. Then we would need a way to parse them without cluttering every rule of the parser. I'm sure there are good ways to do this, I just don't know any right now. :)