jeudi 14 juillet 2016

A ply parser should partly treat comments


I'm trying to produce a ply parser that does not entirely suppress comments.

The typical def t_comment(self, t): r'(/*(.|n)?*/)|(//.)' t.lineno += t.value.count('n')

only counts lines and suppresses the comments. For most of the cases, this is just fine. But at one specific instance I need the comment. Is there a way to parse only this comment at the special place without having to specify all the other places where a comment can occur?


Aucun commentaire:

Enregistrer un commentaire