Example #1
0
 public void RegisterExpressionParsers()
 {
     BaseParser.RegisterParserType(typeof(uint), typeof(NumericValueExpressionParser <uint>));
     BaseParser.RegisterParserType(typeof(int), typeof(NumericValueExpressionParser <int>));
     BaseParser.RegisterParserType(typeof(float), typeof(NumericValueExpressionParser <float>));
     BaseParser.RegisterParserType(typeof(double), typeof(NumericValueExpressionParser <double>));
 }
        public static double ContractMultiplier()
        {
            DataNode rootNode = currentParser.currentDataNode.Root;
            ExpressionParser <double> parser = BaseParser.GetParser <double>();

            return(parser.ParseExpression(currentParser.currentKey, "Prestige().Multiplier() * @/targetBody.Multiplier()", currentParser.currentDataNode));
        }
        protected static ExpressionParser <T> GetParser <T>(BaseParser orig)
        {
            ExpressionParser <T> newParser = GetParser <T>();

            if (newParser == null)
            {
                throw new NotSupportedException("Unsupported type: " + typeof(T));
            }

            newParser.Init(orig.expression);
            newParser.parseMode       = orig.parseMode;
            newParser.currentDataNode = orig.currentDataNode;
            newParser.currentKey      = orig.currentKey;
            newParser.spacing         = orig.spacing;

            return(newParser);
        }