Esempio n. 1
0
        public override Yarn.Type VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context)
        {
            ParserRuleContext[] terms = new[] { context.expression() };

            // - supports only number types
            return(CheckOperation(context, terms, "-", Yarn.Type.Number));
        }
Esempio n. 2
0
        // -expression
        public override int VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context)
        {
            Visit(context.expression());

            // TODO: temp operator call
            compiler.Emit(ByteCode.CallFunc, TokenType.UnaryMinus.ToString());

            return(0);
        }
Esempio n. 3
0
        public override Yarn.IType VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context)
        {
            ParserRuleContext[] terms = new[] { context.expression() };

            var @operator = CodeGenerationVisitor.TokensToOperators[context.op.Type];

            Yarn.IType type = CheckOperation(context, terms, @operator, context.op.Text);
            context.Type = type;
            return(type);
        }
Esempio n. 4
0
        // -expression
        public override int VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context)
        {
            Visit(context.expression());

            // TODO: temp operator call

            // Indicate that we are pushing one parameter
            compiler.Emit(OpCode.PushFloat, new Operand(1));

            compiler.Emit(OpCode.CallFunc, new Operand(TokenType.UnaryMinus.ToString()));

            return(0);
        }
Esempio n. 5
0
        // -expression
        public override int VisitExpNegative(YarnSpinnerParser.ExpNegativeContext context)
        {
            this.GenerateCodeForOperation(Operator.UnaryMinus, context.op, context.Type, context.expression());

            return(0);
        }
 /// <summary>
 /// Visit a parse tree produced by the <c>expNegative</c>
 /// labeled alternative in <see cref="YarnSpinnerParser.expression"/>.
 /// <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 VisitExpNegative([NotNull] YarnSpinnerParser.ExpNegativeContext context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// Exit a parse tree produced by the <c>expNegative</c>
 /// labeled alternative in <see cref="YarnSpinnerParser.expression"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitExpNegative([NotNull] YarnSpinnerParser.ExpNegativeContext context)
 {
 }