use of com.intellij.openapi.editor.LogicalPosition in project ideavim by JetBrains.
the class RegExp method regmatch.
/*
* regmatch - main matching routine
*
* Conceptually the strategy is simple: Check to see whether the current
* node matches, call self recursively to see whether the rest matches,
* and then act accordingly. In practice we make some effort to avoid
* recursion, in particular by going through "ordinary" nodes (that don't
* need to know whether the rest of the match failed) by a loop instead of
* by recursion.
*
* Returns true when there is a match. Leaves reginput and reglnum just after
* the last matched character.
* Returns false when there is no match. Leaves reginput and reglnum in an
* undefined state!
*/
private boolean regmatch(@Nullable CharPointer scan) {
CharPointer next;
/* Next node. */
int op;
char c;
while (scan != null) {
if (got_int || out_of_stack) {
return false;
}
next = regnext(scan);
op = scan.OP();
/* Check for character class with NL added. */
if (WITH_NL(op) && reginput.isNul() && reglnum < reg_maxline) {
reg_nextline();
} else {
if (WITH_NL(op)) {
op -= ADD_NL;
}
c = reginput.charAt();
switch(op) {
case BOL:
if (!reginput.equals(regline)) {
return false;
}
break;
case EOL:
if (c != '