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

+8 -2
View File
@@ -1,8 +1,14 @@
from RobotLangVisitor import RobotLangVisitor
class RobotLangVisitorUser(RobotLangVisitor):
def __init__(self, student_id="2320390"):
self.student_id = student_id
def __init__(self):
self.student_id = "Unknown"
def visitHeader(self, ctx):
# Extract the number directly from the script
self.student_id = ctx.NUMBER().getText()
# Continue walking the rest of the tree
return self.visitChildren(ctx)
def visitMoveStat(self, ctx):
val = ctx.NUMBER().getText()