开发者

Syntax mode for Coda not working - Regex issue

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>(((?&lt;!\\)(\\\\)*)|^)"</regex></end>
            </state>

            <state id="Variable" color="#ff0000">
                <begin><regex>^\$([a-z])(?:)</regex></begin>
                <end><rege开发者_运维知识库x>[\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.


Try:

 <begin><regex>^\$[^\r\n]+</regex></begin>

or

<begin><regex>^\$</regex></begin>

depending on how it works


I found a bit of code which seems to work:

<regex>(\$([\w\d])+)</regex>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜