From 1f0f04f3dea6de77c91581105c5ffedf30d14b60 Mon Sep 17 00:00:00 2001 From: Specy Date: Mon, 18 Nov 2024 16:04:56 +0100 Subject: [PATCH] fix styling --- assets/grammars/correct/indirect_empty.lr | 4 +++- src/tables.rs | 1 + tests/parser.rs | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/grammars/correct/indirect_empty.lr b/assets/grammars/correct/indirect_empty.lr index abc2ab6..1da7e84 100644 --- a/assets/grammars/correct/indirect_empty.lr +++ b/assets/grammars/correct/indirect_empty.lr @@ -1,5 +1,7 @@ S -> A B + A -> C C -> D D -> '' -B -> 'x' \ No newline at end of file + +B -> 'x' diff --git a/src/tables.rs b/src/tables.rs index 841101f..35c72e6 100644 --- a/src/tables.rs +++ b/src/tables.rs @@ -13,6 +13,7 @@ impl FirstTable { pub fn construct(grammar: &Grammar) -> FirstTable { let mut first_table = IndexMap::new(); let mut indirectly_empty_symbols = IndexSet::new(); + let mut done = false; while !done { done = true; diff --git a/tests/parser.rs b/tests/parser.rs index 71d3d63..b82bbb0 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -146,9 +146,10 @@ fn raising_correct_error_when_creating_lalr_parser_for_non_lalr_grammar() { #[test] #[cfg_attr(target_family = "wasm", wasm_bindgen_test)] -fn correctly_creates_first_and_follow_sets_for_indirectly_empty_grammar() { +fn correctly_creating_first_and_follow_sets_for_indirectly_empty_grammar() { let grammar = Grammar::parse(common::grammars::INDIRECT_EMPTY).unwrap(); let parser = Parser::lr(grammar).unwrap(); + let first_table = parser.first_table(); { // +--------+-----------+