NotePad++ 用户定义语言不显示条件语句

NotePad++ 用户定义语言不显示条件语句

我在 NotePad+ 中下载了 Powerbuilder 的用户定义语言。除了它没有在高亮中显示条件语句外,一切都运行正常。我查看了 XML,但没有发现任何问题,因为它应该被高亮显示。

您对这里可能存在的问题有什么想法吗?以下是它在 NotePad++ 中的屏幕截图:

条件语句用户定义语言

PowerBuilder.xml <- 用户定义语言

<NotepadPlus>
    <UserLang name="PowerBuilder" ext="srw sru srs srm">
        <Settings>
            <Global caseIgnored="yes"/>
            <TreatAsSymbol comment="yes" commentLine="yes"/>
            <Prefix words1="no" words2="no" words3="no" words4="no"/>
        </Settings>
            <KeywordLists>
                <Keywords name="Delimiters">"00"00</Keywords>
                <Keywords name="Folder+">if choose subroutine type</Keywords>
                <Keywords name="Folder-">end</Keywords>
                <Keywords name="Operators">( ) . ;</Keywords>
                <Keywords name="Comment">1/* 2*/ 0//</Keywords>
                <Keywords name="Words1">
                alias and autoinstantiate call case catch choose close commit connect constant continue create cursor declare delete describe descriptor destory disconnect do dynamic else elseif end enumerated event execute exit external false fetch finally first for forward from function global goto halt if immediate indirect insert into intrinsic is last library loop namespace native next not of on open or parent post prepare prior private privateread privatewrite procedure protected protectedread protectedwrite prototypes public readonly ref return rollback rpcfunc select selectblob shared static step subroutine super system systemread systemwrite then this throw throws to trigger true try type until update updateblob using variables while with within xor _debug
                </Keywords>
                <Keywords name="Words2">
                any Blob Boolean Byte Char Character Date DateTime Decimal Dec Double Integer Int Long LongLong Real String Time UnsignedInteger UnsignedInt UInt UnsignedLong ULong
                </Keywords>
                <Keywords name="Words3">this parent super</Keywords>
                <Keywords name="Words4"/>
            </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1"/>
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="800080" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1"/>
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="@Arial Unicode MS" fontStyle="0"/>
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="959595" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
        </Styles>
    </UserLang>
</NotepadPlus>

答案1

我知道你的评论说你试图if从 XML 中的 Folder+ 中删除...但当我使用 UDL 对话框更改设置时,它确认它if位于代码 1 样式的折叠这就是罪魁祸首:

  • 由于您有 UDL 定义,我看到的内容与您展示的类似:
  • 如果我随后改变斯泰勒为了代码 1 样式的折叠,和Chooseif遵循end折叠颜色:
  • 如果我然后if删除代码 1 样式的折叠if从粉红色变为蓝色。

如果某个单词同时被列为“折叠”和“关键字”,它将应用“折叠”样式的格式,因为 UDL 词法分析器会在突出显示“关键字”之前查找“折叠”,并且一旦找到就会停止。

(此外,我建议elseif在“中间”部分添加代码 1 样式的折叠,如果您保留ifas 折叠而不是关键字。)

相关内容