[英]Is there a way to specify java annotations in antlr grammar files?
I'm looking for a way to include a few additional strings in output .java files generated from antlr. 我正在寻找一种在从antlr生成的输出.java文件中包括一些其他字符串的方法。 Is there a comprehensive listing of available directives?
是否有可用指令的完整列表? For example, given parser output like this:
例如,给定的解析器输出如下:
package com.foo.bar; //<-- this can be generated with @header { .... }
//antlr generated
import org.antlr.runtime.*;
...
//<-- is there a way to generate anything here?
public class MyParser {
//<--- or here?
public void f1(){ ... }
}
Is there a way to generate strings that appear after the import statements (eg class-level annotations) or possibly method annotations? 有没有一种方法可以生成出现在import语句(例如,类级注释)或方法注释之后的字符串?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.