#parser-combinator #proc-macro #combine #macro

combine-proc-macro

Support for using combine parser combinators with the proc_macro API

4 releases

0.3.1 May 1, 2019
0.3.0 Apr 30, 2019
0.2.1 Apr 28, 2019
0.2.0 Apr 28, 2019

#277 in Parser tooling

Download history 32/week @ 2024-03-13 67/week @ 2024-03-20 38/week @ 2024-03-27 92/week @ 2024-04-03 22/week @ 2024-04-10 6/week @ 2024-04-24 8/week @ 2024-05-01 55/week @ 2024-05-08 49/week @ 2024-05-15 29/week @ 2024-05-22 6/week @ 2024-05-29 26/week @ 2024-06-05 33/week @ 2024-06-12 35/week @ 2024-06-19 22/week @ 2024-06-26

120 downloads per month
Used in crabwise-antlr-parser

MIT/Apache

24KB
467 lines

combine-proc-macro

combine-proc-macro on docs.rs

A library that allows proc_macro function-like macros to be parsed using the combine parser combinator crate.

Usage

Put this in your Cargo.toml:

[dependencies]
combine-proc-macro = "0.3.1"

And this in your crate root:

extern crate combine_proc_macro;

To learn how the library is used, see some examples:

Motivation

When writing a #[proc_macro_derive] the input is Rust source code which is well supported by the syn crate. However, when writing a #[proc_macro] macro, it is common to want to define a custom domain specific language.

This crate allows you to write a parser for your DSL using the combine parser combinator library. It also preserves the source span information in the parsed result such that rustc can provide correct source locations for identifiers and literals that are re-used in the output.

License

This library is licensed under the terms of both the MIT license and the Apache License (Version 2.0), and may include packages written by third parties which carry their own copyright notices and license terms.

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

Dependencies

~1.5MB
~27K SLoC