Created
February 11, 2019 22:37
-
-
Save MAPJe71/30480894ebd4698d4cb236426311dc83 to your computer and use it in GitHub Desktop.
Notepad++ FunctionList parser for BaanC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<NotepadPlus> | |
<functionList> | |
<associationMap> | |
<association id= "baanc_section" langID="60" /> | |
</associationMap> | |
<parsers> | |
<!-- ======================================================= [ BaanC ] --> | |
<!-- | |
| Based on: | |
| https://github.com/notepad-plus-plus/notepad-plus-plus/pull/3670 | |
| https://notepad-plus-plus.org/community/topic/14494/functionlist-classrange-question | |
| | |
| Note(s): | |
| 1) Boost::Regex 1.58-1.59 do not correctly handle quantifiers on subroutine calls | |
| therefore the additional non-capturing group e.g. "(?:(?&COMMENT))?" instead | |
| of simply "(?&COMMENT)?" | |
\--> | |
<parser | |
displayName="BaanC" | |
id ="baanc_section" | |
> | |
<classRange | |
mainExpr ="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) | |
(?im) # case-insensitive, ^ and $ match at line-breaks | |
(?(DEFINE) # definition of sub-routine(s) | |
(?'SECTION' # Section sub-routine | |
^\h* # - optional leading white-space at start-of-line | |
(?: # - known section names | |
(?:after|before)\.(?:report\.\d+|\w+(?:\.\w+)*\.\d+) | |
| (?:field|zoom\.from)\.(?:all|other|\w+(?:\.\w+)*) | |
| (?:footer|group|header)\.\d+ | |
| choice\.\w+(?:\.\w+)* | |
| detail\.\d+ | |
| form\.(?:all|other|\d+) | |
| functions | |
| main\.table\.io | |
) | |
\h*: # - end-of-section-header indicator | |
) | |
(?'SECTION_EMPTY' # Empty Section sub-routine | |
^\h* # - optional leading white-space at start-of-line | |
(?: # - known `empty` section names | |
after\.(?:form\.read|program|receive\.data|update\.db\.commit) | |
| before\.(?:(?:display|new)\.object|program) | |
| declaration | |
| on\.(?:display\.total\.line|error) | |
) | |
\h*: # - end-of-section-header indicator | |
) | |
) | |
(?&SECTION) # section header | |
(?s:.*?) # whatever, | |
(?= # ...up till | |
\s* # ...optional leading white-space of | |
(?: | |
(?&SECTION) # ...next section header, | |
| (?&SECTION_EMPTY) # ...next `empty` section header | |
| \Z # ...or end-of-text | |
) | |
) | |
" | |
> | |
<className> | |
<nameExpr expr="^\h*\K\w+(?:\.\w+)*\h*:" /> | |
</className> | |
<function | |
mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) | |
(?im) # case-insensitive, ^ and $ match at line-breaks | |
(?(DEFINE) # definition of sub-routine(s) | |
(?'COMMENT' # Comment sub-routine | |
\s*\x7C[^\r\n]* # - trailing comment | |
(?: # - optional subsequent comment | |
(?:\r?\n|\n?\r) # ...mandatory line-break | |
\s*\x7C[^\r\n]* # ...`trailing` comment | |
)* | |
) | |
) | |
^\h* # optional leading white-space at start-of-line | |
(?: | |
\K # discard text matched so far | |
(?: # known sub-section names | |
after\.(?:choice|d(?:elete|isplay)|f(?:ield|orm)|group|input|layout|re(?:ad|write)|skip\.(?:delete|(?:re)?write)|write|zoom) | |
| before\.(?:ch(?:ecks|oice)|d(?:elete|isplay)|f(?:ield|orm)|group|input|layout|print|re(?:ad|write)|write|zoom) | |
| check\.input | |
| domain\.error | |
| init\.(?:f(?:ield|orm)|group) | |
| on\.(?:choice|e(?:ntry|xit)|input) | |
| read\.view | |
| ref\.(?:display|input) | |
| selection\.filter | |
| when\.field\.changes | |
) | |
\h*: # end-of-sub-section-header indicator | |
| | |
function # keyword, start-of-function-header indicator | |
(?:(?&COMMENT))? # optional `embedded` comment | |
(?: # optional storage-class specifier | |
\s+extern | |
(?:(?&COMMENT))? # ...with optional `embedded` comment | |
)? | |
(?: # optional function type specifier | |
\s+(?: | |
boolean | |
| double | |
| long | |
| string | |
| void | |
| domain | |
(?:(?&COMMENT))? # ...with optional `embedded` comment | |
\s+\w+(?:\.\w+)* | |
) | |
(?:(?&COMMENT))? # ...with optional `embedded` comment | |
)? | |
\s+ | |
\K # discard text matched so far | |
\w+(?:\.\w+)* # function identifier | |
(?:(?&COMMENT)(?:\r?\n|\n?\r))? # optional `embedded` comment | |
\s*\( # start-of-parameter-list indicator | |
) | |
" | |
> | |
<functionName> | |
<funcNameExpr expr="\w+(?:\.\w+)*(?:\h*:)?" /> | |
</functionName> | |
</function> | |
</classRange> | |
<function | |
mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) | |
(?im) # case-insensitive, ^ and $ match at line-breaks | |
(?(DEFINE) # definition of sub-routine(s) | |
(?'COMMENT' # Comment sub-routine | |
\s*\x7C[^\r\n]* # - trailing comment | |
(?: # - optional subsequent comment | |
(?:\r?\n|\n?\r) # ...mandatory line-break | |
\s*\x7C[^\r\n]* # ...`trailing` comment | |
)* | |
) | |
) | |
^\h* # optional leading white-space at start-of-line | |
(?: | |
\K # discard text matched so far | |
(?: # known `empty` section names | |
after\.(?:form\.read|program|receive\.data|update\.db\.commit) | |
| before\.(?:display\.object|new\.object|program) | |
| declaration | |
| on\.(?:display\.total\.line|error) | |
) | |
\h*: # end-of-section-header indicator | |
| | |
function # keyword, start-of-function-header indicator | |
(?:(?&COMMENT))? # optional `embedded` comment | |
(?: # optional storage-class specifier | |
\s+extern | |
(?:(?&COMMENT))? # ...with optional `embedded` comment | |
)? | |
(?: # optional function type specifier | |
\s+(?: | |
boolean | |
| double | |
| long | |
| string | |
| void | |
| domain | |
(?:(?&COMMENT))? # ...with optional `embedded` comment | |
\s+\w+(?:\.\w+)* | |
) | |
(?:(?&COMMENT))? # ...with optional `embedded` comment | |
)? | |
\s+ | |
\K # discard text matched so far | |
\w+(?:\.\w+)* # function identifier | |
(?:(?&COMMENT)(?:\r?\n|\n?\r))? # optional `embedded` comment | |
\s*\( # start-of-parameter-list indicator | |
) | |
" | |
> | |
<functionName> | |
<nameExpr expr="\w+(?:\.\w+)*(?:\h*:)?" /> | |
</functionName> | |
</function> | |
</parser> | |
<!-- ================================================================= --> | |
</parsers> | |
</functionList> | |
</NotepadPlus> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment