Switch to new Parser.

This commit is contained in:
Brent Simmons
2024-11-15 22:59:51 -08:00
parent c3f063ae4a
commit 85d1a8fe7a
79 changed files with 187 additions and 219 deletions

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Parser"
BuildableName = "Parser"
BlueprintName = "Parser"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Parser"
BuildableName = "Parser"
BlueprintName = "Parser"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -1,6 +1,6 @@
//
// FeedParser.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/20/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
@@ -50,6 +50,22 @@ public struct FeedParser {
}
}
public static func parse(_ parserData: ParserData, _ completion: @Sendable @escaping (ParsedFeed?, Error?) -> Void) {
Task {
do {
let parsedFeed = try await parseAsync(urlString: parserData.url, data: parserData.data)
Task { @MainActor in
completion(parsedFeed, nil)
}
} catch {
Task { @MainActor in
completion(nil, error)
}
}
}
}
public static func parseAsync(urlString: String, data: Data) async throws -> ParsedFeed? {
try parse(urlString: urlString, data: data)

View File

@@ -1,6 +1,6 @@
//
// FeedParserError.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/24/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// FeedType.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/20/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// JSONFeedParser.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// RSSInJSONParser.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/24/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// ParsedAttachment.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/20/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// ParsedAuthor.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/20/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// ParsedFeed.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/20/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// ParsedHub.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/20/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// ParsedItem.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/20/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// AtomParser.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// RSSFeedTransformer.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// RSSParser.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// JSONDictionary.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/24/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// JSONUtilities.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 12/10/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// String+RSParser.swift
// RSParser
// String+Parser.swift
// Parser
//
// Created by Nate Weaver on 2020-01-19.
// Copyright © 2020 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// AtomParserTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/26/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// EntityDecodingTests.swift
// RSParserTests
// ParserTests
//
// Created by Brent Simmons on 12/30/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// FeedParserTypeTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// HTMLLinkTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// HTMLMetadataTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// JSONFeedParserTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/26/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// OPMLTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// RSSInJSONParserTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/26/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// RSSParserTests.swift
// RSParser
// Parser
//
// Created by Brent Simmons on 6/26/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.