EDITAnd if you let your parser output an AST, you can easily merge all the text that one or more CHUNK's match into a single AST, whose inner token is of type CHUNK, like this:grammar Text;options { output=AST;}...chunk : CHUNK+ -> {new CommonTree(new CommonToken(CHUNK, $text))} ;... 这篇关于如何使用antlr在两个终端规则中以不同的方式解析特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 13:06