diff --git a/README.md b/README.md index 27fc72ca3e8384cba751b24614dec0910b7437d8..e200de47c2c10cc169aa79796cd7b960005a0e54 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,31 @@ Disclaimer, I'm NOT the author of the `syn` and `nom` parsing frameworks, so no The same goes for all references to supporting crates and references to other Rust libraries, crates and the language itself, so use material at own risk :) +## Build environment + +In order to build custom parsers using `syn` you need to use a nightly compiler to build a library with the following set of dependencies and library definition in the `Cargo.toml`. + +``` toml +[package] +name = "parsetest" +version = "0.1.0" +authors = ["Per Lindgren <per.lindgren@ltu.se>"] + +[dependencies] +quote = "0.4.2" + +[dependencies.syn] +version = "0.12.12" +features = ["full"] + +[dependencies.proc-macro2] +features = ["nightly"] +version = "0.2.2" + +[lib] +proc-macro = true +``` + ## Built in parsers The `syn::parse` function allows to parse any struct that implements the `syn::synom::Synom` trait. The `syn` crate provides a large set of structs which satisfies this requirement, which we can use directly or for building parser combinators. @@ -211,8 +236,9 @@ The description here is the default error, provided by the built in `LitInt` par ## Combining parsers -The real strenght of the `syn` and `nom` frameworks comes from the ability to combine parsers. We will start by looking at the last error, assuming we want to parse something like `(LitInt)` into a plain `LitInt`. +The real strenght of the `syn` and `nom` frameworks comes from the ability to combine parsers. We will start by looking at the last error, assuming we want to parse something like `(LitInt)` into a plain `LitInt`. +``` rust /// MyLit struct MyLit { val: LitInt,