Example #1
0
        public override bool compareEqual(LithpPrimitive other)
        {
            // TODO: Find better way to do this
            LithpString otherString = (LithpString)other;

            return(Value == otherString.Value);
        }
Example #2
0
        public static LithpPrimitive Repeat(LithpList parameters, LithpOpChain state,
                                            LithpInterpreter interp)
        {
            LithpString  str = (LithpString)parameters[0];
            LithpInteger n   = (LithpInteger)parameters[1].Cast(LithpType.INTEGER);

            return(new LithpString(new string(str.Value[0], n)));
        }
Example #3
0
        public static LithpPrimitive DictGet(LithpList parameters, LithpOpChain state,
                                             LithpInterpreter interp)
        {
            LithpDict   dict = (LithpDict)parameters[0];
            LithpString key  = (LithpString)parameters[1].Cast(LithpType.STRING);

            return(dict[key]);
        }
Example #4
0
        public static LithpPrimitive DictPresent(LithpList parameters, LithpOpChain state,
                                                 LithpInterpreter interp)
        {
            LithpDict   dict = (LithpDict)parameters[0];
            LithpString key  = (LithpString)parameters[1].Cast(LithpType.STRING);

            return(dict.ContainsKey(key) ? LithpAtom.True : LithpAtom.False);
        }
Example #5
0
        public static LithpPrimitive ParseInt(LithpList parameters, LithpOpChain state,
                                              LithpInterpreter interp)
        {
            LithpString str          = (LithpString)parameters[0].Cast(LithpType.STRING);
            string      dropDecimals = Regex.Replace(str, @"[.][0-9]+$", "");

            return(new LithpInteger(dropDecimals));
        }