Skip to content

Commit

Permalink
Document traits
Browse files Browse the repository at this point in the history
  • Loading branch information
ratmice committed Dec 16, 2023
1 parent 122dba3 commit 75f6528
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lrlex/src/lib/ctbuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,19 @@ where
LexerTypesT: LexerTypes,
usize: num_traits::AsPrimitive<LexerTypesT::StorageT>,
{
/// Called with the lexers filename
/// Will be called with the path to the `.l` file
/// before `fn on_*` or `fn missing_*`.
fn lexer_path(&mut self, filename: &Path);
/// Called with the lexers source contents.
/// Will be called with the `.y` file sources as `src`
/// before any call to `fn on_*`.
fn lexer_src(&mut self, src: &str);
/// Lends `self` a slice containing `LexBuildError`s
fn on_lex_build_error(&mut self, errors: &[LexBuildError]);
/// Lends `self` a set of `String`s denoting tokens
/// present in the parser, but missing from the lexer.
fn missing_in_lexer(&mut self, missing: &HashSet<String>);
/// Lends `self` a set of `String`s denoting tokens
/// present in the lexer, but missing from the parser.
fn missing_in_parser(&mut self, missing: &HashSet<String>);
/// This function must return an `Err` variant if any of the following are true:
///
Expand Down
9 changes: 9 additions & 0 deletions lrpar/src/lib/ctbuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,20 @@ where
LexerTypesT: LexerTypes,
usize: num_traits::AsPrimitive<LexerTypesT::StorageT>,
{
/// Will be called with the `.y` file sources
/// as `src`, before any any call to `fn on_*`.
fn grammar_src(&mut self, src: &str);
/// Will be called with the path to the `.y`
/// file, before any any call to `fn on_*`.
fn grammar_path(&mut self, path: &Path);
/// Will be called with a flag denoting whether warnings
/// should be treated as errors before any call to `fn on_*`.
fn warnings_are_errors(&mut self, flag: bool);
/// Lends `Self` a slice containing warnings.
fn on_grammar_warning(&mut self, ws: &[YaccGrammarWarning]);
/// Lends `Self` a slice containing errors.
fn on_grammar_error(&mut self, errs: &[YaccGrammarError]);
/// Lends `Self` conflicts, and values necessary to obtain spans.
fn on_unexpected_conflicts(
&mut self,
ast: &GrammarAST,
Expand Down

0 comments on commit 75f6528

Please sign in to comment.