Simplify chaining
This commit is contained in:
parent
1911b9d21b
commit
4169710911
|
@ -258,20 +258,15 @@ static inline bool context_lookup (hb_apply_context_t *context,
|
||||||
const LookupRecord lookupRecord[],
|
const LookupRecord lookupRecord[],
|
||||||
ContextLookupContext &lookup_context)
|
ContextLookupContext &lookup_context)
|
||||||
{
|
{
|
||||||
unsigned int new_context_length;
|
hb_apply_context_t new_context = *context;
|
||||||
if (!match_input (context,
|
return match_input (context,
|
||||||
inputCount, input,
|
inputCount, input,
|
||||||
lookup_context.funcs.match, lookup_context.match_data,
|
lookup_context.funcs.match, lookup_context.match_data,
|
||||||
&new_context_length)) return false;
|
&new_context.context_length)
|
||||||
unsigned int old_context_length;
|
&& apply_lookup (&new_context,
|
||||||
old_context_length = context->context_length;
|
|
||||||
context->context_length = new_context_length;
|
|
||||||
bool ret = apply_lookup (context,
|
|
||||||
inputCount,
|
inputCount,
|
||||||
lookupCount, lookupRecord,
|
lookupCount, lookupRecord,
|
||||||
lookup_context.funcs.apply);
|
lookup_context.funcs.apply);
|
||||||
context->context_length = old_context_length;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Rule
|
struct Rule
|
||||||
|
@ -529,28 +524,22 @@ static inline bool chain_context_lookup (hb_apply_context_t *context,
|
||||||
inputCount + lookaheadCount > context->context_length))
|
inputCount + lookaheadCount > context->context_length))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned int offset;
|
hb_apply_context_t new_context = *context;
|
||||||
if (!(match_backtrack (context,
|
return match_backtrack (context,
|
||||||
backtrackCount, backtrack,
|
backtrackCount, backtrack,
|
||||||
lookup_context.funcs.match, lookup_context.match_data[0]) &&
|
lookup_context.funcs.match, lookup_context.match_data[0])
|
||||||
match_input (context,
|
&& match_input (context,
|
||||||
inputCount, input,
|
inputCount, input,
|
||||||
lookup_context.funcs.match, lookup_context.match_data[1],
|
lookup_context.funcs.match, lookup_context.match_data[1],
|
||||||
&offset) &&
|
&new_context.context_length)
|
||||||
match_lookahead (context,
|
&& match_lookahead (context,
|
||||||
lookaheadCount, lookahead,
|
lookaheadCount, lookahead,
|
||||||
lookup_context.funcs.match, lookup_context.match_data[2],
|
lookup_context.funcs.match, lookup_context.match_data[2],
|
||||||
offset))) return false;
|
new_context.context_length)
|
||||||
|
&& apply_lookup (&new_context,
|
||||||
unsigned int old_context_length;
|
|
||||||
old_context_length = context->context_length;
|
|
||||||
context->context_length = offset;
|
|
||||||
bool ret = apply_lookup (context,
|
|
||||||
inputCount,
|
inputCount,
|
||||||
lookupCount, lookupRecord,
|
lookupCount, lookupRecord,
|
||||||
lookup_context.funcs.apply);
|
lookup_context.funcs.apply);
|
||||||
context->context_length = old_context_length;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ChainRule
|
struct ChainRule
|
||||||
|
|
Loading…
Reference in New Issue