Ejemplo n.º 1
0
        private void LoadStruct(StructLexer lexer, List <Attribute> attrs)
        {
            string name = lexer.GetNextToken(StructTokenType.String);

            if (_curStructFile.GetStructByName(name) != null)
            {
                throw new Exception("Duplicate structure name '" + name + "'");
            }

            LoadAttributes(lexer, attrs);

            StructDef structDef = new StructDef(_curStructFile, name);

            foreach (Attribute attr in attrs)
            {
                try
                {
                    structDef.SetAttribute(attr.Key, attr.Value, attr.Position);
                }
                catch (ParseException ex)
                {
                    _errors.Add(ex);
                }
            }

            LoadFieldGroup(lexer, structDef, null);
            _curStructFile.Add(structDef);
        }