Beispiel #1
0
 public void GenerateMethod(function_definition Stmt, Context context, TypeBuilder Class)
 {
 }
Beispiel #2
0
        private stmt ParseWord()
        {
            if (Current == TokenType.word)
            {
                if (!IsNextEOT && Next == TokenType.symbol)
                {
                    if (Next == '=')
                    {
                        setvar stmt = new setvar();
                        stmt.name = Current;
                        Step(); Step();
                        stmt.value = ParseExpr();
                        return stmt;
                    }
                    else
                    {
                        return null;
                    }
                }
                else if (Current == "var")
                {
                    declarevar stmt = new declarevar();
                    Step(); //Step over "var"
                    stmt.name = Current;
                    Step(); //Step over name
                    if (Current == "as")
                    {
                        Step(); //Step over "as"
                        stmt.type = Current;
                        Step(); //Step over type
                    }
                    else
                    {
                        stmt.type = "object";
                    }

                    if (Current == '=')
                    {
                        Step(); //Step over =
                        stmt.value = ParseExpr();
                    }
                    return stmt;
                }
                else if (Current == "def")
                {
                    function_definition stmt = new function_definition();
                    Step(); //Step over def
                    stmt.name = Current;
                    Step(); //Step over fname
                    Step(); //Step over (
                    stmt.args = ParseArgs();
                    Step(); //Step over )
                    if (Current == "as")
                    {
                        Step(); //Step over "as"
                        stmt.type = Current;
                        Step(); //Step over type
                    }
                    else
                    {
                        stmt.type = "object";
                    }
                    stmt.body = ParseStmt();
                    return stmt;
                }
                else if (Current == "return")
                {
                    return_value ret = new return_value();
                    Step(); //Step over return
                    ret.returnvalue = ParseExpr();
                    return ret;
                }
                else if (Current == "class")
                {
                    class_definition cls = new class_definition();
                    Step(); //Step over "class"
                    cls.name = Current;
                    Step(); //Step over name
                    if(Current == ':')
                    {
                        Step(); //Step over :
                        cls.interfaces = ParseClassImplemetations();
                        Step(); //Step over class implementations
                    }
                    cls.body = ParseStmt();
                    return cls;
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return null;
            }
        }