Enhance RobotLang grammar and visitor to support student ID extraction

This commit is contained in:
bobbert committed 2026-04-27 16:09:28 +01:00
1 parent 3fc4eac47b
commit 936f807449
4 files changed
+34 -16

No files matched your search

+5 -4
View File
@@ -1,7 +1,7 @@
grammar RobotLang;
prog: stat+ ;
prog: header stat+ ;
header: ID_PREFIX NUMBER ;
stat: moveStat
| grabStat
| releaseStat
@@ -17,6 +17,7 @@ waitStat: 'WAIT' NUMBER ';' ;
logStat: 'LOG' STRING ';' ;
repeatStat: 'REPEAT' NUMBER '{' stat+ '}' ;
ID_PREFIX: '// STUDENT ID:' ;
NUMBER: [0-9]+ ;
STRING: '"' .*? '"' ;
WS: [ \t\r\n]+ -> skip ;
STRING: '"' .*? '"' {self.text = self.text[1:-1]} ;
WS: [ \t\r\n]+ -> skip ;