How to parse groovy code?

前端 未结 2 1891
陌清茗
陌清茗 2020-12-31 02:48

Since groovy is good at parsing nearly anything, a search on how to parse groovy code will not reveal any good results - so I hope that the SO community is able to help :-)<

2条回答
  •  时光说笑
    2020-12-31 03:26

    You should have an intensive look at the GroovyDocTool class source.

    GroovyDoc uses the GroovyLexer and GroovyRecognizer to parse class texts (to generate GroovyDoc HTML documentation files, similar to JavaDoc HTML files) and utilizes these classes to create an AST from the given source text.

    The generated AST and the source code text are used to walk through the class structure (see SimpleGroovyClassDocAssembler), extract comments and various other meta-data to fill the GroovyDoc specific data structures.

提交回复
热议问题