+ fixed endless loop for last preprocessor directive, noted by Josef Ryan.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@676 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2009-01-26 20:59:20 +00:00
parent 2dfc304bcf
commit 4cf4ed40e5
2 changed files with 4 additions and 2 deletions

View File

@ -956,7 +956,8 @@ begin
if s = '#define' then df := TCPrepDefine.Create(nil)
else if s = '#include' then df := TCPrepInclude.Create(nil)
else if s = '#else' then df := TCPrepInclude.Create(nil)
else if s = '#endif' then df := TCPrepEndif.Create(nil)
else if s = '#endif' then
df := TCPrepEndif.Create(nil)
else if (s = '#if') or (s = '#elif') or (s = '#ifdef') or (s = '#ifndef') then df := TCPrepIf.Create(nil)
else if s = '#pragma' then df := TCPrepPragma.Create(nil)
else df := nil;
@ -1773,7 +1774,6 @@ var
begin
Result := false;
if not AParser.FindNextToken(_Directive, tt) then begin
AParser.Index := AParser.TokenPos;
AParser.SetError('precompiler directive not found');
Exit;
end;

View File

@ -161,6 +161,8 @@ begin
try
parser.Buf := s;
try
parser.UsePrecompileEntities := false;
parser.UseCommentEntities := false;
parser.OnPrecompile := prec.OnPrecompile;
parser.OnComment := prec.OnComment;
parser.IgnoreTokens.AddStrings(ConvertSettings.IgnoreTokens);