baanc.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. <!-- ======================================================= [ BaanC ] -->
  12. <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  13. | Based on:
  14. | https://notepad-plus-plus.org/community/topic/14494/functionlist-classrange-question
  15. |
  16. | Note(s):
  17. | 1. Boost::Regex 1.58-1.59 do not correctly handle quantifiers on subroutine calls
  18. | therefore the additional non-capturing group i.e. "(?:(?&amp;COMMENT))?" instead
  19. | of simply "(?&amp;COMMENT)?"
  20. \-->
  21. <parser
  22. displayName="BaanC Sections"
  23. id ="baanc_section"
  24. >
  25. <classRange
  26. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  27. (?im) # case-insensitive, ^ and $ match at line breaks
  28. (?(DEFINE) # definition of sub-routines
  29. (?'SECTION'
  30. ^\h* # optional leading whitespace at start-of-line
  31. (?: # known section names
  32. (?:after|before)\.(?:report\.\d+|\w+(?:\.\w+)*\.\d+)
  33. | (?:field|zoom\.from)\.(?:all|other|\w+(?:\.\w+)*)
  34. | (?:footer|group|header)\.\d+
  35. | choice\.\w+(?:\.\w+)*
  36. | detail\.\d+
  37. | form\.(?:all|other|\d+)
  38. | functions
  39. | main\.table\.io
  40. ): # end-of-section-header indicator
  41. )
  42. (?'SECTION_EMPTY'
  43. ^\h* # optional leading whitespace at start-of-line
  44. (?: # known `empty` section names
  45. after\.(?:form\.read|program|receive\.data|update\.db\.commit)
  46. | before\.(?:(?:display|new)\.object|program)
  47. | declaration
  48. | on\.(?:display\.total\.line|error)
  49. ): # end-of-section-header indicator
  50. )
  51. )
  52. (?&amp;SECTION) # section header
  53. (?s:.*?) # whatever,
  54. (?= # ...up till
  55. \s*
  56. (?:
  57. (?&amp;SECTION) # ...next section header,
  58. | (?&amp;SECTION_EMPTY) # ...next `empty` section header
  59. | \Z # ...or end-of-text
  60. )
  61. )
  62. "
  63. >
  64. <className>
  65. <nameExpr expr="^\h*\K\w+(?:\.\w+)*:" />
  66. </className>
  67. <function
  68. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  69. (?im) # case-insensitive, ^ and $ match at line breaks
  70. (?(DEFINE) # definition of sub-routines
  71. (?'COMMENT'
  72. \s*\x7C[^\r\n]* # trailing comment
  73. (?: # optional subsequent comment
  74. (?:\r?\n|\n?\r) # - mandatory line-break
  75. \s*\x7C[^\r\n]* # - `trailing` comment
  76. )*
  77. )
  78. )
  79. ^\h* # optional leading whitespace at start-of-line
  80. (?:
  81. \K # discard text matched so far
  82. (?: # known sub-section names
  83. after\.(?:choice|d(?:elete|isplay)|f(?:ield|orm)|group|input|layout|re(?:ad|write)|skip\.(?:delete|(?:re)?write)|write|zoom)
  84. | before\.(?:ch(?:ecks|oice)|d(?:elete|isplay)|f(?:ield|orm)|group|input|layout|print|re(?:ad|write)|write|zoom)
  85. | check\.input
  86. | domain\.error
  87. | init\.(?:f(?:ield|orm)|group)
  88. | on\.(?:choice|e(?:ntry|xit)|input)
  89. | read\.view
  90. | ref\.(?:display|input)
  91. | selection\.filter
  92. | when\.field\.changes
  93. ): # end-of-sub-section-header indicator
  94. |
  95. function # keyword, start-of-function-header indicator
  96. (?:(?&amp;COMMENT))? # optional `embedded` comment
  97. (?: # optional storage-class specifier
  98. \s+extern
  99. (?:(?&amp;COMMENT))? # ...with optional `embedded` comment
  100. )?
  101. (?: # optional function type specifier
  102. \s+(?:
  103. boolean
  104. | double
  105. | long
  106. | string
  107. | void
  108. | domain
  109. (?:(?&amp;COMMENT))? # ...with optional `embedded` comment
  110. \s+\w+(?:\.\w+)*
  111. )
  112. (?:(?&amp;COMMENT))? # ...with optional `embedded` comment
  113. )?
  114. \s+
  115. \K # discard text matched so far
  116. \w+(?:\.\w+)* # function identifier
  117. (?:(?&amp;COMMENT)(?:\r?\n|\n?\r))? # optional `embedded` comment
  118. \s*\( # start-of-parameter-list indicator
  119. )
  120. "
  121. >
  122. <functionName>
  123. <funcNameExpr expr="\w+(?:\.\w+)*(?:\h*:)?" />
  124. </functionName>
  125. </function>
  126. </classRange>
  127. <function
  128. mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
  129. (?im) # case-insensitive, ^ and $ match at line breaks
  130. (?(DEFINE) # definition of sub-routines
  131. (?'COMMENT'
  132. \s*\x7C[^\r\n]* # trailing comment
  133. (?: # optional subsequent comment
  134. (?:\r?\n|\n?\r) # - mandatory line-break
  135. \s*\x7C[^\r\n]* # - `trailing` comment
  136. )*
  137. )
  138. )
  139. ^\h* # optional leading whitespace at start-of-line
  140. (?:
  141. \K # discard text matched so far
  142. (?: # known `empty` section names
  143. after\.(?:form\.read|program|receive\.data|update\.db\.commit)
  144. | before\.(?:display\.object|new\.object|program)
  145. | declaration
  146. | on\.(?:display\.total\.line|error)
  147. ): # end-of-section-header indicator
  148. |
  149. function # keyword, start-of-function-header indicator
  150. (?:(?&amp;COMMENT))? # optional `embedded` comment
  151. (?: # optional storage-class specifier
  152. \s+extern
  153. (?:(?&amp;COMMENT))? # ...with optional `embedded` comment
  154. )?
  155. (?: # optional function type specifier
  156. \s+(?:
  157. boolean
  158. | double
  159. | long
  160. | string
  161. | void
  162. | domain
  163. (?:(?&amp;COMMENT))? # ...with optional `embedded` comment
  164. \s+\w+(?:\.\w+)*
  165. )
  166. (?:(?&amp;COMMENT))? # ...with optional `embedded` comment
  167. )?
  168. \s+
  169. \K # discard text matched so far
  170. \w+(?:\.\w+)* # function identifier
  171. (?:(?&amp;COMMENT)(?:\r?\n|\n?\r))? # optional `embedded` comment
  172. \s*\( # start-of-parameter-list indicator
  173. )
  174. "
  175. >
  176. <functionName>
  177. <nameExpr expr="\w+(?:\.\w+)*(?:\h*:)?" />
  178. </functionName>
  179. </function>
  180. </parser>
  181. </functionList>
  182. </NotepadPlus>