Coda 的语法模式不起作用 - 正则表达式问题
我有以下 SyntaxDefinition.xml 文件,用于为 SilverStripe(.ss) 文件创建语法突出显示。但是,我收到以下代码的正则表达式错误:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE syntax SYSTEM "syntax.dtd">
<syntax>
<head>
<name>SilverStripe Syntax</name>
<charsintokens><![CDATA[_0987654321abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@]]></charsintokens>
</head>
<states>
<default id="Base" color="#000">
<state id="String" color="#760f15">
<begin><regex>"</regex></begin>
<end><regex>(((?<!\\)(\\\\)*)|^)"</regex></end>
</state>
<state id="Variable" color="#ff0000">
<begin><regex>^\$([a-z])(?:)</regex></begin>
<end><regex>[\n\r]</regex></end>
</state>
<import mode="PHP-HTML"/>
</default>
</states>
</syntax>
我希望此代码的“变量”部分为以美元符号开头的任何代码(例如 $Content)着色。
I have the following SyntaxDefinition.xml file that I am using to create syntax highlighting for SilverStripe(.ss) files. However, I get a regex error with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE syntax SYSTEM "syntax.dtd">
<syntax>
<head>
<name>SilverStripe Syntax</name>
<charsintokens><![CDATA[_0987654321abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@]]></charsintokens>
</head>
<states>
<default id="Base" color="#000">
<state id="String" color="#760f15">
<begin><regex>"</regex></begin>
<end><regex>(((?<!\\)(\\\\)*)|^)"</regex></end>
</state>
<state id="Variable" color="#ff0000">
<begin><regex>^\$([a-z])(?:)</regex></begin>
<end><regex>[\n\r]</regex></end>
</state>
<import mode="PHP-HTML"/>
</default>
</states>
</syntax>
I want the "Variable" part of this code to color any code starting with a dollar sign, e.g. $Content.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
或
取决于它的工作原理
Try:
or
depending on how it works
我发现了一些似乎有效的代码:
I found a bit of code which seems to work: