2 unstable releases

Uses old Rust 2015

0.3.0 Sep 24, 2017
0.2.0 Mar 6, 2017

#2124 in Procedural macros

Download history 141/week @ 2024-03-13 108/week @ 2024-03-20 128/week @ 2024-03-27 190/week @ 2024-04-03 114/week @ 2024-04-10 131/week @ 2024-04-17 131/week @ 2024-04-24 116/week @ 2024-05-01 115/week @ 2024-05-08 121/week @ 2024-05-15 156/week @ 2024-05-22 114/week @ 2024-05-29 153/week @ 2024-06-05 229/week @ 2024-06-12 425/week @ 2024-06-19 403/week @ 2024-06-26

1,229 downloads per month
Used in 9 crates (2 directly)

MIT/Apache

14KB
254 lines

Synmap

NOTE: This crate currently depends on cpp_syn rather than syn, as it requires the Span features which have not been landed in syn yet for the majority of its features.

This crate provides a SourceMap type which can be used to parse an entire crate and generate a complete AST. It also updates the spans in the parsed AST to be relative to the SourceMap rather than the bytes in the input file.

With this information, the SourceMap provides methods to map spans to source filenames (filename), source text (source_text) and line/column numbers (locinfo).


lib.rs:

synmap provides utilities for parsing multi-file crates into syn AST nodes, and resolving the spans attached to those nodes into raw source text, and line/column information.

The primary entry point for the crate is the SourceMap type, which stores mappings from byte offsets to file information, along with cached file information.

Dependencies

~1MB
~21K SLoC