haskell.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. <!--
  12. | Based on:
  13. | https://notepad-plus-plus.org/community/topic/12972/trouble-with-defining-a-function-list-entry/7
  14. |
  15. | By convention, the style of comment is indicated by the file extension,
  16. | with ".hs" indicating a "usual" Haskell file
  17. | and ".lhs" indicating a literate Haskell file.
  18. \-->
  19. <parser
  20. displayName="Haskell"
  21. id ="haskell_function"
  22. commentExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  23. (?s: # Multi Line Comment (nesting allowed)
  24. \{- # - start-of-comment indicator
  25. (?> # - followed by zero or more characters...
  26. [^{-] # ...not part of the start indicator,
  27. | \{(?!-) # ...not being a start-of-comment indicator,
  28. | -(?!\}) # ...not being an end-of-comment indicator and
  29. | (?R) # ...balancing through recursion (nesting)
  30. )*
  31. -\} # - end-of-comment indicator
  32. )
  33. | (?m-s:-{2}.*?$) # Single Line Comment
  34. "
  35. >
  36. <function
  37. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  38. (?m-s) # ^ and $ match at line breaks, dot does not
  39. ^ # NO leading whitespace at start-of-line
  40. [A-Za-z][\w\x27]* # valid character combination for identifiers
  41. \x20+::\x20
  42. .*?$ # whatever, until end-of-line
  43. "
  44. >
  45. <functionName>
  46. <nameExpr expr="[A-Za-z][\w\x27]*" />
  47. </functionName>
  48. </function>
  49. </parser>
  50. </functionList>
  51. </NotepadPlus>