#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pubenum ParseError<L, T, E> { /// Generated by the parser when it encounters a token (or EOF) it did not /// expect.
InvalidToken { location: L },
/// Generated by the parser when it encounters an EOF it did not expect.
UnrecognizedEOF { /// The end of the final token
location: L,
/// The set of expected tokens: these names are taken from the /// grammar and hence may not necessarily be suitable for /// presenting to the user.
expected: Vec<String>,
},
/// Generated by the parser when it encounters a token it did not expect.
UnrecognizedToken { /// The unexpected token of type `T` with a span given by the two `L` values.
token: (L, T, L),
/// The set of expected tokens: these names are taken from the /// grammar and hence may not necessarily be suitable for /// presenting to the user.
expected: Vec<String>,
},
/// Generated by the parser when it encounters additional, unexpected tokens.
ExtraToken { token: (L, T, L) },
/// Format a list of expected tokens. fn fmt_expected(f: &mut fmt::Formatter<'_>, expected: &[String]) -> fmt::Result { if !expected.is_empty() {
writeln!(f)?; for (i, e) in expected.iter().enumerate() { let sep = match i { 0 => "Expected one of",
_ if i < expected.len() - 1 => ",", // Last expected message to be written
_ => " or",
};
write!(f, "{} {}", sep, e)?;
}
}
Ok(())
}
/// 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 /// ```ignore /// // load parser in src/parser.lalrpop /// lalrpop_mod!(parser); /// /// // load parser in src/lex/parser.lalrpop /// lalrpop_mod!(parser, "/lex/parser.rs"); /// /// // define a public module /// lalrpop_mod!(pub parser); /// ```
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.