Example #1
0
        protected object ParseObject(ITypeBuilderRegistry registry, ITypeBuilder builder, object instanceState)
        {
            Match('{');
            SkipWhitespace();

            var objectBuilder = builder.CreateObjectBuilder(registry);
            var @object = objectBuilder.CreateNewObject(registry, instanceState);

            while (Peek() != '}')
            {
                var memberName = ParseString();
                SkipWhitespace();
                Match(':');

                var memberState = objectBuilder.GetMemberState(memberName, @object);
                objectBuilder.SetMember(memberName, @object,
                                        Parse(registry, objectBuilder.GetMemberBuilder(registry, memberName),
                                              memberState));

                SkipWhitespace();

                if (!TryMatch(','))
                {
                    break;
                }
                SkipWhitespace();
            }
            Match('}');
            return objectBuilder.GetObject(@object);
        }