/syntax

Parsers for ABNF Syntaxes

Primary LanguageGoMIT LicenseMIT

ABNF Syntax Parsers

Contains auto-generated ABNF parsers w/ tests.

Included

  • RFC2396: Uniform Resource Identifiers (URI): Generic Syntax

  • RFC3339: Date and Time on the Internet: Timestamps

  • RFC3986: Uniform Resource Identifier (URI): Generic Syntax

  • RFC7159 / RFC8259: The JavaScript Object Notation (JSON) Data Interchange Format

  • ISO8601: ISO 8601 Collected ABNF (! based on the 1988 version)

Validation

import "github.com/di-wu/syntax/rfc3339"

if !IsValid(rfc3339.DateTime, "1985-04-12T23:20:50.52Z") {
    // date time is not valid
}
CLI
go run cli/cli.go -rfc=3339
go run cli/cli.go -in="./abnf/iso8601_date.abnf" -out="./iso8601/date.go" -pkg="iso8601" -core="DIGIT"