diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index d4c1d43304..23a977a773 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -2839,7 +2839,7 @@ begin and AtomIsKeyWord then RaiseCharExpectedButAtomFound(';'); - until (CurPos.Flag in [cafSemicolon,cafNone]); + until (CurPos.Flag=cafSemicolon) or (CurPos.StartPos>SrcLen); end; // read ; if CurPos.Flag<>cafSemicolon then