Exemple #1
0
        FunctionBody ParseFunctionBody()
        {
            var statement = new FunctionBody(_current.m_line);

            statement.param_list  = ParseParamList();
            statement.block       = ParseBlock();
            statement.source_name = _lex.GetSourceName();

            return(statement);
        }
Exemple #2
0
        public Dictionary <string, object> InitModule(FunctionBody tree)
        {
            Function func = new Function();

            func.vm           = this;
            func.module_table = new Dictionary <string, object>();
            func.code         = tree;
            func.upvalues     = new Dictionary <string, LocalValue>();
            func.Call();
            return(func.module_table);
        }
Exemple #3
0
        FunctionBody ParseModule()
        {
            var block = new BlockTree(LookAhead().m_line);

            ParseStatements(block.statements);
            if (NextToken().m_type != (int)TokenType.EOS)
            {
                throw NewParserException("expect <eof>", _current);
            }

            FunctionBody fn = new FunctionBody(1);

            fn.source_name = _lex.GetSourceName();
            fn.block       = block;

            return(fn);
        }