Add Python RFC 5322 email address parser (§3.2-§4.4) with 70 tests and compliance matrix#7
Conversation
Adds AddressParser class with lexer (RFC5322Lexer), recursive-descent parser, and semantic validator. Supports strict (reject obs-*) and permissive modes (§4.4). Implements full ABNF grammar chain: - §3.2.1 quoted-pair, §3.2.2 FWS, §3.2.3 CFWS/comments/nested - §3.2.4 quoted-string with FWS and quoted-pair - §3.4 address/mailbox/group/address-list/mailbox-list - §3.4.1 addr-spec, domain-literal (IPv4/IPv6) - §4.4 obs-local-part, obs-domain, obs-FWS Includes 70 tests across 10 test classes, compliance.md mapping all 51 ABNF productions, and 2 CAP annotation blocks in source.md. No external dependencies — pure Python stdlib only. Closes #1 Co-Authored-By: Nebula <noreply@nebula.gg>
12 tasks
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements RFC 5322 compliant email address parser as specified in issue #1 — full ABNF grammar coverage from §3.2 through §4.4 with strict and permissive modes.
Files added
parser.pyAddressParserclass withparse(),parse_address_list(),parse_mailbox_list()test_parser.pycompliance.mdModified files
source.mdAcceptance criteria
parser.py—AddressParserclass withparse(),parse_address_list(),parse_mailbox_list()| ✓test_parser.py— 60+ test cases covering all sections listed above | ✓ (70 tests)compliance.md— maps all ABNF productions to tests and implementation | ✓ (51 productions)[CAP-ANNOTATION-REQUIRED]markers insource.mdpopulated per CONTRIBUTING.md | ✓ (2 blocks)Test results
Test coverage by section
Architecture
Co-Authored-By: Nebula noreply@nebula.gg