swift-grammar

0.2.0

debuggable parsing tools for performance-sensitive libraries
kelvin13/swift-grammar

What's New

0.2.0

2022-08-25T00:56:49Z

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

grammar
0.2.0

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.2.0"),
    ],
    targets: 
    [
        .target(name: "example", 
            dependencies: 
            [
                .product(name: "Grammar", package: "swift-grammar"),
                // other dependencies
            ]),
        // other targets
    ]
)

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue Mar 21 2023 21:03:12 GMT-0500 (GMT-05:00)