Move regex_t into parse.h and rename to parse_tree_t
This commit is contained in:
@@ -34,13 +34,13 @@ static bool accepts(const fsa_t *nfa, const char *input)
|
||||
|
||||
static void test_empty_expression(void)
|
||||
{
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_EMPTY;
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_EMPTY;
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
const regex_t regex
|
||||
const parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
@@ -49,19 +49,19 @@ static void test_empty_expression(void)
|
||||
ASSERT_TRUE(accepts(&fsa, ""));
|
||||
ASSERT_FALSE(accepts(&fsa, "a"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_wildcard(void)
|
||||
{
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_WILDCARD;
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_WILDCARD;
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
const regex_t regex
|
||||
const parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
@@ -74,20 +74,20 @@ static void test_wildcard(void)
|
||||
ASSERT_FALSE(accepts(&fsa, ""));
|
||||
ASSERT_FALSE(accepts(&fsa, "aa"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_literal_expression(void)
|
||||
{
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_LITERAL;
|
||||
terms[0].literal = 'a';
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
const regex_t regex
|
||||
const parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
@@ -96,26 +96,27 @@ static void test_literal_expression(void)
|
||||
ASSERT_TRUE(accepts(&fsa, "a"));
|
||||
ASSERT_FALSE(accepts(&fsa, "b"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_sequence(void)
|
||||
{
|
||||
regex_term_t *terms = malloc(3 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms = malloc(3 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_LITERAL;
|
||||
terms[0].literal = 'a';
|
||||
terms[1].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[1].type = REGEX_TERM_LITERAL;
|
||||
terms[1].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[1].type = PARSE_TERM_LITERAL;
|
||||
terms[1].literal = 'b';
|
||||
terms[2].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[2].type = REGEX_TERM_LITERAL;
|
||||
terms[2].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[2].type = PARSE_TERM_LITERAL;
|
||||
terms[2].literal = 'c';
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 3;
|
||||
alternatives[0].contents = terms;
|
||||
regex_t regex = { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -126,24 +127,25 @@ static void test_sequence(void)
|
||||
ASSERT_FALSE(accepts(&fsa, "d"));
|
||||
ASSERT_FALSE(accepts(&fsa, "abcd"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_union(void)
|
||||
{
|
||||
const char *literals = "abc";
|
||||
regex_sequence_t *alternatives = malloc(3 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(3 * sizeof(parse_sequence_t));
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_LITERAL;
|
||||
terms[0].literal = literals[i];
|
||||
|
||||
alternatives[i].count = alternatives[i].capacity = 1;
|
||||
alternatives[i].contents = terms;
|
||||
}
|
||||
regex_t regex = { .count = 3, .capacity = 3, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 3, .capacity = 3, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -154,20 +156,21 @@ static void test_union(void)
|
||||
ASSERT_FALSE(accepts(&fsa, "d"));
|
||||
ASSERT_FALSE(accepts(&fsa, "aa"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_star(void)
|
||||
{
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_STAR;
|
||||
terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_STAR;
|
||||
terms[0].type = PARSE_TERM_LITERAL;
|
||||
terms[0].literal = 'a';
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
regex_t regex = { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -177,20 +180,21 @@ static void test_star(void)
|
||||
ASSERT_TRUE(accepts(&fsa, "aaaaaa"));
|
||||
ASSERT_FALSE(accepts(&fsa, "b"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_plus(void)
|
||||
{
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_PLUS;
|
||||
terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_PLUS;
|
||||
terms[0].type = PARSE_TERM_LITERAL;
|
||||
terms[0].literal = 'a';
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
regex_t regex = { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -200,20 +204,21 @@ static void test_plus(void)
|
||||
ASSERT_FALSE(accepts(&fsa, ""));
|
||||
ASSERT_FALSE(accepts(&fsa, "b"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_qmark(void)
|
||||
{
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_QMARK;
|
||||
terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_QMARK;
|
||||
terms[0].type = PARSE_TERM_LITERAL;
|
||||
terms[0].literal = 'a';
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
regex_t regex = { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -223,29 +228,30 @@ static void test_qmark(void)
|
||||
ASSERT_FALSE(accepts(&fsa, "aa"));
|
||||
ASSERT_FALSE(accepts(&fsa, "b"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_subexpression(void)
|
||||
{
|
||||
regex_term_t *inner_terms = malloc(1 * sizeof(regex_term_t));
|
||||
inner_terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
inner_terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *inner_terms = malloc(1 * sizeof(parse_term_t));
|
||||
inner_terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
inner_terms[0].type = PARSE_TERM_LITERAL;
|
||||
inner_terms[0].literal = 'a';
|
||||
regex_sequence_t *inner_alternatives
|
||||
= malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *inner_alternatives
|
||||
= malloc(1 * sizeof(parse_sequence_t));
|
||||
inner_alternatives[0].count = inner_alternatives[0].capacity = 1;
|
||||
inner_alternatives[0].contents = inner_terms;
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_SUBEXPR;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_SUBEXPR;
|
||||
terms[0].subexpr.count = terms[0].subexpr.capacity = 1;
|
||||
terms[0].subexpr.contents = inner_alternatives;
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
regex_t regex = { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -253,7 +259,7 @@ static void test_subexpression(void)
|
||||
ASSERT_TRUE(accepts(&fsa, "a"));
|
||||
ASSERT_FALSE(accepts(&fsa, "b"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
@@ -263,16 +269,16 @@ static void test_class(void)
|
||||
class_contents[0] = 'a';
|
||||
class_contents[1] = 'b';
|
||||
class_contents[2] = 'c';
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_CLASS;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_CLASS;
|
||||
terms[0].class.negated = false;
|
||||
terms[0].class.count = terms[0].class.capacity = 3;
|
||||
terms[0].class.contents = class_contents;
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
const regex_t regex
|
||||
const parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
@@ -285,7 +291,7 @@ static void test_class(void)
|
||||
ASSERT_FALSE(accepts(&fsa, "aa"));
|
||||
ASSERT_FALSE(accepts(&fsa, "d"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
@@ -295,16 +301,16 @@ static void test_negated_class(void)
|
||||
class_contents[0] = 'a';
|
||||
class_contents[1] = 'b';
|
||||
class_contents[2] = 'c';
|
||||
regex_term_t *terms = malloc(1 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_CLASS;
|
||||
parse_term_t *terms = malloc(1 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_CLASS;
|
||||
terms[0].class.negated = true;
|
||||
terms[0].class.count = terms[0].class.capacity = 3;
|
||||
terms[0].class.contents = class_contents;
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms;
|
||||
const regex_t regex
|
||||
const parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
@@ -318,42 +324,43 @@ static void test_negated_class(void)
|
||||
ASSERT_FALSE(accepts(&fsa, ""));
|
||||
ASSERT_FALSE(accepts(&fsa, "aa"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_sequence_containing_starred_union(void)
|
||||
{
|
||||
// ab(c|d)*
|
||||
regex_term_t *inner_terms0 = malloc(1 * sizeof(regex_term_t));
|
||||
inner_terms0[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
inner_terms0[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *inner_terms0 = malloc(1 * sizeof(parse_term_t));
|
||||
inner_terms0[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
inner_terms0[0].type = PARSE_TERM_LITERAL;
|
||||
inner_terms0[0].literal = 'c';
|
||||
regex_term_t *inner_terms1 = malloc(1 * sizeof(regex_term_t));
|
||||
inner_terms1[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
inner_terms1[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *inner_terms1 = malloc(1 * sizeof(parse_term_t));
|
||||
inner_terms1[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
inner_terms1[0].type = PARSE_TERM_LITERAL;
|
||||
inner_terms1[0].literal = 'd';
|
||||
regex_sequence_t *inner_alternatives
|
||||
= malloc(2 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *inner_alternatives
|
||||
= malloc(2 * sizeof(parse_sequence_t));
|
||||
inner_alternatives[0].count = inner_alternatives[0].capacity = 1;
|
||||
inner_alternatives[0].contents = inner_terms0;
|
||||
inner_alternatives[1].count = inner_alternatives[1].capacity = 1;
|
||||
inner_alternatives[1].contents = inner_terms1;
|
||||
regex_term_t *terms = malloc(3 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms = malloc(3 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_LITERAL;
|
||||
terms[0].literal = 'a';
|
||||
terms[1].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[1].type = REGEX_TERM_LITERAL;
|
||||
terms[1].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[1].type = PARSE_TERM_LITERAL;
|
||||
terms[1].literal = 'b';
|
||||
terms[2].quantifier = REGEX_QUANTIFIER_STAR;
|
||||
terms[2].type = REGEX_TERM_SUBEXPR;
|
||||
terms[2].quantifier = PARSE_QUANTIFIER_STAR;
|
||||
terms[2].type = PARSE_TERM_SUBEXPR;
|
||||
terms[2].subexpr.count = terms[2].subexpr.capacity = 2;
|
||||
terms[2].subexpr.contents = inner_alternatives;
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 3;
|
||||
alternatives[0].contents = terms;
|
||||
regex_t regex = { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -369,7 +376,7 @@ static void test_sequence_containing_starred_union(void)
|
||||
ASSERT_FALSE(accepts(&fsa, "d"));
|
||||
ASSERT_FALSE(accepts(&fsa, "foo"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
@@ -377,23 +384,24 @@ static void
|
||||
test_union_of_single_term_and_sequence_containing_starred_term(void)
|
||||
{
|
||||
// a|b*c
|
||||
regex_term_t *terms0 = malloc(1 * sizeof(regex_term_t));
|
||||
terms0[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms0[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms0 = malloc(1 * sizeof(parse_term_t));
|
||||
terms0[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms0[0].type = PARSE_TERM_LITERAL;
|
||||
terms0[0].literal = 'a';
|
||||
regex_term_t *terms1 = malloc(2 * sizeof(regex_term_t));
|
||||
terms1[0].quantifier = REGEX_QUANTIFIER_STAR;
|
||||
terms1[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *terms1 = malloc(2 * sizeof(parse_term_t));
|
||||
terms1[0].quantifier = PARSE_QUANTIFIER_STAR;
|
||||
terms1[0].type = PARSE_TERM_LITERAL;
|
||||
terms1[0].literal = 'b';
|
||||
terms1[1].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms1[1].type = REGEX_TERM_LITERAL;
|
||||
terms1[1].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms1[1].type = PARSE_TERM_LITERAL;
|
||||
terms1[1].literal = 'c';
|
||||
regex_sequence_t *alternatives = malloc(2 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(2 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 1;
|
||||
alternatives[0].contents = terms0;
|
||||
alternatives[1].count = alternatives[1].capacity = 2;
|
||||
alternatives[1].contents = terms1;
|
||||
regex_t regex = { .count = 2, .capacity = 2, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 2, .capacity = 2, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -405,38 +413,39 @@ test_union_of_single_term_and_sequence_containing_starred_term(void)
|
||||
ASSERT_FALSE(accepts(&fsa, "foo"));
|
||||
ASSERT_FALSE(accepts(&fsa, "ba"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
static void test_sequence_of_subexpr_a_or_empty_and_b(void)
|
||||
{
|
||||
// (a|ε)b
|
||||
regex_term_t *inner_terms0 = malloc(1 * sizeof(regex_term_t));
|
||||
inner_terms0[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
inner_terms0[0].type = REGEX_TERM_LITERAL;
|
||||
parse_term_t *inner_terms0 = malloc(1 * sizeof(parse_term_t));
|
||||
inner_terms0[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
inner_terms0[0].type = PARSE_TERM_LITERAL;
|
||||
inner_terms0[0].literal = 'a';
|
||||
regex_term_t *inner_terms1 = malloc(1 * sizeof(regex_term_t));
|
||||
inner_terms1[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
inner_terms1[0].type = REGEX_TERM_EMPTY;
|
||||
regex_sequence_t *inner_alternatives
|
||||
= malloc(2 * sizeof(regex_sequence_t));
|
||||
parse_term_t *inner_terms1 = malloc(1 * sizeof(parse_term_t));
|
||||
inner_terms1[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
inner_terms1[0].type = PARSE_TERM_EMPTY;
|
||||
parse_sequence_t *inner_alternatives
|
||||
= malloc(2 * sizeof(parse_sequence_t));
|
||||
inner_alternatives[0].count = inner_alternatives[0].capacity = 1;
|
||||
inner_alternatives[0].contents = inner_terms0;
|
||||
inner_alternatives[1].count = inner_alternatives[1].capacity = 1;
|
||||
inner_alternatives[1].contents = inner_terms1;
|
||||
regex_term_t *terms = malloc(2 * sizeof(regex_term_t));
|
||||
terms[0].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[0].type = REGEX_TERM_SUBEXPR;
|
||||
parse_term_t *terms = malloc(2 * sizeof(parse_term_t));
|
||||
terms[0].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[0].type = PARSE_TERM_SUBEXPR;
|
||||
terms[0].subexpr.count = terms[0].subexpr.capacity = 2;
|
||||
terms[0].subexpr.contents = inner_alternatives;
|
||||
terms[1].quantifier = REGEX_QUANTIFIER_NONE;
|
||||
terms[1].type = REGEX_TERM_LITERAL;
|
||||
terms[1].quantifier = PARSE_QUANTIFIER_NONE;
|
||||
terms[1].type = PARSE_TERM_LITERAL;
|
||||
terms[1].literal = 'b';
|
||||
regex_sequence_t *alternatives = malloc(1 * sizeof(regex_sequence_t));
|
||||
parse_sequence_t *alternatives = malloc(1 * sizeof(parse_sequence_t));
|
||||
alternatives[0].count = alternatives[0].capacity = 2;
|
||||
alternatives[0].contents = terms;
|
||||
regex_t regex = { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
parse_tree_t regex
|
||||
= { .count = 1, .capacity = 1, .contents = alternatives };
|
||||
|
||||
fsa_t fsa;
|
||||
construct_nfa(®ex, &fsa);
|
||||
@@ -446,7 +455,7 @@ static void test_sequence_of_subexpr_a_or_empty_and_b(void)
|
||||
ASSERT_FALSE(accepts(&fsa, ""));
|
||||
ASSERT_FALSE(accepts(&fsa, "a"));
|
||||
|
||||
regex_free(®ex);
|
||||
parse_tree_free(®ex);
|
||||
fsa_free(&fsa);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,268 +10,268 @@
|
||||
|
||||
static void a_has_1_alternative(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("a", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void a_pipe_b_has_2_alternatives(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("a|b", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(2, t.count);
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void a_pipe_b_pipe_c_has_3_alternatives(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("a|b|c", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(3, t.count);
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void a_is_parsed_as_unquantified_literal(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("a", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ('a', t.contents[0].contents[0].literal);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void b_is_parsed_as_unquantified_literal(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("b", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ('b', t.contents[0].contents[0].literal);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void abc_is_parsed_as_sequence_of_unquantified_literals(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("abc", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(3, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ('a', t.contents[0].contents[0].literal);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[1].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[1].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[1].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[1].type);
|
||||
ASSERT_EQ('b', t.contents[0].contents[1].literal);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[2].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[2].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[2].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[2].type);
|
||||
ASSERT_EQ('c', t.contents[0].contents[2].literal);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void dot_is_parsed_as_unquantified_wildcard_term(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING(".", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void backslash_dot_is_parsed_as_unquantified_literal(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("\\.", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ('.', t.contents[0].contents[0].literal);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void backslash_backslash_is_parsed_as_unquantified_literal(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("\\\\", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ('\\', t.contents[0].contents[0].literal);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void a_pipe_b_in_parens_is_parsed_as_subexpr_term(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("(a|b)", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_SUBEXPR, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_SUBEXPR, t.contents[0].contents[0].type);
|
||||
|
||||
const regex_t *inner = &t.contents[0].contents[0].subexpr;
|
||||
const parse_tree_t *inner = &t.contents[0].contents[0].subexpr;
|
||||
ASSERT_EQ(2, inner->count);
|
||||
|
||||
ASSERT_EQ(1, inner->contents[0].count);
|
||||
ASSERT_EQ(
|
||||
REGEX_QUANTIFIER_NONE, inner->contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, inner->contents[0].contents[0].type);
|
||||
PARSE_QUANTIFIER_NONE, inner->contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, inner->contents[0].contents[0].type);
|
||||
ASSERT_EQ('a', inner->contents[0].contents[0].literal);
|
||||
|
||||
ASSERT_EQ(1, inner->contents[1].count);
|
||||
ASSERT_EQ(
|
||||
REGEX_QUANTIFIER_NONE, inner->contents[1].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, inner->contents[1].contents[0].type);
|
||||
PARSE_QUANTIFIER_NONE, inner->contents[1].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, inner->contents[1].contents[0].type);
|
||||
ASSERT_EQ('b', inner->contents[1].contents[0].literal);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void a_in_parens_b_is_parsed_as_sequence_with_subexpr_term(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("(a)b", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(2, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_SUBEXPR, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[1].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, t.contents[0].contents[1].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_SUBEXPR, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[1].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, t.contents[0].contents[1].type);
|
||||
ASSERT_EQ('b', t.contents[0].contents[1].literal);
|
||||
|
||||
const regex_t *inner = &t.contents[0].contents[0].subexpr;
|
||||
const parse_tree_t *inner = &t.contents[0].contents[0].subexpr;
|
||||
ASSERT_EQ(1, inner->contents[0].count);
|
||||
ASSERT_EQ(
|
||||
REGEX_QUANTIFIER_NONE, inner->contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_LITERAL, inner->contents[0].contents[0].type);
|
||||
PARSE_QUANTIFIER_NONE, inner->contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_LITERAL, inner->contents[0].contents[0].type);
|
||||
ASSERT_EQ('a', inner->contents[0].contents[0].literal);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void dot_star_is_parsed_as_star_quantified_wildcard(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING(".*", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_STAR, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_STAR, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void dot_plus_is_parsed_as_plus_quantified_wildcard(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING(".+", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_PLUS, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_PLUS, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void dot_question_mark_is_parsed_as_qmrk_quantified_wildcard(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING(".?", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_QMARK, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_QMARK, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_WILDCARD, t.contents[0].contents[0].type);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void a_in_brackets_is_parsed_as_class_containing_only_a(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("[a]", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_CLASS, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_CLASS, t.contents[0].contents[0].type);
|
||||
ASSERT_FALSE(t.contents[0].contents[0].class.negated);
|
||||
ASSERT_EQ(1, t.contents[0].contents[0].class.count);
|
||||
ASSERT_NOT_NULL(t.contents[0].contents[0].class.contents);
|
||||
ASSERT_EQ('a', t.contents[0].contents[0].class.contents[0]);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
static void caret_a_in_brackets_parses_as_negated_class(void)
|
||||
{
|
||||
regex_t t;
|
||||
parse_tree_t t;
|
||||
const int result = PARSE_EXPR_STRING("[^a]", &t);
|
||||
ASSERT_NE(-1, result);
|
||||
ASSERT_EQ(1, t.count);
|
||||
ASSERT_NOT_NULL(t.contents);
|
||||
|
||||
ASSERT_EQ(1, t.contents[0].count);
|
||||
ASSERT_EQ(REGEX_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(REGEX_TERM_CLASS, t.contents[0].contents[0].type);
|
||||
ASSERT_EQ(PARSE_QUANTIFIER_NONE, t.contents[0].contents[0].quantifier);
|
||||
ASSERT_EQ(PARSE_TERM_CLASS, t.contents[0].contents[0].type);
|
||||
ASSERT_TRUE(t.contents[0].contents[0].class.negated);
|
||||
ASSERT_EQ(1, t.contents[0].contents[0].class.count);
|
||||
ASSERT_NOT_NULL(t.contents[0].contents[0].class.contents);
|
||||
ASSERT_EQ('a', t.contents[0].contents[0].class.contents[0]);
|
||||
|
||||
regex_free(&t);
|
||||
parse_tree_free(&t);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
||||
Reference in New Issue
Block a user