| 145 | #endif |
| 146 | |
| 147 | void fxInitializeRegExp(txMachine* the) |
| 148 | { |
| 149 | #if mxRegExp |
| 150 | txSlot* instance = fxToInstance(the, mxThis); |
| 151 | txSlot* regexp = instance->next; |
| 152 | txSlot* key = regexp->next; |
| 153 | txString pattern; |
| 154 | txString modifier; |
| 155 | |
| 156 | if (mxArgv(0)->kind == XS_UNDEFINED_KIND) |
| 157 | *mxArgv(0) = mxEmptyString; |
| 158 | else |
| 159 | fxToString(the, mxArgv(0)); |
| 160 | if (mxArgv(1)->kind == XS_UNDEFINED_KIND) |
| 161 | *mxArgv(1) = mxEmptyString; |
| 162 | else |
| 163 | fxToString(the, mxArgv(1)); |
| 164 | key->kind = (mxArgv(0)->kind == XS_STRING_X_KIND) ? XS_KEY_X_KIND : XS_KEY_KIND; |
| 165 | pattern = key->value.key.string = mxArgv(0)->value.string; |
| 166 | modifier = mxArgv(1)->value.string; |
| 167 | if (!fxCompileRegExp(the, pattern, modifier, ®exp->value.regexp.code, ®exp->value.regexp.data, the->nameBuffer, sizeof(the->nameBuffer))) |
| 168 | mxSyntaxError("invalid regular expression: %s", the->nameBuffer); |
| 169 | *mxResult = *mxThis; |
| 170 | #endif |
| 171 | } |
| 172 | |
| 173 | txBoolean fxIsRegExp(txMachine* the, txSlot* slot) |
| 174 | { |
nothing calls this directly
no test coverage detected