A simple parser combinator, created in Swift.
ParserCombinator attempts to create a simple and user-friendly way to parse strings into objects and structures. Technical terms are largely avoided and convenience parsers are provided.
The parser can be enacted by calling the 'run' function:
myParser.run(on: "String to parse")
The unit tests provide examples of using the parser and creating your own parsing rules.
Pull requests for improvements are welcome.
There are no external requirements for this project, just Swift.
- iOS 8.0+ / macOS 10.9+ / tvOS 9.0+ / watchOS 2.0+
- Xcode 11+
- Swift 5.1+
For previous versions of Xcode and Swift please see prior releases.
The Swift Package Manager is the official tool for managing the distribution of Swift code. It is currently available for all Apple platforms. It can also be used with Linux but this project does not fully support Linux at this point in time.
If you use it to manage your dependencies, simply add ParserCombinator to the dependencies value of your Package.swift file.
dependencies: [
.package(url: "https://github.com/Tigerpixel/ParserCombinator.git", from: "2.1.0")
]
ParserCombinator is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ParserCombinator"
If you use Carthage to manage your dependencies, simply add the following line to your Cartfile:
github "tigerpixel/ParserCombinator"
If you use Carthage to build your dependencies, make sure you have added ParserCombinator.framework
to the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase.
- Add the ParserCombinator repository as a submodule of your application’s repository.
- Run
git submodule update --init --recursive
from within the ParserCombinator folder. - Drag and drop
ParserCombinator.xcodeproj
into your application’s Xcode project or workspace. - On the “General” tab of your application target’s settings, add
ParserCombinator.framework
. to the “Embedded Binaries” section. - If your application target does not contain Swift code at all, you should also set the
EMBEDDED_CONTENT_CONTAINS_SWIFT
build setting to “Yes”.
ParserCombinator is available under the MIT license. Details can be found within the LICENSE file.