Fix bug in character set intersection calculation
This commit is contained in:
parent
9cb92a0a96
commit
2a5dd3434f
2 changed files with 8 additions and 0 deletions
|
|
@ -108,6 +108,12 @@ describe("character sets", []() {
|
|||
CharacterSet set2({ {'c', 'y'} });
|
||||
AssertThat(set1.intersect(set2), Equals(CharacterSet({ {'c', 'e'}, {'w', 'y'} })));
|
||||
});
|
||||
|
||||
it("works for some sets", []() {
|
||||
CharacterSet set1({ {'i', 'i'} });
|
||||
CharacterSet set2({ {'a', 'z'} });
|
||||
AssertThat(set1.intersect(set2), Equals(CharacterSet({ {'i', 'i'} })));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,8 @@ namespace tree_sitter {
|
|||
} else if (new_max <= max_int(range)) {
|
||||
new_ranges.insert(CharacterRange(new_max + 1, range.max));
|
||||
add_range(&removed_set, CharacterRange(range.min, new_max));
|
||||
} else {
|
||||
add_range(&removed_set, range);
|
||||
}
|
||||
} else if (new_min <= max_int(range)) {
|
||||
if (new_max < max_int(range)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue