Exemple #1
0
    lexpr()
    {
        KurumiToken current = get_current_token();

        switch (current.type)
        {
        case TokenType.Identifier:
            KurumiKeyword keyword = current.is_keyword();
            if (keyword == KurumiKeyword.UNKNOWN)
            {
                KurumiToken n = get_current_token(1);
                if (n == null)
                {
                    return;
                }
                OperatorType type = n.to_operator_type();
                if (type == OperatorType.COLON)
                {
                    KurumiNumber number = goto_storage.get(current.data);
                    number.number = expression.size();
                    next();
                    next();
                }
                else if (type == OperatorType.LBRACKET)
                {
                    function_call(current, 0);
                }
                else
                {
                    rexpr();
                }
            }
            else
            {
                keyword_expression(keyword);
            }
            break;

        case TokenType.Operator:
            next();
            return;

        default:
            throw new Exception("Identifier or Keyword is expected in the left-sided expression.");
        }
    }
Exemple #2
0
    print(KurumiScript script, KurumiValueList args)
    {
        int size = args.size();

        for (int i = 0; i < size; i++)
        {
            KurumiValue v = args.pop();
            Console.WriteLine(v.to_string());
        }
        args.add(new KurumiNull());
    }
Exemple #3
0
    interpret()
    {
        while (vp < expression.size() && !freeze)
        {
            KurumiValue value = expression[vp++];
            switch (value.type)
            {
            case KurumiValueTypes.Command:
                execute_command((KurumiCommand)value);
                break;

            case KurumiValueTypes.String:
            case KurumiValueTypes.Number:
                value_stack[sp++] = value;
                break;
            }
        }
    }