Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ada Function List improvements #14986

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 16 additions & 12 deletions PowerEditor/installer/functionList/ada.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<NotepadPlus>
<functionList>
<!--
| Complies to ADA 2022
| http://www.ada-auth.org/standards/overview22.html
| Based on:
| http://stackoverflow.com/questions/32126855/notepad-and-ada
\-->
Expand All @@ -23,10 +25,10 @@
mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
^\h* # optional leading whitespace at start-of-line
(?:
(?-i:function)
(?i:function)
\s+
(?'VALID_ID' # valid identifier, use as subroutine
\b(?!(?-i: # keywords (case-sensitive), not to be used as identifier
\b(?!(?i: # keywords (case-insensitive), not to be used as identifier
a(?:b(?:ort|s(?:tract)?)|cce(?:pt|ss)|l(?:iased|l)|nd|rray|t)
| b(?:egin|ody)
| c(?:ase|onstant)
Expand All @@ -39,48 +41,50 @@
| mod
| n(?:ew|ot|ull)
| o(?:[fr]|thers|ut|verriding)
| p(?:ackage|r(?:agma|ivate|o(?:cedure|tected)))
| p(?:a(?:ckage|rallel)|r(?:agma|ivate|o(?:cedure|tected)))
| r(?:a(?:is|ng)e|e(?:cord|m|names|queue|turn|verse))
| s(?:e(?:lect|parate)|ome|ubtype|ynchronized)
| t(?:a(?:gged|sk)|erminate|hen|ype)
| u(?:ntil|se)
| w(?:h(?:en|ile)|ith)
| xor
)\b)
[A-Za-z_]\w* # valid character combination for identifiers
[[:alpha:]](?:[\w.]*[[:alnum:]])? # valid character combination for identifiers
)
(?'PARAMETERS'
\s*
\( # start-of-parameters indicator
[^()]* # parameters
\) # end-of-parameters indicator
)? # parentheses and parameters optional
\s*return # function returns a value with...
\s*
(?:return # function returns a value with...
\s+(?&amp;VALID_ID) # ...type-name
)?
|
(?-i:procedure)
(?i:procedure)
\s+(?&amp;VALID_ID)
(?:(?&amp;PARAMETERS))? # Boost::Regex 1.58-1.59 do not correctly handle quantifiers on subroutine calls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the comment no longer apply to the Boost::Regex version that is currently used?
When it still applies, undo the change and update the version of Boost::Regex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a mention of it being fixed in the changelog

But from the tests I've done, it no longer applies, therefore I removed it and simplified the expression.

(?&amp;PARAMETERS)?
)
\s*(?-i:\bis\b) # end-of-definition indicator
\s*(?i:\bis\b|;) # end-of-definition indicator
"
>
<functionName>
<nameExpr expr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
(?:function|procedure)\s+
\K # discard text matched so far
[A-Za-z_]\w*
[[:alpha:]](?:[\w.]*[[:alnum:]])?
(?:\s*\([^()]*\))? # parentheses and parameters optional
(?=
\s*
\b(?:return|is)
(?:\breturn|\bis|;)
)
"
/>
<!-- comment out the following node to display the method with its parameters -->
<!-- <nameExpr expr="[A-Za-z_]\w*" /> -->
<!-- <nameExpr expr="[[:alpha:]](?:[\w.]*[[:alnum:]])?" /> -->
</functionName>
</function>
</parser>
</functionList>
</NotepadPlus>
</NotepadPlus>