Skip to content

Commit b8701fc

Browse files
committed
Check EOF when checking a large char set that contains the null character
1 parent be6e6d3 commit b8701fc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cli/src/generate/render.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,12 +759,20 @@ impl Generator {
759759
}
760760

761761
if let Some(large_char_set_ix) = large_char_set_ix {
762+
let large_set = &self.large_character_sets[large_char_set_ix].1;
763+
let check_eof = large_set.contains('\0');
764+
if check_eof {
765+
add!(self, "(!eof && ")
766+
}
762767
add!(
763768
self,
764769
"set_contains({}, {}, lookahead)",
765-
self.large_character_set_constant_names[large_char_set_ix],
766-
self.large_character_sets[large_char_set_ix].1.range_count(),
770+
&self.large_character_set_constant_names[large_char_set_ix],
771+
large_set.range_count(),
767772
);
773+
if check_eof {
774+
add!(self, ")");
775+
}
768776
}
769777

770778
if !asserted_chars.is_empty() {

0 commit comments

Comments
 (0)