java.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- ==========================================================================\
  3. |
  4. | To learn how to make your own language parser, please check the following
  5. | link:
  6. | https://npp-user-manual.org/docs/function-list/
  7. |
  8. \=========================================================================== -->
  9. <NotepadPlus>
  10. <functionList>
  11. <!-- ======================================================== [ Java ] -->
  12. <!--
  13. | Based on:
  14. | https://notepad-plus-plus.org/community/topic/12691/function-list-with-java-problems
  15. \-->
  16. <parser
  17. displayName="Java"
  18. id ="java_syntax"
  19. >
  20. <classRange
  21. mainExpr ="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
  22. (?m)^[\t\x20]* # leading whitespace
  23. (?:
  24. (?-i:
  25. abstract
  26. | final
  27. | native
  28. | p(?:rivate|rotected|ublic)
  29. | s(?:tatic|trictfp|ynchronized)
  30. | transient
  31. | volatile
  32. | @[A-Za-z_]\w* # qualified identifier
  33. (?: # consecutive names...
  34. \. # ...are dot separated
  35. [A-Za-z_]\w*
  36. )*
  37. )
  38. \s+
  39. )*
  40. (?-i:class|enum|@?interface)
  41. \s+
  42. (?'DECLARATOR'
  43. (?'VALID_ID' # valid identifier, use as subroutine
  44. \b(?!(?-i:
  45. a(?:bstract|ssert)
  46. | b(?:oolean|reak|yte)
  47. | c(?:ase|atch|har|lass|on(?:st|tinue))
  48. | d(?:efault|o(?:uble)?)
  49. | e(?:lse|num|xtends)
  50. | f(?:inal(?:ly)?|loat|or)
  51. | goto
  52. | i(?:f|mp(?:lements|ort)|nstanceof|nt(?:erface)?)
  53. | long
  54. | n(?:ative|ew)
  55. | p(?:ackage|rivate|rotected|ublic)
  56. | return
  57. | s(?:hort|tatic|trictfp|uper|witch|ynchronized)
  58. | th(?:is|rows?)|tr(?:ansient|y)
  59. | vo(?:id|latile)
  60. | while
  61. )\b) # keywords, not to be used as identifier
  62. [A-Za-z_]\w* # valid character combination for identifiers
  63. )
  64. (?:
  65. \s*\x3C # start-of-template indicator...
  66. (?'GENERIC' # ...match first generic, use as subroutine
  67. \s*
  68. (?:
  69. (?&amp;DECLARATOR) # use named generic
  70. | \? # or unknown
  71. )
  72. (?: # optional type extension
  73. \s+(?-i:extends|super)
  74. \s+(?&amp;DECLARATOR)
  75. (?: # multiple bounds...
  76. \s+\x26 # ...are ampersand separated
  77. \s+(?&amp;DECLARATOR)
  78. )*
  79. )?
  80. (?: # match consecutive generics objects...
  81. \s*, # ...are comma separated
  82. (?&amp;GENERIC)
  83. )?
  84. )
  85. \s*\x3E # end-of-template indicator
  86. )?
  87. (?: # package and|or nested classes...
  88. \. # ...are dot separated
  89. (?&amp;DECLARATOR)
  90. )?
  91. )
  92. (?: # optional object extension
  93. \s+(?-i:extends)
  94. \s+(?&amp;DECLARATOR)
  95. (?: # consecutive objects...
  96. \s*, # ...are comma separated
  97. \s*(?&amp;DECLARATOR)
  98. )*
  99. )?
  100. (?: # optional object implementation
  101. \s+(?-i:implements)
  102. \s+(?&amp;DECLARATOR)
  103. (?: # consecutive objects...
  104. \s*, # ...are comma separated
  105. \s*(?&amp;DECLARATOR)
  106. )*
  107. )?
  108. \s*\{ # whatever, up till start-of-body indicator
  109. "
  110. openSymbole ="\{"
  111. closeSymbole="\}"
  112. >
  113. <className>
  114. <nameExpr expr="(?-i:class|enum|@?interface)\s+\K\w+(?:\s*\x3C.*?\x3E)?" />
  115. </className>
  116. <function
  117. mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
  118. ^[\t\x20]* # leading whitespace
  119. (?:
  120. (?-i:
  121. abstract
  122. | final
  123. | native
  124. | p(?:rivate|rotected|ublic)
  125. | s(?:tatic|trictfp|ynchronized)
  126. | transient
  127. | volatile
  128. | @[A-Za-z_]\w* # qualified identifier
  129. (?: # consecutive names...
  130. \. # ...are dot separated
  131. [A-Za-z_]\w*
  132. )*
  133. )
  134. \s+
  135. )*
  136. (?:
  137. \s*\x3C # start-of-template indicator
  138. (?&amp;GENERIC)
  139. \s*\x3E # end-of-template indicator
  140. )?
  141. \s*
  142. (?'DECLARATOR'
  143. [A-Za-z_]\w* # (parent) type name
  144. (?: # consecutive sibling type names...
  145. \. # ...are dot separated
  146. [A-Za-z_]\w*
  147. )*
  148. (?:
  149. \s*\x3C # start-of-template indicator
  150. (?'GENERIC' # match first generic, use as subroutine
  151. \s*
  152. (?:
  153. (?&amp;DECLARATOR) # use named generic
  154. | \? # or unknown
  155. )
  156. (?: # optional type extension
  157. \s+(?-i:extends|super)
  158. \s+(?&amp;DECLARATOR)
  159. (?: # multiple bounds...
  160. \s+\x26 # ...are ampersand separated
  161. \s+(?&amp;DECLARATOR)
  162. )*
  163. )?
  164. (?: # consecutive generics objects...
  165. \s*, # ...are comma separated
  166. (?&amp;GENERIC)
  167. )?
  168. )
  169. \s*\x3E # end-of-template indicator
  170. )?
  171. (?: # package and|or nested classes...
  172. \. # ...are dot separated
  173. (?&amp;DECLARATOR)
  174. )?
  175. (?: # optional compound type...
  176. \s*\[ # ...start-of-compound indicator
  177. \s*\] # ...end-of-compound indicator
  178. )*
  179. )
  180. \s+
  181. (?'VALID_ID' # valid identifier, use as subroutine
  182. \b(?!(?-i:
  183. a(?:bstract|ssert)
  184. | b(?:oolean|reak|yte)
  185. | c(?:ase|atch|har|lass|on(?:st|tinue))
  186. | d(?:efault|o(?:uble)?)
  187. | e(?:lse|num|xtends)
  188. | f(?:inal(?:ly)?|loat|or)
  189. | goto
  190. | i(?:f|mp(?:lements|ort)|nstanceof|nt(?:erface)?)
  191. | long
  192. | n(?:ative|ew)
  193. | p(?:ackage|rivate|rotected|ublic)
  194. | return
  195. | s(?:hort|tatic|trictfp|uper|witch|ynchronized)
  196. | th(?:is|rows?)|tr(?:ansient|y)
  197. | vo(?:id|latile)
  198. | while
  199. )\b) # keywords, not to be used as identifier
  200. [A-Za-z_]\w* # valid character combination for identifiers
  201. )
  202. \s*\( # start-of-parameters indicator
  203. (?'PARAMETER' # match first parameter, use as subroutine
  204. \s*(?-i:final\s+)?
  205. (?&amp;DECLARATOR)
  206. \s+(?&amp;VALID_ID) # parameter name
  207. (?: # consecutive parameters...
  208. \s*, # ...are comma separated
  209. (?&amp;PARAMETER)
  210. )?
  211. )?
  212. \) # end-of-parameters indicator
  213. (?: # optional exceptions
  214. \s*(?-i:throws)
  215. \s+(?&amp;VALID_ID) # first exception name
  216. (?: # consecutive exception names...
  217. \s*, # ...are comma separated
  218. \s*(?&amp;VALID_ID)
  219. )*
  220. )?
  221. [^{;]*\{ # start-of-function-body indicator
  222. "
  223. >
  224. <functionName>
  225. <funcNameExpr expr="\w+(?=\s*\()" />
  226. </functionName>
  227. </function>
  228. </classRange>
  229. </parser>
  230. </functionList>
  231. </NotepadPlus>