Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support typed BNF grammar #5

Merged
merged 15 commits into from
Nov 14, 2024

add more testcases

20431eb
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

Support typed BNF grammar #5

add more testcases
20431eb
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Nov 14, 2024 in 1s

clippy

9 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 9
Note 0
Help 0

Versions

  • rustc 1.82.0 (f6e511eec 2024-10-15)
  • cargo 1.82.0 (8f40fc59f 2024-08-21)
  • clippy 0.1.82 (f6e511e 2024-10-15)

Annotations

Check warning on line 130 in src/grammar/symbol.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

match expression looks like `matches!` macro

warning: match expression looks like `matches!` macro
   --> src/grammar/symbol.rs:127:9
    |
127 | /         match self {
128 | |             SymbolKind::Terminal(_) | SymbolKind::Regex(_) => true,
129 | |             _ => false,
130 | |         }
    | |_________^ help: try: `matches!(self, SymbolKind::Terminal(_) | SymbolKind::Regex(_))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro

Check warning on line 66 in src/grammar/graph.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

writing `&Vec` instead of `&[_]` involves a new object where a slice will do

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
  --> src/grammar/graph.rs:66:33
   |
66 |     fn is_trap_loop(&self, scc: &Vec<NodeIndex>) -> bool {
   |                                 ^^^^^^^^^^^^^^^ help: change this to: `&[NodeIndex]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
   = note: `#[warn(clippy::ptr_arg)]` on by default

Check warning on line 55 in src/grammar/alt.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

match expression looks like `matches!` macro

warning: match expression looks like `matches!` macro
  --> src/grammar/alt.rs:52:9
   |
52 | /         match self.invoke_limit {
53 | |             Limit::Unlimited => false,
54 | |             _ => true,
55 | |         }
   | |_________^ help: try: `!matches!(self.invoke_limit, Limit::Unlimited)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
   = note: `#[warn(clippy::match_like_matches_macro)]` on by default

Check warning on line 20 in src/regex.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated function `new` is never used

warning: associated function `new` is never used
  --> src/regex.rs:20:8
   |
19 | impl Regex {
   | ---------- associated function in this implementation
20 |     fn new(input: &str) -> Self {
   |        ^^^

Check warning on line 21 in src/parse_tree/tree.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

method `children_len` is never used

warning: method `children_len` is never used
  --> src/parse_tree/tree.rs:21:19
   |
12 | impl<T> ParseTree<T> {
   | -------------------- method in this implementation
...
21 |     pub(crate) fn children_len(&self) -> usize {
   |                   ^^^^^^^^^^^^

Check warning on line 111 in src/grammar/symbol.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

method `name` is never used

warning: method `name` is never used
   --> src/grammar/symbol.rs:111:12
    |
107 | impl SymbolKind {
    | --------------- method in this implementation
...
111 |     pub fn name(&self) -> Option<&str> {
    |            ^^^^
    |
    = note: `#[warn(dead_code)]` on by default

Check warning on line 19 in src/grammar/checked.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

type `grammar::symbol::SymbolKind` is more private than the item `grammar::checked::ReduceOutput::NonTerminal::syms`

warning: type `grammar::symbol::SymbolKind` is more private than the item `grammar::checked::ReduceOutput::NonTerminal::syms`
  --> src/grammar/checked.rs:19:9
   |
19 |         syms: Vec<SymbolKind>,
   |         ^^^^^^^^^^^^^^^^^^^^^ field `grammar::checked::ReduceOutput::NonTerminal::syms` is reachable at visibility `pub`
   |
note: but type `grammar::symbol::SymbolKind` is only usable at visibility `pub(crate)`
  --> src/grammar/symbol.rs:91:1
   |
91 | pub(crate) enum SymbolKind {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 48 in src/generator.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

type `grammar::symbol::SymbolKind` is more private than the item `generator::TreeGenerator::generate`

warning: type `grammar::symbol::SymbolKind` is more private than the item `generator::TreeGenerator::generate`
  --> src/generator.rs:44:5
   |
44 | /     pub fn generate<R: Rng, S: Into<String>>(
45 | |         &self,
46 | |         start: S,
47 | |         rng: &mut R,
48 | |     ) -> ParseTree<SymbolKind> {
   | |______________________________^ method `generator::TreeGenerator::generate` is reachable at visibility `pub`
   |
note: but type `grammar::symbol::SymbolKind` is only usable at visibility `pub(crate)`
  --> src/grammar/symbol.rs:91:1
   |
91 | pub(crate) enum SymbolKind {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: `#[warn(private_interfaces)]` on by default

Check warning on line 1791 in /home/runner/work/bnfgen/bnfgen/target/debug/build/bnfgen-425e20e80eb4f7df/out/parser.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `comma`

warning: unused variable: `comma`
    --> /home/runner/work/bnfgen/bnfgen/target/debug/build/bnfgen-425e20e80eb4f7df/out/parser.rs:1791:9
     |
1791 |     (_, comma, _): (usize, Option<Token>, usize),
     |         ^^^^^ help: if this is intentional, prefix it with an underscore: `_comma`
     |
     = note: `#[warn(unused_variables)]` on by default