summaryrefslogtreecommitdiff
path: root/packages/regexpr
diff options
context:
space:
mode:
authorjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-12-10 15:40:33 +0000
committerjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-12-10 15:40:33 +0000
commit538b41da36b8c42e6099e0972eb2436737476013 (patch)
tree74ca8879a00a223359f2bf004139077678cf93bc /packages/regexpr
parentb76df34d44984318d1f61cde3f79a57abe29a4a5 (diff)
downloadfpc-538b41da36b8c42e6099e0972eb2436737476013.tar.gz
* 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
Diffstat (limited to 'packages/regexpr')
-rw-r--r--packages/regexpr/src/regex.pp11
1 files changed, 7 insertions, 4 deletions
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