1
0
Fork 0

fix going to coordinate array

This commit is contained in:
Kevin Matz 2019-07-30 14:45:03 -04:00
parent 33b755efd1
commit a506e6b815
1 changed files with 6 additions and 4 deletions

View File

@ -31,7 +31,8 @@ class ArmCtlListener(ArmControlListener):
# Exit a parse tree produced by ArmControlParser#Go.
def exitGo(self, ctx: ArmControlParser.GoContext):
if ctx.coords() is not None:
self.r.move(ctx.coords().values)
self.r.target = ctx.coords().values
self.r.move()
return
if ctx.name() is None:
logger.error("ERROR: Go command with no name?")
@ -69,13 +70,14 @@ class ArmCtlListener(ArmControlListener):
# Enter a parse tree produced by ArmControlParser#coords.
def enterCoords(self, ctx: ArmControlParser.CoordsContext):
self.values = []
self.index = 0
ctx.values = self.r.target
ctx.index = 0
# Exit a parse tree produced by ArmControlParser#value.
def exitValue(self, ctx: ArmControlParser.ValueContext):
if isinstance(ctx.parentCtx, ArmControlParser.CoordsContext):
ctx.parentCtx.values.insert(ctx.parentCtx.index, ctx.value)
if ctx.parentCtx.index < len(ctx.parentCtx.values):
ctx.parentCtx.values[ctx.parentCtx.index] = ctx.value
# Exit a parse tree produced by ArmControlParser#number.
def exitNumber(self, ctx: ArmControlParser.NumberContext):