Example #1
0
        Instruction AnalyseValueInstruction(Tokenizer.Token[] Tokens, int index, out int tokenCount)
        {
            InstructionValue result = new InstructionValue();

            result.Value = new Value();
            if (Tokens[index].TokenName == Tokenizer.TokenName.String)
            {
                result.Value.Type        = Value.DataType.String;
                result.Value.StringValue = Tokens[index].Value;
            }
            else if (Tokens[index].TokenName == Tokenizer.TokenName.Number)
            {
                result.Value.Type         = Value.DataType.Numeric;
                result.Value.NumericValue = decimal.Parse(Tokens[index].Value.Replace(".", ","));
            }
            else if (Tokens[index].TokenName == Tokenizer.TokenName.False)
            {
                result.Value.Type      = Value.DataType.Boolean;
                result.Value.BoolValue = false;
            }
            else if (Tokens[index].TokenName == Tokenizer.TokenName.True)
            {
                result.Value.Type      = Value.DataType.Boolean;
                result.Value.BoolValue = true;
            }
            else if (Tokens[index].TokenName == Tokenizer.TokenName.Undefined)
            {
                result.Value.Type = Value.DataType.Undefined;
            }

            tokenCount = 1;
            return(result);
        }
Example #2
0
        InstructionResult ExecuteInstructionValue(Instruction instruction)
        {
            InstructionValue instructionValue = instruction as InstructionValue;

            return(new InstructionResult()
            {
                Value = instructionValue.Value
            });
        }