private SigoSchema ParseObject() { Next(); var ret = new ObjectSchema { Flags = ParseFlags() }; while (true) { if (t.Kind == Kind.Close) { Next(); return(ret); } var key = ReadKey(); var optional = ReadKind(Kind.Question); var hasColon = ReadKind(Kind.Colon); SigoSchema value; if (hasColon) { value = ParseOr(); } else if (SigoSchema.Context.ContainsKey(key)) { value = SigoSchema.Context[key]; } else { throw new InvalidOperationException(Expected("':'")); } ret.Add(key, value, optional); // skip 1 comma or semicolon if it exists if (t.Kind == Kind.Comma || t.Kind == Kind.SemiColon) { Next(); } } }