public SymbolStack(TSymbolType notFoundVal)
    {
        scopes      = new CL_PooledList <Scope> ();
        pooledDicts = new CL_PooledList <Dictionary <ArrayPointer <byte>, TSymbolType> > ();
        version     = 0;

        notFoundValue = notFoundVal;

        IsDisposed = false;
    }
Example #2
0
        private void ParseBlock(UDMFParsedMapData dataClass, string ident, ParserInfo.BlockInfo?info)
        {
            UDMFToken tok = scanner.Scan();

            if (tok.Type != UDMFTokenType.BROPEN)
            {
                Errors.Add(new UDMFParseError("Unexpected token '" + tok.Text.ToString().Replace("\n", "") + "' found. Expected " + UDMFToken.TokenTypeToString(UDMFTokenType.BROPEN), 0x1001, tok));
                return;
            }

            IUDMFBlock block;

            if (info != null)
            {
                block = (IUDMFBlock)Activator.CreateInstance(info.Value.BlockType);
                info.Value.Delegates.Getter(dataClass).AddBlock(block);
            }
            else
            {
                var newBlock = new UDMFUnknownBlock();
                block = newBlock;

                if (!unknownBlocksPooled.TryGetValue(ident, out var unknownBlocksList))
                {
                    unknownBlocksList = new CL_PooledList <UDMFUnknownBlock> ();
                    unknownBlocksPooled.Add(ident, unknownBlocksList);
                }

                unknownBlocksList.Add(newBlock);
            }

            ParseExpr_List(block, info);

            tok = scanner.Scan();
            if (tok.Type != UDMFTokenType.BRCLOSE)
            {
                Errors.Add(new UDMFParseError("Unexpected token '" + tok.Text.ToString().Replace("\n", "") + "' found. Expected " + UDMFToken.TokenTypeToString(UDMFTokenType.BRCLOSE), 0x1001, tok));
                return;
            }
        }