Expand description
This crate provides a Rustemo grammars compiler as a CLI command, and an API
for usage from build.rs
scripts.
When this crate is installed rcomp
command is available that can be run
over Rustemo grammars to produce parsers.
The entry point into API is Settings::new which provide a default settings value which can be further configured in a builder pattern style calling methods of Settings and finally executed using Settings::process_dir or Settings::process_grammar methods.
§Example
ⓘ
rustemo_compiler::Settings::new().force(true).in_source_tree().process_dir()
§Processing grammars
For default settings there are process_crate_dir, process_dir and process_grammar shortcut functions.
§Example
Usual pattern you can use in build.rs
is:
ⓘ
if let Err(e) = rustemo_compiler::process_crate_dir() {
eprintln!("{}", e);
exit(1);
}
Re-exports§
pub use crate::utils::string_difference;
Modules§
Macros§
- create_
index - local_
file - Used in tests to calculate local file path relative to the source file.
Requires call to
file!()
as a first parameter. - output_
cmp - Used in tests for storing and comparing string representations in files.
Structs§
- Settings
- Provides parser settings information.
Enums§
- Builder
Type - The builder type used during parsing to construct the output
- Error
- Generator
Table Type - Different generated parser table variants with different trade-offs
- Lexer
Type - The lexer type used during parsing to break the input into tokens
- Parser
Algo - The parsing algorithm used
- Table
Type - Specifies the type of the parsing table used during parsing to decide about shift/reduce/goto operations.
Functions§
- process_
crate_ dir - A shortcut function which creates default Settings and use it to process the crate project directory.
- process_
dir - Recursively process a given dir and generate a parser for each found grammar with default settings.
- process_
grammar - Generates a parser from the given grammar file with default settings.