How do you escape a reserved word in Free-Pascal?

心已入冬 提交于 2019-12-11 02:31:59

问题


Actually i'am working on translate some librarys to free-pascal. so the problem is which in delphi can use the ampersand (&) symbol to escape a reserved word, but in free-pascal does not work. the compiler complains with this message
ForLibDx.pas(72,13) Fatal: illegal character "'&'" ($26)

when include an ampersand symbol.

actually i am using the {$MODE DELPHI} to compile my units under free-pascal

FPC 2.2.4

Lazarus 0.9.28.2

thanks in advance.


回答1:


From what I recollect, the FPC compiler does not have a means for escaping reserved words.
The ampersand (&) as an escape character to escape reserved words is a Delphi-compiler-only feature of the Delphi language.

You might work around this by using the fully qualified name (including unit, and classname) as Rob Kennedy suggests here.

NB: It is recommended to avoid these ampersand escapes in Delphi for non-generated code, as not all of the IDE and 3rd party tools can cope with it.

--jeroen



来源:https://stackoverflow.com/questions/4501002/how-do-you-escape-a-reserved-word-in-free-pascal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!