| Crates.io | oak-macros |
| lib.rs | oak-macros |
| version | 0.0.1 |
| created_at | 2026-01-23 04:14:07.95873+00 |
| updated_at | 2026-01-23 04:14:07.95873+00 |
| description | Procedural macros for the Oak framework to simplify parser and AST definition. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 2063374 |
| size | 18,123 |
Procedural macros for the Oak ecosystem, providing a domain-specific language for building document structures and trees.
Oak Macros simplifies the creation of complex data structures used within the Oak framework. Its primary feature is the doc! macro, which provides a declarative syntax for building Doc trees used in oak-pretty-print.
Using the doc! macro for pretty printing:
use oak_macros::doc;
use oak_pretty_print::Doc;
let my_doc = doc! {
[
"fn", " ", "main", "()", " ",
group {
[
"{",
indent {
[hard_line, "println!(\"Hello World\");"]
},
hard_line,
"}"
]
}
]
};
The doc! macro supports several specialized keywords:
nil: An empty document.line: A mandatory newline.soft_line: A newline that collapses to nothing if it fits on one line.soft_line_space: A newline that collapses to a space if it fits.hard_line: A mandatory newline.indent { ... }: Indents the enclosed content.group { ... }: Treats the content as a single unit for line-breaking decisions.[...]: Concatenates multiple document elements."text": Literal text content.Oak Macros is primarily used with:
doc! macro for code formatting.Vec and Box structures.Contributions are welcome! Please feel free to submit issues or pull requests.
Oak Macros - Simplifying tree construction with powerful DSLs 🚀