我使用ACE web编辑器进行pascal语言编码,并希望在模式-pascal.js本机文件中添加规则。
我想要的是在所有行中突出显示所有‘读’和‘写’关键字,以'property‘开头,以';’结尾。
类似于:
property Lala : Integer read (123) write (456);但不是:
var read := "write"; 还有ACE..。我只需要用一个regexp就可以了,有趣。
如果有人有主意,它就能救一条命!
发布于 2017-05-05 20:16:17
Ace语法高亮器支持类似于textmate和崇高的状态。这意味着您可以匹配property关键字,并切换到突出显示read和write的状态,如下所示:
[
...
{
regex: /property\b/
token: "keyword",
next: [
{
regex: /(read|write)\b/
token: "keyword",
},
{ include: "start" }, // include other rules if you want
{
regex: "$|;",
token: "text",
next: "start" // exit the property state on line end or ;
}
]
}
...https://stackoverflow.com/questions/43762841
复制相似问题