From 538b41da36b8c42e6099e0972eb2436737476013 Mon Sep 17 00:00:00 2001 From: joost Date: Fri, 10 Dec 2010 15:40:33 +0000 Subject: * Fixed detection of regular strings, so that a normal search is performed * Strings with a braces, parentheses and pipe-symbols are always handled as regex-patterns git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16537 3ad0048d-3df7-0310-abae-a5850022a9f2 --- packages/regexpr/src/regex.pp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'packages/regexpr') diff --git a/packages/regexpr/src/regex.pp b/packages/regexpr/src/regex.pp index 62dcace75a..3c4f104e9a 100644 --- a/packages/regexpr/src/regex.pp +++ b/packages/regexpr/src/regex.pp @@ -454,7 +454,7 @@ begin if FStateCount=length(FStateTable) then setlength(FStateTable,(FStateCount * 3) div 2); - if not (aMatchType in [mtChar,mtTerminal]) then FRegexType := rtRegEx; + if not (aMatchType in [mtChar,mtTerminal,mtNone]) then FRegexType := rtRegEx; end; {--------} procedure TRegexEngine.rcClear; @@ -706,6 +706,8 @@ begin end; {move past the close parenthesis} inc(FPosn); + {always handle expressions with parentheses as regular-expression} + FRegexType := rtRegEx; end; '[' : begin @@ -954,6 +956,8 @@ begin {now set the end state for the initial term to point to the final end state for the second expr and the overall expr} rcSetState(EndState1, FStateCount, UnusedState); + {always handle expressions with a pipe as regular-expression} + FRegexType := rtRegEx; end; end; {--------} @@ -1092,11 +1096,10 @@ begin if m = -1 then rcAddState(mtNone, #0, nil, NewFinalState, TempEndStateAtom); - if FRegexType <> rtRegEx then - FRegexType := rtRegEx; - Result := StartStateAtom; end; + {always handle expressions with braces as regular-expression} + FRegexType := rtRegEx; end; else -- cgit v1.2.1