浏览代码

* Force ampersand in EscaleKeyword

Michaël Van Canneyt 3 年之前
父节点
当前提交
9af13b2731
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      packages/fcl-base/src/pascodegen.pp

+ 6 - 3
packages/fcl-base/src/pascodegen.pp

@@ -66,7 +66,7 @@ Type
     Procedure Indent;
     Procedure Undent;
     Function IsKeyWord (Const S : String) : Boolean;
-    Function EscapeKeyWord(Const S : String) : String;
+    Function EscapeKeyWord(Const S : String; ForceAmpersand : Boolean = false) : String;
     Function MakePascalString(S: String; AddQuotes: Boolean=False): String;
     Function PrettyPrint(Const S: string): String;
     Procedure AddLn(Const Aline: string);
@@ -126,11 +126,14 @@ begin
   Result:=Pos(';'+lowercase(S)+';',KW)<>0;
 end;
 
-function TPascalCodeGenerator.EscapeKeyWord(const S: String): String;
+function TPascalCodeGenerator.EscapeKeyWord(const S: String; ForceAmpersand : Boolean = false): String;
 begin
   Result:=S;
   if IsKeyWord(S) then
-    Result:=KeywordPrefix+Result+KeywordSuffix
+    if ForceAmpersand then
+      Result:='&'+Result
+    else
+      Result:=KeywordPrefix+Result+KeywordSuffix
 end;
 
 procedure TPascalCodeGenerator.AddLn(const Aline: string);