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#[macro_use]
34extern crate rustemo;
35
36pub mod grammar;
37pub mod utils;
38
39pub use crate::settings::{
40 process_crate_dir, process_dir, process_grammar, BuilderType, GeneratorTableType, LexerType,
41 ParserAlgo, Settings,
42};
43pub use crate::table::TableType;
44
45pub use crate::error::Error;
46pub use crate::error::Result;
47
48// For output_cmp macro
49pub use crate::utils::string_difference;
50
51mod error;
52mod generator;
53mod index;
54mod lang;
55mod settings;
56mod table;