简体   繁体   中英

How to generate ANTLR recognizer again in Intellij after editing grammar

I have written a grammar to rotate a robot.

grammar RobotController;

//Parser
program: statement+;
statement: rotateStatements;
rotateStatements: ROTATE EOS;

//lexer
ROTATE: 'rotate';
EOS: ';';

Then i created ANTLR recognizer and it worked, It created some Java files with some code. Later on I modified my grammar to

grammar RobotController;

//Parser
program: statement+;
statement: rotateStatements;
rotateStatements: ROTATE (LPAREN direction RPAREN)? EOS;
direction: STRING;

//lexer
ROTATE: 'rotate';
LPAREN: '(';
RPAREN: ')';
EOS: ';';
STRING:  '"' (~[\r\n])* '"';

Now I am creating ANTLR recognizer again but the previously generated Java files remain the same in the system. No new code is added to them.

Does anyone know how to generate ANTLR recognizer after modifying the grammar?

信息:重新启动 Intellij 并使缓存无效解决了问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM