Swiftpack.co - kelvin13/swift-grammar as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by kelvin13.
kelvin13/swift-grammar v0.3.2
debuggable parsing tools for performance-sensitive libraries
⭐️ 7
🕓 1 week ago
linux macOS iOS
.package(url: "https://github.com/kelvin13/swift-grammar.git", from: "v0.3.2")

grammar
0.3.1

ci build status ci devices build status ci windows build status

swift package index versions swift package index platforms

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

adding swift-grammar as a dependency

To 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
    ]
)

toolchain requirement

swift-grammar requires Swift 5.7 or newer.

GitHub

link
Stars: 7
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Release Notes

0.2.0
31 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!

browse the API docs

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics