Notepad ++语法高亮:规则冲突

时间:2015-03-20 10:12:43

标签: notepad++ syntax-highlighting keyword

我在Notepad ++中定制了一种新语言。

我的问题是我有两个关键字:LAYERLAYER_ENCODING。在菜单 Languages>定义您的语言>选择您定义的语言,在第一个标签语法折叠中提及LAYER,而在第二个标签中提及LAYER_ENCODING 关键字列表 。以下是LAYER_ENCODING的语法着色:

enter image description here

我似乎无法识别LAYER_ENCODING关键字,因为LAYER已经存在...有关如何解决此问题的任何想法?

编辑:以下是我的自定义规则:

<NotepadPlus>
    <UserLang name="Mapfile" ext="map" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">03 04 00# 01 02</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2"></Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">&apos; ! &quot; $ % &amp; ( ) * , . / : ; ? @ [ \ ] ^ { | } ~ + &lt; = &gt;</Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open">MAP LINESET MARKERSET POINTS SHADESET STYLE CLASS FEATURE JOIN LABEL LAYER LEGEND PROJECTION GRID QUERY OUTPUTFORMAT QUERYMAP REFERENCE SCALEBAR WEB METADATA</Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close">END</Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">FONTSET GRID OUTPUTFORMAT SYMBOLSET</Keywords>
            <Keywords name="Keywords2">ANGLE ANTIALIAS BACKGROUNDCOLOR BACKGROUNDSHADOWCOLOR BACKGROUNDSHADOWSIZE BUFFER CHARACTER CLASSITEM COLOR CONNECTION CONNECTIONTYPE CONFIG DATAPATTERN DATA DESCRIPTION DEBUG DRIVER DUMP EMPTY ERROR EXPRESSION EXTENT EXTENSION FILLED FONT FOOTER FORCE FROM FILTER FILTERITEM FORMATOPTION GROUP HEADER IMAGE IMAGECOLOR IMAGEPATH IMAGEURL INTERLACE INTERVALS IMAGETYPE IMAGEMODE INCLUDE KEYIMAGE KEYSIZE KEYSPACING LABELANGLEITEM LABELCACHE LABELITEM LABELMAXSCALE LABELMINSCALE LABELSIZEITEM LAYER_ENCODING LOG LABELREQUIRES LABELFORMAT MAXFEATURES MAXSCALE MAXSCALEDENOM MAXSIZE MAXTEMPLATE MINDISTANCE MINFEATURESIZE MINSCALE MINSIZE MINTEMPLATE MINARCS MAXARCS MININTERVAL MAXINTERVAL MINSUBDIVIDE MINWIDTH MAXSUBDIVIDE MAXWIDTH MIMETYPE MARKER MARKERSIZE MINBOXSIZE MAXBOXSIZE NAME OFFSET OUTLINECOLOR OFFSITE OVERLAYOUTLINECOLOR OVERLAYCOLOR OVERLAYSYMBOL OVERLAYSIZE OVERLAYMINSIZE OVERLAYMAXSIZE OVERLAYBACKGROUNDCOLOR PARTIALS POSITION POSTLABELCACHE PROCESSING QUERYITEM REQUIRES RESULT_FIELDS RESULT_HEADERS SCALE SHAPEPATH SIZE SPACING STATUS STYLED SYMBOL SYMBOLSCALE SYMBOLSCALEDENOM STYLEITEM SIZEUNITS SHADOWCOLOR SHADOWSIZE TABLE TEMPLATE TEXT TILEINDEX TILEITEM TO TOLERANCE TOLERANCEUNITS TRANSFORM TRANSPARENT TRANSPARENCY TYPE TEMPLATEPATTERN UNITS WRAP WIDTH</Keywords>
            <Keywords name="Keywords3">annotation auto bitmap cc cl cr dd default ddmm ddmmss embed ellipse embed epsg false feet giant gif gtiff hilite inches jpeg kilometers large lc line ll local lr medium meters miles multiple normal off on ogr pixmap pixels point polygon polyline png queryonly raster sde selected single small swf tiny true truetype uc ul ur vector wbmp wms wms_srs wms_name wms_server_version wms_format wms_connectiontimeout wms_latlonboundingbox wms_formatlist wms_style wms_time wms_force_separate_request</Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters">00&quot; 01 02&quot; 03&apos; 04 05&apos; 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="FF0000" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="12" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="808000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="800040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

1 个答案:

答案 0 :(得分:0)

您需要将代码折叠LAYER移动到折叠代码2样式。代码2样式中的折叠工作differently来自第一个使用正向搜索并且可以粘合到任何其他关键字的样式。代码风格两个荣誉白色空间和其他特殊字符。

code style screenshot

Code folding screenshot