I am new in using 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. I change following lines in code.
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
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
/* 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. The Java1.5.jj file should be first changed and then generated it was keypoint that i stacked.