1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (C) 2022, Alex Badics
// This file is part of peginator
// Licensed under the MIT license. See LICENSE file in the project root for details.
//! This crate contains the code used for generating [`peginator`] parsing code from a
//! grammar file. Unless you are using [`Compile`] in a buildscript, you
//! probably want to see the [`peginator`] crate documentation instead.
//!
//! To integrate [`peginator`] using a buildscript, first add `peginator_codegen` as
//! a build dependency in your `Cargo.toml`:
//!
//! ```toml
//! [build-dependencies]
//! peginator_codegen = "0.6"
//! ```
//!
//! And then in your `build.rs`:
//!
//! ```ignore
//! use peginator_codegen::Compile;
//!
//! fn main() {
//! let out = format!("{}/grammar.rs", std::env::var("OUT_DIR").unwrap());
//!
//! peginator_codegen::Compile::file("grammar.ebnf")
//! .destination(out)
//! .format()
//! .run_exit_on_error();
//!
//! println!("cargo:rerun-if-changed=grammar.ebnf");
//! }
//! ```
//!
//! See the documentation of [`Compile`] for more advanced options.
pub use Compile;
pub use ;
pub use Grammar;
pub use generate_source_header;
pub const VERSION: &str = env!;
pub const BUILD_TIME: &str = env!;