Add support for character ranges in regex patterns

This commit is contained in:
Max Brunsfeld 2014-01-30 18:54:39 -08:00
parent 60e2d00b4d
commit 0d3a941848
11 changed files with 174 additions and 156 deletions

View file

@ -55,6 +55,13 @@ describe("parsing pattern rules", []() {
EqualsPointer(character({ 'a', 'b', 'c' }, true)));
});
it("parses character ranges", []() {
Pattern rule("[12a-dA-D3]");
AssertThat(
rule.to_rule_tree(),
EqualsPointer(character({ '1', '2', CharacterMatch({'a', 'd'}), CharacterMatch({ 'A', 'D' }), '3' }, true)));
});
it("parses negated characters", []() {
Pattern rule("[^a\\d]");
AssertThat(