Ports the read path of FreeRouting's io/specctra/parser package to a Java-free Python implementation: - tokenizer: S-expression lexer mirroring SpecctraFileDescription.flex (comments, quoted strings, the string_quote IGNORE_QUOTE directive, case-insensitive keywords, and hash-prefixed names) - sexp: nested S-expression tree builder - shapes: rect/circle/polygon/path plus area-with-holes scopes - model: typed dataclasses for layers, padstacks, images, placements, nets, net classes, rules, keepouts - reader: recursive-descent scope readers producing a DsnBoard, one _read_* function per FreeRouting read_scope method 46 pytest cases cover the tokenizer, tree, shapes, and end-to-end parsing against hand-crafted fixtures modeled on FreeRouting's own test DSN files. Parses 90 of 91 upstream fixtures (the one failure is a binary OLE file, not text DSN).
27 lines
440 B
Plaintext
27 lines
440 B
Plaintext
(pcb freeroute-empty.dsn
|
|
(parser
|
|
(string_quote ")
|
|
(space_in_quoted_tokens on)
|
|
)
|
|
(resolution um 10)
|
|
(unit um)
|
|
(structure
|
|
(layer F.Cu
|
|
(type signal)
|
|
(property
|
|
(index 0)
|
|
)
|
|
)
|
|
(layer B.Cu
|
|
(type signal)
|
|
(property
|
|
(index 1)
|
|
)
|
|
)
|
|
(boundary
|
|
(path pcb 0 186690 -107950 129540 -107950 129540 -57150 186690 -57150
|
|
186690 -107950)
|
|
)
|
|
)
|
|
)
|