rust.xml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. <!-- =========================================================== [ C ] -->
  12. <parser
  13. displayName="Rust"
  14. id ="rust_function"
  15. commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
  16. (?s:\x2F\x2A.*?\x2A\x2F) # Multi Line Comment
  17. | (?m-s:\x2F{2}.*$) # Single Line Comment
  18. "
  19. >
  20. <function
  21. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  22. ^\h* # optional leading whitespace at start-of-line
  23. (?:
  24. (?-i:
  25. async
  26. | const
  27. | (?-i:extern\s+(?s:\x22(?:[^\x22\x5C]|\x5C.)*\x22))
  28. | unsafe
  29. )
  30. \s+
  31. )*
  32. (?-i:fn)\s+
  33. \K # discard text matched so far
  34. (?:[a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+) # valid character combination for identifiers
  35. (?:&lt;.*$gt;)? # optional generic params
  36. (?:\s*\([^()]*\))? # optional parameter list
  37. "
  38. >
  39. <!-- comment out the following node to display the method with its parameters -->
  40. <functionName>
  41. <nameExpr expr="\w+" />
  42. </functionName>
  43. </function>
  44. </parser>
  45. </functionList>
  46. </NotepadPlus>