bash.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. <!-- ======================================================== [ Bash ] -->
  12. <!-- BASH - Bourne-Again Shell -->
  13. <parser
  14. displayName="Bash"
  15. id ="bash_function"
  16. commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
  17. (?-s:(?:^\x23[^!]|^\h*\x23|\h+\x23).*$) # Single Line Comment
  18. | (?s:\x22(?:[^\x22\x5C]|\x5C.)*\x22) # String Literal - Double Quoted
  19. | (?s:\x27[^\x27]*\x27) # String Literal - Single Quoted
  20. | (?s: # Here Document (Type 1) and Here String
  21. \x3C{2,3}\h*(?'HD1ID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\b)[^\r\n]*\R
  22. (?s:.*?)
  23. \R\k'HD1ID' # close with exactly the same identifier, in the first column
  24. )
  25. | (?s: # Here Document (Type 2)
  26. \x3C{2}-\h*(?'HD2ID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\b)[^\r\n]*\R
  27. (?s:.*?)
  28. \R\h*\k'HD2ID' # close with exactly the same identifier
  29. )
  30. "
  31. >
  32. <function
  33. mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
  34. (?m)^\h* # optional leading whitespace
  35. (?:
  36. (?-i:function\s+)
  37. (?'VALID_ID' # valid identifier, use as subroutine
  38. \b(?!(?-i:
  39. do(?:ne)?
  40. | el(?:if|se)|esac
  41. | f(?:i|or|unction)
  42. | i[fn]
  43. | select
  44. | t(?:hen|ime)
  45. | until
  46. | while
  47. )\b) # keywords, not to be used as identifier
  48. [A-Za-z_\x7F-\xFF][\w\x7F-\xFF]* # valid character combination for identifiers
  49. )
  50. (?:\s*\([^)]*?\))? # parentheses and parameters optional
  51. |
  52. (?&amp;VALID_ID)
  53. \s*\([^)]*?\) # parentheses required, parameters optional
  54. )
  55. [^{;]*?\{ # no semi-colon until start of body
  56. "
  57. >
  58. <functionName>
  59. <nameExpr expr="\b(?!function\b)\w+(?:\s*\([^)]*\))?" />
  60. <!-- comment out the following node to display the function with its parameters -->
  61. <nameExpr expr="\w+(?=\b)" />
  62. </functionName>
  63. </function>
  64. </parser>
  65. </functionList>
  66. </NotepadPlus>