48 static aint uiIMatch(parser* spCtx,
aint uiOffset,
aint uiPhraseOffset,
aint uiPhraseLength);
49 static aint uiSMatch(parser* spCtx,
aint uiOffset,
aint uiPhraseOffset,
aint uiPhraseLength);
51 void vBkr(parser* spCtx,
const opcode* spOp) {
52 spCtx->sState.uiHitCount++;
54 if(spCtx->uiTreeDepth > spCtx->sState.uiMaxTreeDepth){
55 spCtx->sState.uiMaxTreeDepth = spCtx->uiTreeDepth;
57 TRACE_DOWN(spCtx->vpTrace, spOp, spCtx->uiOffset);
59 aint uiPhraseLength = 0;
62 sPhrase =
sBkruFetch(spCtx->vpBkru, spOp->sBkr.uiRuleIndex);
64 sPhrase =
sBkrpFetch(spCtx->vpBkrp, spOp->sBkr.uiRuleIndex);
67 "back reference mode must be ID_BKR_MODE_U or ID_BKR_MODE_P");
75 "back reference case must be ID_BKR_CASE_I or ID_BKR_CASE_S");
78 spCtx->uiOpState = uiState;
79 spCtx->uiPhraseLength = uiPhraseLength;
80 spCtx->uiOffset += uiPhraseLength;
81 TRACE_UP(spCtx->vpTrace, spOp, spCtx->uiOpState, (spCtx->uiOffset - spCtx->uiPhraseLength), spCtx->uiPhraseLength);
82 STATS_HIT(spCtx->vpStats, spOp, spCtx->uiOpState);
86 static aint uiIMatch(parser* spCtx,
aint uiOffset,
aint uiPhraseOffset,
aint uiPhraseLength) {
87 if (uiOffset + uiPhraseLength > spCtx->uiSubStringEnd) {
90 const achar* acpInputBeg = &spCtx->acpInputString[uiOffset];
91 const achar* acpPhraseBeg = &spCtx->acpInputString[uiPhraseOffset];
92 const achar* acpPhraseEnd = acpPhraseBeg + uiPhraseLength;
93 for (; acpPhraseBeg < acpPhraseEnd; acpPhraseBeg++, acpInputBeg++) {
95 achar acInput = *acpInputBeg;
96 achar acPhrase = *acpPhraseBeg;
97 if (acInput >= (
achar) 65 && acInput <= (
achar) 90) {
98 acInput += (
achar) 32;
100 if (acPhrase >= (
achar) 65 && acPhrase <= (
achar) 90) {
101 acPhrase += (
achar) 32;
103 if (acInput != acPhrase) {
109 static aint uiSMatch(parser* spCtx,
aint uiOffset,
aint uiPhraseOffset,
aint uiPhraseLength) {
110 if (uiOffset + uiPhraseLength > spCtx->uiSubStringEnd) {
113 const achar* acpInputBeg = &spCtx->acpInputString[uiOffset];
114 const achar* acpPhraseBeg = &spCtx->acpInputString[uiPhraseOffset];
115 const achar* acpPhraseEnd = acpPhraseBeg + uiPhraseLength;
116 for (; acpPhraseBeg < acpPhraseEnd; acpPhraseBeg++, acpInputBeg++) {
117 if (*acpInputBeg != *acpPhraseBeg) {