python.xml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. <!-- ====================================================== [ Python ] -->
  12. <parser
  13. displayName="Python"
  14. id ="python_syntax"
  15. commentExpr="(?s:'''.*?''')|(?m-s:#.*?$)"
  16. >
  17. <classRange
  18. mainExpr ="^class\x20\K.*?(?=\n\S|\Z)"
  19. >
  20. <className>
  21. <nameExpr expr="\w+(?=\s*[\(|:])" />
  22. </className>
  23. <function
  24. mainExpr="\sdef\x20\K.+?(?=:)"
  25. >
  26. <functionName>
  27. <funcNameExpr expr=".*" />
  28. </functionName>
  29. </function>
  30. </classRange>
  31. <function
  32. mainExpr="^def\x20\K.+?(?=:)"
  33. >
  34. <functionName>
  35. <nameExpr expr=".*" />
  36. </functionName>
  37. </function>
  38. </parser>
  39. </functionList>
  40. </NotepadPlus>