diff --git a/compiler/packages/fcl-passrc/src/pparser.pp b/compiler/packages/fcl-passrc/src/pparser.pp index 768de3b..47a3f27 100644 --- a/compiler/packages/fcl-passrc/src/pparser.pp +++ b/compiler/packages/fcl-passrc/src/pparser.pp @@ -3060,6 +3060,7 @@ begin FCurModule:=Module; HasFinished:=true; try + Scanner.CurModuleName:=AUnitName; if Assigned(Engine.Package) then begin Module.PackageName := Engine.Package.Name; @@ -3231,6 +3232,7 @@ begin HasFinished:=true; FCurModule:=Module; try + Scanner.CurModuleName:=N; if Assigned(Engine.Package) then begin Module.PackageName := Engine.Package.Name; @@ -3307,6 +3309,7 @@ begin HasFinished:=true; FCurModule:=Module; try + Scanner.CurModuleName:=N; if Assigned(Engine.Package) then begin Module.PackageName := Engine.Package.Name; diff --git a/compiler/packages/fcl-passrc/src/pscanner.pp b/compiler/packages/fcl-passrc/src/pscanner.pp index e501501..be9cf27 100644 --- a/compiler/packages/fcl-passrc/src/pscanner.pp +++ b/compiler/packages/fcl-passrc/src/pscanner.pp @@ -703,6 +703,7 @@ type FAllowedModeSwitches: TModeSwitches; FAllowedValueSwitches: TValueSwitches; FConditionEval: TCondDirectiveEvaluator; + FCurModulename: string; FCurrentBoolSwitches: TBoolSwitches; FCurrentModeSwitches: TModeSwitches; FCurrentValueSwitches: TValueSwitchArray; @@ -864,6 +865,7 @@ type property Files: TStrings read FFiles; property CurSourceFile: TLineReader read FCurSourceFile; property CurFilename: string read FCurFilename; + property CurModuleName: string read FCurModulename Write FCurModuleName; property CurLine: string read FCurLine; property CurRow: Integer read FCurRow; property CurColumn: Integer read GetCurColumn; diff --git a/compiler/packages/pastojs/src/fppas2js.pp b/compiler/packages/pastojs/src/fppas2js.pp index 1c8dd4b..f02e454 100644 --- a/compiler/packages/pastojs/src/fppas2js.pp +++ b/compiler/packages/pastojs/src/fppas2js.pp @@ -2877,6 +2877,17 @@ begin SetStr(CurFilename); exit; end; + '%filename%': + begin + SetStr(ExtractFileName(CurFilename)); + exit; + end; + '%unit%', + '%module%': + begin + SetStr(CurModuleName); + exit; + end; '%line%': begin SetStr(IntToStr(CurRow));