如何在Free-Pascal中转义保留字? [英] How do you escape a reserved word in Free-Pascal?

查看:175
本文介绍了如何在Free-Pascal中转义保留字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我正在努力将某些库翻译为自由帕斯卡.因此,问题是在delphi中哪些可以使用&符号来转义保留字,但在自由帕斯卡中则不起作用.编译器抱怨此消息
ForLibDx.pas(72,13) Fatal: illegal character "'&'" ($26)

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)

当包含&"符号时.

实际上我正在使用{$MODE DELPHI}在自由帕斯卡下编译我的单元

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

FPC 2.2.4

FPC 2.2.4

拉撒路0.9.28.2

Lazarus 0.9.28.2

提前谢谢.

推荐答案

根据我的回忆,FPC编译器没有逃避保留字的方法.
与符号(&)作为转义字符以转义保留字是Delphi语言的仅用于Delphi编译器的功能.

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.

您可以使用罗宾·肯尼迪(Rob Kennedy)建议的

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

注意:对于非生成的代码,建议避免在Delphi中使用这些&"转义符,因为并非所有的IDE和3rd party工具都可以解决此问题.

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

这篇关于如何在Free-Pascal中转义保留字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆