{"id":13558357,"url":"https://github.com/lukaslueg/macro_railroad","last_synced_at":"2025-04-08T12:07:13.480Z","repository":{"id":42568904,"uuid":"144475004","full_name":"lukaslueg/macro_railroad","owner":"lukaslueg","description":"A library to generate syntax diagrams for Rust macros.","archived":false,"fork":false,"pushed_at":"2024-07-26T23:39:16.000Z","size":1445,"stargazers_count":555,"open_issues_count":10,"forks_count":12,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-01T10:14:44.281Z","etag":null,"topics":["rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukaslueg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-12T14:46:05.000Z","updated_at":"2025-03-30T10:48:02.000Z","dependencies_parsed_at":"2024-01-07T21:12:06.291Z","dependency_job_id":"282a7485-4abc-41ba-839a-39afa2cbe890","html_url":"https://github.com/lukaslueg/macro_railroad","commit_stats":{"total_commits":64,"total_committers":2,"mean_commits":32.0,"dds":0.03125,"last_synced_commit":"a57954f566d674651835cd8202017f062aac049e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaslueg%2Fmacro_railroad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaslueg%2Fmacro_railroad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaslueg%2Fmacro_railroad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaslueg%2Fmacro_railroad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukaslueg","download_url":"https://codeload.github.com/lukaslueg/macro_railroad/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838443,"owners_count":21004580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust"],"created_at":"2024-08-01T12:04:54.522Z","updated_at":"2025-04-08T12:07:13.464Z","avatar_url":"https://github.com/lukaslueg.png","language":"Rust","funding_links":[],"categories":["Rust","Applications","rust"],"sub_categories":["Visualization"],"readme":"[![Build status](https://github.com/lukaslueg/macro_railroad/actions/workflows/check.yml/badge.svg)](https://github.com/lukaslueg/macro_railroad/actions/workflows/check.yml)\n[![Crates.io Version](https://img.shields.io/crates/v/macro_railroad.svg)](https://crates.io/crates/macro_railroad)\n\n\n**[Live demo](https://lukaslueg.github.io/macro_railroad_wasm_demo/)** ([code](https://github.com/lukaslueg/macro_railroad_wasm))\n\n**[A browser add-on for Firefox, Chrome and Edge](https://github.com/lukaslueg/macro_railroad_ext)**\n\nA library to generate syntax (\"railroad\") diagrams for Rust's `macro_rules!()`.\n\nDiagrams are generated as Scalable Vector Graphics, with layout-details controlled by customizable CSS.\n\nAs an example, given the definition of [nom's `method`](https://docs.rs/nom/4.0.0/nom/macro.method.html)\n\n```rust\nmacro_rules! method {\n    ($name:ident\u003c$a:ty\u003e( $i:ty ) -\u003e $o:ty, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty,$i:ty,$o:ty,$e:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty,$i:ty,$o:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty,$o:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty\u003e( $i:ty ) -\u003e $o:ty, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty,$i:ty,$o:ty,$e:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty,$i:ty,$o:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty,$o:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty\u003e, $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty\u003e( $i:ty ) -\u003e $o:ty, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty,$i:ty,$o:ty,$e:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty,$i:ty,$o:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty,$o:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    ($name:ident\u003c$a:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty\u003e( $i:ty ) -\u003e $o:ty, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty,$i:ty,$o:ty,$e:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty,$i:ty,$o:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty,$o:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n    (pub $name:ident\u003c$a:ty\u003e, mut $self_:ident, $submac:ident!( $($args:tt)* )) =\u003e { ... };\n}\n```\n\n... the library generates an SVG which renders (using default CSS) as\n\n![Syntax diagram for nom::method](https://github.com/lukaslueg/macro_railroad/raw/master/examples/nom4_method.svg?sanitize=true)\n\n---\n\nTo generate the examples shown here, run\n\n```\ncargo run --example various\n```\n\nwhich will output some html-files to `/examples`; Feel free to hack on the demos in `/examples/various.rs`.\n\n\n### Examples\n\n\n* **[Live demo](https://lukaslueg.github.io/macro_railroad_wasm_demo/)** ([code](https://github.com/lukaslueg/macro_railroad_wasm))\n* The macros from `nom-4.1.1` [as diagrams](https://htmlpreview.github.io/?https://github.com/lukaslueg/macro_railroad/blob/master/examples/nom_examples.html)\n* Some of the macros from the standard library [as diagrams](https://htmlpreview.github.io/?https://github.com/lukaslueg/macro_railroad/blob/master/examples/stdlib_examples.html) \n* The macros from `syn-0.14` [as diagrams](https://htmlpreview.github.io/?https://github.com/lukaslueg/macro_railroad/blob/master/examples/syn_examples.html)\n* Some macros from various crates, including `bitflags`, `quickcheck` and `cfg-if`, [as diagrams](https://htmlpreview.github.io/?https://github.com/lukaslueg/macro_railroad/blob/master/examples/various_examples.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukaslueg%2Fmacro_railroad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukaslueg%2Fmacro_railroad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukaslueg%2Fmacro_railroad/lists"}