Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
tolo/Parsicle
Parsicle

A Swift parser combinator framework.
Extracted from InterfaCSS, originally inspired by Parcoa.
Getting started
Install
The simplest way is to use CocoaPods.
pod 'Parsicle'
Support for Swift Package Manager is also on the way...
Examples
Simple example with sequential parser
let parsicle = Parsicles.sequential([
.string("Hello"),
.spaces(1),
.string("World"),
.spaces(1),
.choice([
.char("🤯"),
.char("😍"),
.char("💩"),
]),
])
if parsicle.matches("Hello World 🤯") {
print("🎉")
}
Example using Swift function builder syntax
Sequential {
"Hello"
Spaces(1)
"World"
Spaces()
Choice {
"🤯"
"😍"
"💩"
}
}
More
See unit tests for more concrete examples: ParsicleTests.swift
License
MIT license - see here.
Github
link |
Stars: 0 |
Last commit: 1 week ago |