From 0f5b63d67c6a0df25df68b968c1adf6eee940213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Primo=C5=BE=20Gabrijel=C4=8Di=C4=8D?= Date: Thu, 27 Jul 2017 16:40:55 +0200 Subject: [PATCH] don't $I files when in skipped $IFDEF/$IF If $INCLUDE/$I is found while in the $IF(N)DEF/$IF part which is being skipped (undefined conditional etc), include is ignored. This speeds up parsing (especially if include file has to be found in a long search path) and makes the parser more compatible with Delphi which ignores $INCLUDE statements inside skipped blocks. --- Source/SimpleParser/SimpleParser.Lexer.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SimpleParser/SimpleParser.Lexer.pas b/Source/SimpleParser/SimpleParser.Lexer.pas index 7725e355..86c01475 100644 --- a/Source/SimpleParser/SimpleParser.Lexer.pas +++ b/Source/SimpleParser/SimpleParser.Lexer.pas @@ -1595,7 +1595,7 @@ procedure TmwBasePasLex.BraceOpenProc; begin // if Assigned(FOnIncludeDirect) then // FOnIncludeDirect(Self); - if Assigned(FIncludeHandler) then + if Assigned(FIncludeHandler) and (FDefineStack = 0) then IncludeFile else Next;