Example #1
0
        Instruction AnalyseNegation(Tokenizer.Token[] tokens, int index, out int tokenCount)
        {
            InstructionNegation instructionNegation = new InstructionNegation();

            Tokenizer.Token[] subTokens = GetTokensTo(tokens, 1, (t) => t.TokenType == Tokenizer.TokenType.Operator || t.TokenName == Tokenizer.TokenName.LineEnd);

            int tc = 0;

            instructionNegation.Instruction = AnalyseInstruction(subTokens, 0, out tc);

            tokenCount = subTokens.Length + 1;
            return(instructionNegation);
        }
Example #2
0
        InstructionResult ExecuteInstructionNegation(Instruction instruction)
        {
            InstructionNegation instructionNegation = instruction as InstructionNegation;

            Value value       = ExecuteInstruction(instructionNegation.Instruction).Value;
            Value resultValue = new Value()
            {
                Type      = Value.DataType.Boolean,
                BoolValue = !value.BoolValue
            };

            return(new InstructionResult()
            {
                Value = resultValue
            });
        }