This repository was archived by the owner on Apr 22, 2026. It is now read-only.
Fix footprint parser for KiCad 10: add duplicate_pad_numbers_are_jumpers + lenient unknown_sexp#18
Merged
Conversation
…ers + lenient unknown_sexp catch-all - Add duplicate_pad_numbers_are_jumpers rule to module_contents - Add unknown_sexp catch-all to module_contents, pad_attr, fp_generics, gr_generics, board rule, module_property, fp_text, fp_text_box, effects, and font rules so future KiCad versions don't break the parser - Rebuild compiled parser (module-parser.js) and dist/ Co-Authored-By: Matthias <matthias.chills@gmail.com>
Author
Original prompt from Matthias |
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Address Devin Review findings: add .filter(v => v !== null) to module rule (line 684) and pad rule (line 1104) where unknown_sexp null values were not being filtered out. Co-Authored-By: Matthias <matthias.chills@gmail.com>
- Add MSOP-10 and QSOP-28 footprint test fixtures (KiCad 10 v20260206) - Add CH334U and CH340X symbol test fixtures (KiCad 10) - Fix balanced_content rule: exclude quote chars from [^()] catch-all - Update .gitignore to allow data/module/custom/ test files Co-Authored-By: Matthias <matthias.chills@gmail.com>
natarius
approved these changes
Mar 7, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fix footprint parser for KiCad 10: add missing token + lenient catch-all
Summary
KiCad 10 footprint files (
.kicad_mod, version 20260206) fail to parse because the module grammar doesn't recognize theduplicate_pad_numbers_are_jumperstoken. This causes the parser to error out entirely, resulting in all pads appearing stacked at the origin when imported into Flux.Changes to
module.pegjs:duplicate_pad_numbers_are_jumpersas a new boolean rule inmodule_contentsunknown_sexpcatch-all rule (matching the pattern already used insymbol.pegjs) to 10 grammar rules:board,module_contents,pad_attr,fp_generics,gr_generics,module_property,fp_text,fp_text_box,effects, andfont.filter(function(v) { return v !== null; })to all.map()calls in rules that now includeunknown_sexp, since the catch-all returnsnullThe compiled
dist/files are regenerated from the grammar — the meaningful diff is entirely insrc/module.pegjs(~40 lines changed).Updates since last revision
balanced_contentquote bug — changed[^()]+to[^()"']+so quote characters are always handled by thestringalternative. Without this, a value like(new_field "value with )")would have the"consumed by the catch-all character class, causing the)inside the string to be treated as a structural paren and breaking the parse.MSOP-10_3x3mm_P0.5mm.kicad_mod(10 pads) andQSOP-28_3.9x9.9mm_P0.635mm.kicad_mod(28 pads)ch334u.kicad_symandch340x.kicad_sym.gitignore— changeddata/moduletodata/module/*with!data/module/customso custom footprint test files are tracked in git (matching the pattern used fordata/symbols/custom/)All test fixtures parse successfully with
pnpm test.Review & Testing Checklist for Human
unknown_sexpis always the last alternative in every rule it was added to — PEG grammars are ordered, so placing it last ensures known tokens are always tried first. If it appeared earlier, it could swallow valid tokens silently..filter(v => v !== null)was added to ~10.map()calls. Confirm no existing grammar rule relied on returningnullfor a meaningful purpose.MSOP-10_3x3mm_P0.5mm.kicad_modandQSOP-28_3.9x9.9mm_P0.635mm.kicad_modin Flux and verify pads are positioned correctly (not stacked at origin). MSOP-10 should have 10 pads spanning x={-2.1, 2.1}; QSOP-28 should have 28 pads spanning x={-2.6375, 2.6375}.Notes
dist/index.jsdiff is large but entirely auto-generated frompegjs. Onlysrc/module.pegjscontains hand-written changes.symbol.pegjs) in PR Fix boolean parsing, add lenient unknown-field handling, include dist/ #17.