High-performance constructive parsing, in pure Swift. This module powers the swift-json
library!
Importing this module will expose the following top-level symbols:
enum Pattern
enum UnicodeDigit
enum UnicodeEncoding
protocol TraceableError
protocol TraceableErrorRoot
struct ParsingError<Index>
struct ParsingInput<Diagnostics>
struct NoDiagnostics<Source>
struct DefaultDiagnostics<Source>
protocol ParsingDiagnostics
protocol ParsingRule
protocol TerminalRule
protocol LiteralRule
protocol DigitRule
protocol ASCIITerminal
protocol UTF8Terminal
protocol UTF16Terminal
protocol UnicodeTerminal
protocol CharacterTerminal
swift-grammar
as a dependencyTo use swift-grammar
in a project, add the following to your Package.swift
file:
let package = Package(
...
dependencies:
[
// other dependencies
.package(url: "https://github.com/kelvin13/swift-grammar", from: "0.3.1"),
],
targets:
[
.target(name: "example",
dependencies:
[
.product(name: "Grammar", package: "swift-grammar"),
// other dependencies
]),
// other targets
]
)
swift-grammar
requires Swift 5.7 or newer.
link |
Stars: 7 |
Last commit: 2 weeks ago |
the swift-grammar
0.2 release is focused around broadening the library’s range of use cases over the v0.1.x releases, during which swift-grammar
existed more or less to support swift-json
and a handful of other parsers.
notably, swift-grammar
v0.1.5 did not ship with a complete alphabet. it included only the definitions needed by its specific consumer packages. it was also not previously possible to disambiguate a name collision with one of the toplevel symbols in this module, since it defines a namespace enum of the same name as the module.
v0.2.0 of swift-grammar
now ships with a complete ASCII table, and has deprecated the Grammar
namespace enum, which we will be able to remove in v0.3.0. API has been carefully resettled into other namespaces, or (in a few cases) promoted to the toplevel, and migration typealiases have been added to help users transition.
v0.2.0 also adopts primary associated types (PATs). this feature is gated to swift >= 5.7; users building on older toolchains will receive a polyfill generated by swift-package-factory
.
finally, v0.2.0 adds CI coverage for iOS, watchOS, and tvOS, and also adds CI coverage for nightly toolchains on macOS and linux.
we have also verified that every swiftpackageindex.com build is succeeding!
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics