mirror of
https://github.com/mudabbir-ahmad/UNI-PROG3-CW2-DYOPL.git
synced 2026-10-08 04:00:20 +00:00
Enhance RobotLang grammar and visitor to support student ID extraction
This commit is contained in:
1 parent
3fc4eac47b
commit
936f807449
4 files changed
+34
-16
No files matched your search
@@ -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 ;
|
||||
Reference in new issue
Block a user