ada.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. | http://stackoverflow.com/questions/32126855/notepad-and-ada
  14. \-->
  15. <parser
  16. displayName="ADA"
  17. id ="ada_syntax"
  18. commentExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  19. (?m-s:-{2}.*?$) # Single Line Comment
  20. "
  21. >
  22. <function
  23. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  24. ^\h* # optional leading whitespace at start-of-line
  25. (?:
  26. (?-i:function)
  27. \s+
  28. (?'VALID_ID' # valid identifier, use as subroutine
  29. \b(?!(?-i: # keywords (case-sensitive), not to be used as identifier
  30. a(?:b(?:ort|s(?:tract)?)|cce(?:pt|ss)|l(?:iased|l)|nd|rray|t)
  31. | b(?:egin|ody)
  32. | c(?:ase|onstant)
  33. | d(?:eclare|el(?:ay|ta)|igits|o)
  34. | e(?:ls(?:e|if)|n(?:d|try)|x(?:ception|it))
  35. | f(?:or|unction)
  36. | g(?:eneric|oto)
  37. | i(?:[fs]|n(?:terface)?)
  38. | l(?:imited|oop)
  39. | mod
  40. | n(?:ew|ot|ull)
  41. | o(?:[fr]|thers|ut|verriding)
  42. | p(?:ackage|r(?:agma|ivate|o(?:cedure|tected)))
  43. | r(?:a(?:is|ng)e|e(?:cord|m|names|queue|turn|verse))
  44. | s(?:e(?:lect|parate)|ome|ubtype|ynchronized)
  45. | t(?:a(?:gged|sk)|erminate|hen|ype)
  46. | u(?:ntil|se)
  47. | w(?:h(?:en|ile)|ith)
  48. | xor
  49. )\b)
  50. [A-Za-z_]\w* # valid character combination for identifiers
  51. )
  52. (?'PARAMETERS'
  53. \s*
  54. \( # start-of-parameters indicator
  55. [^()]* # parameters
  56. \) # end-of-parameters indicator
  57. )? # parentheses and parameters optional
  58. \s*return # function returns a value with...
  59. \s+(?&amp;VALID_ID) # ...type-name
  60. |
  61. (?-i:procedure)
  62. \s+(?&amp;VALID_ID)
  63. (?:(?&amp;PARAMETERS))? # Boost::Regex 1.58-1.59 do not correctly handle quantifiers on subroutine calls
  64. )
  65. \s*(?-i:\bis\b) # end-of-definition indicator
  66. "
  67. >
  68. <functionName>
  69. <nameExpr expr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  70. (?:function|procedure)\s+
  71. \K # discard text matched so far
  72. [A-Za-z_]\w*
  73. (?:\s*\([^()]*\))? # parentheses and parameters optional
  74. (?=
  75. \s*
  76. \b(?:return|is)
  77. )
  78. "
  79. />
  80. <!-- comment out the following node to display the method with its parameters -->
  81. <!-- <nameExpr expr="[A-Za-z_]\w*" /> -->
  82. </functionName>
  83. </function>
  84. </parser>
  85. </functionList>
  86. </NotepadPlus>