#syn #parsing #sourcemap #crate

cpp_synmap

Sourcemap and full crate parsing support for cpp_syn

2 unstable releases

0.3.0 Sep 24, 2017
0.2.0 Mar 6, 2017

#22 in Procedural macro helpers

Download history 26/week @ 2018-07-09 50/week @ 2018-07-16 22/week @ 2018-07-23 17/week @ 2018-07-30 50/week @ 2018-08-06 65/week @ 2018-08-13 75/week @ 2018-08-20 48/week @ 2018-08-27 110/week @ 2018-09-03 51/week @ 2018-09-10 44/week @ 2018-09-17 170/week @ 2018-09-24 37/week @ 2018-10-01

110 downloads per month
Used in 8 crates (2 directly)

MIT/Apache

13KB
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

~720KB
~18K SLoC