Notepad++ Custom Language Highlighting

可紊 提交于 2019-11-29 00:31:32

问题


I have a specific language (its private, and closed source) that I'm writing code highlighting for in Notepad++. I've never done anything like this before... so, for the most part, I'm clueless.

There are a bunch of keywords, and I've figured out how to implement those, but the strings are denoted by square brackets ([ and ]) instead of normal quotes. How do I register those as strings in the XML file?

Another thing, the language relies heavily on recursion and nesting; is there some way to say "Level 1 of the square brackets is this color, level 2 is this color, etc..."?


回答1:


There's a useful help page that explains how to use the GUI to define a custom language for Notepad++. As Alex K noted in a comment above, the option for setting string delimiters appears to be in the Delimiters boxes in the Operators tab. It doesn't look like it supports different colours for different levels of nesting, though.




回答2:


Update for those who have been asking the same question:

(Temporary) Documentation for custom syntax highlighting is on: http://udl20.weebly.com/index.html

There is a link to this in Notepad++ but it doesn't stand out.




回答3:


I had log4net files that I wanted to view in Notepad++. They contained lines like:

2015-06-03 16:38:10,751 [Compname][Thread:29][FATAL]

To highlight [FATAL] just the keyword list wasn't enough. I added this: On tabpage "Folder & Default" > Folding in code style 1: >

Open: [ 
Close: ]

On tabpage "Keyword lists" > 1ste group > FATAL with some styling.



来源:https://stackoverflow.com/questions/5677962/notepad-custom-language-highlighting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!