Crates.io | sexpfmt |
lib.rs | sexpfmt |
version | 0.2.0 |
source | src |
created_at | 2023-07-23 08:34:03.424898 |
updated_at | 2024-11-25 09:14:51.429894 |
description | A command-line tool to format S-expressions |
homepage | https://github.com/tsnl/sexpfmt |
repository | |
max_upload_size | |
id | 923653 |
size | 35,418,218 |
sexpfmt
S-expressions are easy for machines to write, but generating formatted S-expressions can be painful.
sexpfmt
formats an input stream in a consistent way such that the output is both line-diffable and human-readable.
The formatting style used by sexpfmt is highly regular, unlike what many Lispers and Schemers prefer. Each indentation increments spaces by a fixed number of spaces (by default, 2).
(object
(object
(name "croissant")
(quantity 2))
(object
(name "latte")
(quantity 1)
(size "tall")))
The S-expression data format used is highly simplified compared to LISP's.
There is no support for quote, quasiquote, unquote, or dot pair-builders.
The character literal #\
(for space) is not supported either. Use #\space
instead.
There is also no support for #1234 = ...
expressions to construct graphs.
To build and install this tool, you will need Cargo
and a Rust toolchain.
Navigate to the root of this repository with a shell, then run:
cargo install --path .
To run tests, you will also need bash
and Python3
$ cat my-file.sexp | sexpfmt > my-formatted-file.sexp
$ ./build/my-sexp-generator-program arg1 arg2 | sexpfmt >> formatted-logfile.sexp
For examples of sexpfmt
's behavior, see the test
directory.
-h
or --help
)(menu :version "0.1.2" :items (list ...))