Explanation of the lalrpop_mod macro

This commit is contained in:
Ayose 2018-03-25 20:48:42 +01:00
parent 7dc816b98c
commit 4640004b92

View File

@ -143,6 +143,21 @@ pub struct ErrorRecovery<L, T, E> {
pub dropped_tokens: Vec<(L, T, L)>,
}
/// Define a module using the generated parse from a `.lalrpop` file.
///
/// You have to specify the name of the module and the path of the file
/// generated by lalrpop. If the input is in the root directory, you can
/// omit it.
///
/// # Example
/// ```no_run
/// // load parser in src/parser.lalrpop
/// lalrpop_mod!(parser);
///
/// // load parser in src/lex/parser.lalrpop
/// lalrpop_mod!(parser, "/lex/parser.rs");
/// ```
#[macro_export]
macro_rules! lalrpop_mod {
($modname:ident) => { lalrpop_mod!($modname, concat!("/", stringify!($modname), ".rs")); };