Skip to content

Commit

Permalink
allow nullable start symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Jun 25, 2024
1 parent 1e9b008 commit 8dda7a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/llguidance_ctrl/src/earley/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl Grammar {
let mut outp = Grammar::new();

let start_data = self.sym_data(self.start());
if start_data.is_terminal() {
if start_data.is_terminal() || start_data.rules.iter().any(|r| r.rhs.is_empty()) {
let new_start = outp.fresh_symbol("_start_repl");
outp.add_rule(new_start, vec![SymIdx(1)]).unwrap();
}
Expand Down

0 comments on commit 8dda7a4

Please sign in to comment.