A lossless concrete syntax tree and text editing library for S-expressions
Project description
circuitdk-lossless-sexpr
circuitdk-lossless-sexpr provides a small, lossless concrete syntax tree for S-expressions.
Parsing and rendering an unchanged document preserves its source text byte for byte, including
whitespace, comments, number formatting, and unknown syntax.
The distribution is maintained as part of CircuitDK, but the Python package can be used independently.
Installation
uv add circuitdk-lossless-sexpr
Usage
from lossless_sexpr import TextEdit, apply_edits, parse
source = '(property "Value" "10 k" (at 1 2))'
document = parse(source)
value = document.lists("property")[0].atom(2)
assert value is not None
updated = apply_edits(source, [TextEdit(value.span, '"47 k"')])
assert updated == '(property "Value" "47 k" (at 1 2))'
Overlapping edits are rejected, and parse errors include source locations. The library deliberately contains no KiCad or circuit-specific semantics.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file circuitdk_lossless_sexpr-0.1.1.tar.gz.
File metadata
- Download URL: circuitdk_lossless_sexpr-0.1.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3337b298b30916bc196137dc5f9c9a8c23eebee0225bca787b424594a8199068
|
|
| MD5 |
ca675bf21afd1b8efbd92ebb697cfd42
|
|
| BLAKE2b-256 |
af81a5a092e00518eea23ca2fbf71e64977305d765838a0bdd3a8ff8e239aa8d
|
File details
Details for the file circuitdk_lossless_sexpr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: circuitdk_lossless_sexpr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a41a4f4d8b83e6d43b449c281e08ceb66ca8c6ffb0b09c5f398d609f860108f
|
|
| MD5 |
cc61e059a6a34ee090802ae41a5da0f7
|
|
| BLAKE2b-256 |
7047b8f3e4c95f467e0191b98ab83adfb68418fcba6222c4428b924d245c0b1c
|