From 267adf4e46aa6f1699ec3a8e2840323743eb006b Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 4 Sep 2015 13:27:28 +0000 Subject: [PATCH] scanner.pas, tscanner: + new method to check how many token replays are currently active. This is needed for example to determine the end of a generic method which may contain modifiers and such. git-svn-id: trunk@31506 - --- compiler/scanner.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/compiler/scanner.pas b/compiler/scanner.pas index f0a2c44a03..3cd8f08179 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -172,6 +172,7 @@ interface procedure elseifpreprocstack(compile_time_predicate:tcompile_time_predicate); procedure elsepreprocstack; procedure popreplaystack; + function replay_stack_depth:longint; procedure handleconditional(p:tdirectiveitem); procedure handledirectives; procedure linebreak; @@ -3770,6 +3771,20 @@ type end; end; + + function tscannerfile.replay_stack_depth:longint; + var + tmp: treplaystack; + begin + result:=0; + tmp:=replaystack; + while assigned(tmp) do + begin + inc(result); + tmp:=tmp.next; + end; + end; + procedure tscannerfile.handleconditional(p:tdirectiveitem); begin savetokenpos;