// A <<jump>> command, which immediately jumps to another node, given an // expression that resolves to a node's name. public override int VisitJumpToExpression([NotNull] YarnSpinnerParser.JumpToExpressionContext context) { // Evaluate the expression, and jump to the result on the stack. this.Visit(context.expression()); this.compiler.Emit(OpCode.RunNode, context.Start); return(0); }
/// <summary> /// Exit a parse tree produced by the <c>jumpToExpression</c> /// labeled alternative in <see cref="YarnSpinnerParser.jump_statement"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitJumpToExpression([NotNull] YarnSpinnerParser.JumpToExpressionContext context) { }
public override IType VisitJumpToExpression([NotNull] YarnSpinnerParser.JumpToExpressionContext context) { // The expression's type must resolve to a string. return(CheckOperation(context, new[] { context.expression() }, Operator.None, "jump statement", BuiltinTypes.String)); }
/// <summary> /// Visit a parse tree produced by the <c>jumpToExpression</c> /// labeled alternative in <see cref="YarnSpinnerParser.jump_statement"/>. /// <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 VisitJumpToExpression([NotNull] YarnSpinnerParser.JumpToExpressionContext context) { return(VisitChildren(context)); }