rustemo_compiler/
lib.rs

1//! This crate provides a Rustemo grammars compiler as a CLI command, and an API
2//! for usage from `build.rs` scripts.
3//!
4//! When this crate is installed `rcomp` command is available that can be run
5//! over Rustemo grammars to produce parsers.
6//!
7//! The entry point into API is [Settings::new] which provide a default settings
8//! value which can be further configured in a builder pattern style calling
9//! methods of [Settings] and finally executed using [Settings::process_dir] or
10//! [Settings::process_grammar] methods.
11//!
12//! ## Example
13//!
14//! ```rust,ignore
15//! rustemo_compiler::Settings::new().force(true).in_source_tree().process_dir()
16//! ```
17//!
18//! # Processing grammars
19//!
20//! For default settings there are [process_crate_dir], [process_dir] and
21//! [process_grammar] shortcut functions.
22//!
23//! ## Example
24//!
25//! Usual pattern you can use in `build.rs` is:
26//!
27//! ```rust,ignore
28//! if let Err(e) = rustemo_compiler::process_crate_dir() {
29//!     eprintln!("{}", e);
30//!     exit(1);
31//! }
32//! ```
33#![forbid(unsafe_code)]
34#[macro_use]
35extern crate rustemo;
36
37pub mod grammar;
38pub mod utils;
39
40pub use crate::settings::{
41    process_crate_dir, process_dir, process_grammar, BuilderType, GeneratorTableType, LexerType,
42    ParserAlgo, Settings,
43};
44pub use crate::table::TableType;
45
46pub use crate::error::Error;
47pub use crate::error::Result;
48
49// For output_cmp macro
50pub use crate::utils::string_difference;
51
52mod error;
53mod generator;
54mod index;
55mod lang;
56mod settings;
57mod table;