[英]JavaCC Lexer Generator Integration the NetBeans Platform
I am new in using JavaCC. 我是使用JavaCC的新手。 I was trying to integrate editor for our company defined language. 我试图集成公司定义语言的编辑器。 I need to change keywords and modify the syntax. 我需要更改关键字并修改语法。 I follow this link as a procedure. 我按照此链接进行操作。 For testing i change the some lines below from the code link. 为了进行测试,我从代码链接中更改了以下几行。 I change keyword finally with require . 我终于用require改变了关键词。 I change following lines in code. 我在代码中更改了以下几行。
JavaParserConstants.java JavaParserConstants.java
int FALSE = 25;
/** RegularExpression Id. */
int FINAL = 26;
/** RegularExpression Id. */
//int FINALLY = 27;
int REQUIRE=27;
/** RegularExpression Id. */
int FLOAT = 28;
/** RegularExpression Id. */
*
*
String[] tokenImage = {
*
"\"false\"",
"\"final\"",
"\"require\"",//fınally
"\"float\"",
SJLanguageHierarchy.java SJLanguageHierarchy.java
private static void init() {
tokens = Arrays.<SJTokenId>asList(new SJTokenId[]{
*
*
new SJTokenId("FALSE", "keyword", 25),
new SJTokenId("FINAL", "keyword", 26),
new SJTokenId("REQUIRE"/*"FINALLY"*/, "keyword", 27),
new SJTokenId("FLOAT", "keyword", 28)
Java1.5.jj Java1.5.jj
/* RESERVED WORDS AND LITERALS */
TOKEN :
{
*
*
| < FALSE: "false" >
| < FINAL: "final" >
| < REQUIRE: "require" >
| < FLOAT: "float" >
But it did not affect still when i am using new integrated "editor" it highlight the old syntax including keyword finally .Any suggestions or advice will be highly appreciated. 但是,当我使用新的集成“编辑器”时,它仍然没有影响,它最终突出显示了包括关键字在内的旧语法。任何建议或意见都将受到高度赞赏。
Thanks to @Theodore Norvell I find out that my code does not work if i change my keywords after generating code. 感谢@Theodore Norvell,我发现如果在生成代码后更改关键字,我的代码将无法正常工作。 The Java1.5.jj file should be first changed and then generated it was keypoint that i stacked. 应该先更改Java1.5.jj文件,然后生成它,这是我堆积的关键点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.