// Move our pointer to the left. public VisitResult VisitMove_Left([Antlr4.Runtime.Misc.NotNull] BFParser.Move_LeftContext context) { if (memPos == 0) // Wrap around to the furthest right. { memPos += memSize - 1; var datPtr = GetValue(ptr); // Get data pointer. SetValue(ptr, IntToPtr(AddSub32(PtrToInt(datPtr), false, memSize - 1))); // Do the math operations to our pointer, which involves converting it than reconverting it. } else // Move left. { memPos--; var datPtr = GetValue(ptr); // Get data pointer. SetValue(ptr, IntToPtr(AddSub32(PtrToInt(datPtr), true, 1))); // Do the math operations to our pointer, which involves converting it than reconverting it. } return(null); }
/// <summary> /// Exit a parse tree produced by the <c>Move_Left</c> /// labeled alternative in <see cref="BFParser.instruction"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitMove_Left([NotNull] BFParser.Move_LeftContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>Move_Left</c> /// labeled alternative in <see cref="BFParser.instruction"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitMove_Left([NotNull] BFParser.Move_LeftContext context) { return(VisitChildren(context)); }