#syn #parsing #sourcemap #crate


Sourcemap and full crate parsing support for cpp_syn

2 unstable releases

Uses old Rust 2015

0.3.0 Sep 24, 2017
0.2.0 Mar 6, 2017

#1218 in Procedural macros

Download history 282/week @ 2022-11-29 148/week @ 2022-12-06 163/week @ 2022-12-13 288/week @ 2022-12-20 393/week @ 2022-12-27 242/week @ 2023-01-03 373/week @ 2023-01-10 121/week @ 2023-01-17 330/week @ 2023-01-24 235/week @ 2023-01-31 181/week @ 2023-02-07 699/week @ 2023-02-14 404/week @ 2023-02-21 206/week @ 2023-02-28 246/week @ 2023-03-07 238/week @ 2023-03-14

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


254 lines


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).


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.


~18K SLoC