nppexec.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. <!-- ===================================================== [ NppExec ] -->
  12. <parser
  13. displayName="NppExec"
  14. id ="nppexec_syntax"
  15. >
  16. <!-- Define NppExec script as the range started by a pair of colons
  17. and ending right before the next pair of colons or the file's
  18. end, respectively
  19. -->
  20. <classRange
  21. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  22. (?ims) # ignore case, ^ and $ match start/end of line, dot matches newline
  23. ^\h*
  24. ::
  25. .*?
  26. (?=::|\Z)
  27. "
  28. >
  29. <className>
  30. <!-- The script's name is shown without its preceding pair
  31. of colons
  32. -->
  33. <nameExpr expr="(?im-s)^\h*::\K(?:(.+?)(?=\h*\/{2}|$))" />
  34. </className>
  35. <!-- Define jump labels as functions. Names are starting with one
  36. or two colons (thus the script's name itself is shown as a
  37. function) and terminated by a line comment, the line's end
  38. or the file's end
  39. -->
  40. <function
  41. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  42. (?im-s) # ignore case, ^ and $ match start/end of line, dot doesn't match newline
  43. ^\h*
  44. :{1,2}.+?
  45. \h*(?=\/{2}|$|\Z)
  46. "
  47. >
  48. <functionName>
  49. <!-- The script name is shown including its preceding pair
  50. of colons, jump labels are shown without the preceding
  51. single colon
  52. -->
  53. <funcNameExpr expr="(?im-s)\h*(?(?=::)(.+)|(?::\K(.+)))" />
  54. </functionName>
  55. </function>
  56. </classRange>
  57. </parser>
  58. </functionList>
  59. </NotepadPlus>