Esempio n. 1
0
        private void ParseGlobal_Expr(UDMFParsedMapData dataClass, ParserInfo info)
        {
            UDMFToken tok = scanner.Scan();

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

            var ident     = tok;
            var identText = namePool.GetOrCreate(ident.Text);

            tok = scanner.LookAhead();
            switch (tok.Type)
            {
            case UDMFTokenType.BROPEN:
                ParserInfo.BlockInfo block;
                info.Blocks.TryGetValue(identText, out block);
                ParseBlock(dataClass, identText, block);
                break;

            case UDMFTokenType.EQSIGN:
                if (info.GlobalAssignments.TryGetValue(identText, out var assignment))
                {
                    ParseAssignment_Expr(dataClass, assignment);
                }
                else
                {
                    var val = ParseAssignment_Expr(dataClass, null);
                    unknownGlobalAssignmentsPooled.Add(identText, GetUnknownAssignment(val.Value));
                }
                break;

            default:
                Errors.Add(new UDMFParseError("Unexpected token '" + tok.Text.ToString().Replace("\n", "") + "' found.", 0x0002, tok));
                return;
            }

            return;
        }