private TomlTable TryCreateTable(TomlObject obj, PathSettings settings) { if (settings.HasFlag(PathSettings.CreateTables) && obj is TomlTable tbl) { var table = tbl.AddTable(this.key, tbl.CreateAttachedTable()); return(table); } return(null); }
protected TomlObject VerifyType(TomlObject obj, Func <string, TomlObject> onError, PathSettings settings) { if (settings.HasFlag(PathSettings.VerifyType)) { return(obj.TomlType == this.segmentType ? obj : onError($"Cannot apply '{this.ToString()}' with type '{this.segmentType}' because TOML table " + $"row has incompatible type '{obj.ReadableTypeName}'.")); } return(obj); }