Esempio n. 1
0
        public ObjWastFuncContext(ObjWastModuleContext module)
        {
            Module = module;

            variables = new List <ObjWastVariable>();
            body      = new ObjWastCallableBodyContext(this);
        }
Esempio n. 2
0
        private void ParseModule()
        {
            Stack <ObjWastTranspilerContext> contextStack = new Stack <ObjWastTranspilerContext>();
            var context = new ObjWastModuleContext();

            contextStack.Push(context);

            string module = ParseStatementStart();

            if (module != "module")
            {
                throw new Exception();
            }

            while (contextStack.Count > 0)
            {
                if (PeekSignificant() == '(')
                {
                    string statement = ParseStatementStart();

                    var nextContext = contextStack.Peek()?.GetContext(statement, this);

                    contextStack.Push(nextContext);
                }
                else if (PeekSignificant() == ')')
                {
                    ParseStatementEnd();
                    contextStack.Pop();
                }
                else
                {
                    if (contextStack.Peek() == null)
                    {
                        while (PeekSignificant() != ')' && Peek() != '(')
                        {
                            Read();
                        }
                    }
                    else
                    {
                        contextStack.Peek().Parse(this);
                    }
                }
            }

            string wast = context.ToWast();
        }
Esempio n. 3
0
        public OwType ParseType(ObjWastModuleContext module, string name = null)
        {
            name = name ?? ParseName();

            return(module.ResolveType(name));
        }
Esempio n. 4
0
 public ObjWastStructContext(ObjWastModuleContext module)
 {
     Module = module;
 }