예제 #1
0
        // 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);
        }
예제 #2
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)
 {
 }
예제 #3
0
 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));
 }
예제 #4
0
 /// <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));
 }