Regular expression of Clojure's Code Tree, It can display all defined functions and variables.
(?x)
(^(\(\s*(def[^\{\}\[\]\(\)\^\.\s:#@/\\']*))\s+(\^.*)*\s*(\^\{[^{}]+\})?\s*[^\{\}\[\]\(\)\^\.\s:#@/\\']+([\(\)\[\]\s \t]$))
|(^(\(\s*(def[^\{\}\[\]\(\)\^\.\s:#@/\\']*))\s+(\^.*)*\s*(\^\{[^{}]+\})?\s*([-[:alnum:]*+!_:\/.?]+))
|(\(\s*intern\s+(\^.*)*([-[:alnum:]*+!_:\/.?]+))
This regular expression is valid when applied in the function list of notepad++.
display effect:
(def x1
(def x2
(defn f1
(defn- f2
(defmacro m1
(defhtml html01
To use it, 2 ways
make Clojure tree-helper, see the API wiki how to write it. I will not make it, you can.
add rule to the lexer. Regex is complex so it may slow down (tree helper can be slow too). See the wiki how to edit CudaText lexers. Edit the lexer, add the rule. (It must be "range begin" rule without pair "range end"). And test.
thanks!
The results displayed by the new regular expression are of more reference value. Although the speed is slower, the programmer is not a typist. It should be 1-2 seconds slower when loading the code tree, which should not affect it, and it should only be viewed when necessary.
DisplayName = 'Id'
StyleName = 'Id'
TokenType = 2
Expression = '(?r)(\s*\w*\s*[\w-/:\@\#\&=<>`~\{\}\[\]\?\!\.\*\+\$\^\|]*)*'
ColumnFrom = 0
ColumnTo = 0
end
Clojure.lcf file:
new:

old:

"new" is look of new lexer? it's bad look. many highlightings are gone: :name, .name, many symbols []#-> , or in bold etc.
New improvements, retaining the original version of the highlight, only made the following improvements:
Because most of the top-level code blocks of code files are usually def types, it is more valuable to display the defined symbol names at the same time for def type statements. Similar processing also has ns.
The overall display of class-name/static-method-name is reasonable, only displaying the class name is semantically incomplete. Similar processing also has .dynamic-method-name.
DisplayName = 'Id'
StyleName = 'Id'
TokenType = 2
Expression = '(((?r)((def\w*)|(ns))\s*[\w-/\?\!\.\*\+\$\|]*))|((?r)\w[\w-/\?\!\.\*\+\$\|]*)'
ColumnFrom = 0
ColumnTo = 0
end

Ok, it is good look now.
note about regex:
- in [] must be escaped to not make the range (it will not be range \w- but better escape)(def\w*)|(ns) - no need in brackets heredef\w* and ns must be space? then use \s+attache the .lcf file.
Sorry, my knowledge of regular expressions is "learned and used now", in order to get the desired effect.
Thank you, this project is excellent.
Can you post example file, as text?
It is the official example of the most popular Clojure web framework luminus.
https://github.com/luminus-framework/guestbook/blob/master/src/clj/guestbook/core.clj
Applied this fix. pls test.
very good, thanks!
welcome to report more lexers issues.
Most helpful comment
Applied this fix. pls test.