bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24615: [PATCH] sed: handle the patterns which consist of ^ or $ manu


From: Norihiro Tanaka
Subject: bug#24615: [PATCH] sed: handle the patterns which consist of ^ or $ manually
Date: Sat, 22 Oct 2016 01:34:46 +0900

On Thu, 20 Oct 2016 22:08:34 -0400
Assaf Gordon <address@hidden> wrote:

>    2.3. There one more case which returns a match:
>            if (!regsize && (regex->flags & REG_NEWLINE) && !backref)
>               return 1;
>         I'm not sure which cases it covers?

First, DFA can not return exact position matched. i.e., "regsize" is not
supported in DFA.

Second, DFA did not support in not newline_anchor. i.e.,
"regex->flags & REG_NEWLINE" was not supported in DFA.

BTW, recently, it is supported, and I hope to use the new feature.  I
suggest it in bug#24457.

Third, DFA did not support back reference as \1, \2 ... .  We can found
that in dfaexec().

If three cases are not filled, i.e.,
"!regsize && (regex->flags & REG_NEWLINE) && !backref" is true,
DFA is supported for the pattern exactly, then we do not need to execute
old regex.

> Is this description correct ?

Yes, your understanding is correct.

> Lastly,
> Could you expand on dfa's 'superset' and 'isfast' ?
> what are the cases which there is/no superset,
> and when is a DFA regex fast?

"superset" was introduced in bug#16966.  Please, see below.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16966

"isfast" means DFA is more faster than regex.  It is true if as folloing.

  "DFA->superset != NULL || DFA->dfaexec == dfaexec_sb"

However, If fastmap is used in regex, the assumption may not be correct.

Could my response help your understanding?

Thanks,
Norihiro






reply via email to

[Prev in Thread] Current Thread [Next in Thread]