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

            return(Value == otherString.Value);
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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]);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }