pre now does case insensitive matching if case_sensitive=off is set

This commit is contained in:
Krasimir Angelov
2023-02-23 10:21:50 +01:00
parent 35e47b9fac
commit f40072a5f4
4 changed files with 34 additions and 2 deletions

View File

@@ -646,8 +646,14 @@ void PgfLinearizer::reverse_and_label(bool add_linref)
}
}
PGF_INTERNAL_DECL bool
pgf_is_case_sensitive(ref<PgfConcr> concr);
void PgfLinearizer::flush_pre_stack(PgfLinearizationOutputIface *out, PgfText *token)
{
bool (*cmp)(PgfText *t, PgfText *prefix) =
pgf_is_case_sensitive(concr) ? textstarts : textistarts;
while (pre_stack != NULL) {
PreStack *pre = pre_stack;
pre_stack = pre->next;
@@ -657,7 +663,7 @@ void PgfLinearizer::flush_pre_stack(PgfLinearizationOutputIface *out, PgfText *t
PgfAlternative *alt = &pre->sym_kp->alts.data[i];
for (size_t j = 0; j < alt->prefixes->len; j++) {
ref<PgfText> prefix = *vector_elem(alt->prefixes,j);
if (textstarts(token, &(*prefix))) {
if (cmp(token, &(*prefix))) {
pre->node->linearize_seq(out, this, alt->form);
goto done;
}