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

Conversation

notdodgeball
Copy link
Contributor

Fix #14908 #14687 #14498

Changes:
Ada is case insensitive
Added 'Parallel' reserved word
Identifiers may not begin or end with underscore
Support for identifiers containing digits
Support for Ada specifications file (subprogram declaration) (#14687)
Support for dot notation within types (#14908)
Support for generic instantiations (#14498) (functions with no return statement)

Copy link
Contributor

@MAPJe71 MAPJe71 left a comment

Choose a reason for hiding this comment

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

Could you add a link to the ADA version or simply/just the ADA version this complies to?

PowerEditor/installer/functionList/ada.xml Outdated Show resolved Hide resolved
PowerEditor/installer/functionList/ada.xml Outdated Show resolved Hide resolved
PowerEditor/installer/functionList/ada.xml Outdated Show resolved Hide resolved
\s+(?&VALID_ID)
(?:(?&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.

PowerEditor/installer/functionList/ada.xml Outdated Show resolved Hide resolved
PowerEditor/installer/functionList/ada.xml Outdated Show resolved Hide resolved
PowerEditor/installer/functionList/ada.xml Outdated Show resolved Hide resolved
PowerEditor/installer/functionList/ada.xml Outdated Show resolved Hide resolved
@rdipardo
Copy link
Contributor

This PR should include updated unit tests:

8. The PR for the enhancement of Function List parser should also include unit test. Please refer [here](https://npp-user-manual.org/docs/function-list/#contribute-your-new-or-enhanced-parser-rule-to-the-notepad-codebase) for more information.

@donho donho self-assigned this Apr 14, 2024
Copy link
Member

@donho donho left a comment

Choose a reason for hiding this comment

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

(Repeat @rdipardo has said)
This PR should include updated unit tests:

8. The PR for the enhancement of Function List parser should also include unit test. Please refer [here](https://npp-user-manual.org/docs/function-list/#contribute-your-new-or-enhanced-parser-rule-to-the-notepad-codebase) for more information.

@chcg
Copy link
Contributor

chcg commented Apr 14, 2024

Changes which might be tested via extended unittest file:
https://learn.adacore.com/courses/whats-new-in-ada-2022/chapters/introduction.html

@ronww
Copy link

ronww commented Apr 19, 2024

I tested this change and it appears to work for my current project.

Edit: I spoke too soon. See below

@donho
Copy link
Member

donho commented Apr 22, 2024

@ronww
Could you provide the ADA samples here, regarding the 3 bug reports you've done, which didn't work, but work now with this PR?

@ronww
Copy link

ronww commented Apr 22, 2024

I spoke too soon. Some specifications (aka "prototypes") are still not listed:
NP++FuncList

@ronww
Copy link

ronww commented Apr 22, 2024

Examples:
NP++FuncList

-- This was not listed
function Int32toInt8TwosComplement (value : Vt.Int32) return Vt.Int8 is
begin
-- body
end Int32toInt8TwosComplement;

-- This function appears in the function list:
function AproxU8 (n : Vt.U8; x : Vt.U8) return Boolean is
eq : Boolean := False;
begin
-- code
return eq;
end AproxU8;

-- But this function does not:
function Read_I32 (Register : Vt.Address_Range) return Vt.Int_32 is
Data : Vt.Int_32;
begin
-- code
return Data;
end Read_ I32;

@ronww
Copy link

ronww commented Apr 26, 2024

Just discovered that functions/procedure specifications and definitions with comments in the parameter list fail to show in the Function List

Example:
procedure Test_Get_Register(
Reg : Address_Range; -- Register to test
Page : Page_Range; -- Page of target register
ID : String; -- Test case identification
) is
begin
-- code
end Test_Get_Register;

If the comments in the parameter list are removed, then the procedure is shown.

@MAPJe71
Copy link
Contributor

MAPJe71 commented Apr 26, 2024

@donho
Copy link
Member

donho commented May 2, 2024

@ronww
I need only some ADA samples here (no comment, no explanation), regarding the current fixed, which didn't work, but work now with this PR?
Without these samples I cannot integrate this fix.

@ronww
Copy link

ronww commented May 4, 2024

All of these should work, but some still do not work

function Get_Idle
return Boolean;

function Get_Phase
-- Purpose: Returns current phase
return Integer;

function Get_State
return Vt.State;

procedure Update;

function Int32_To_Byte_Array is
new Unchecked_Conversion (Source => Vt.Int32, Target => Vt.Byte_Array);

function Int8_To_U8 is new Unchecked_Conversion
(Source => Vt.Int8, Target => Vt.U8);

function Int32toInt8TwosComplement (value : Vt.Int32) return Vt.Int8 is
begin
-- body
end Int32toInt8TwosComplement;

function AproxU8 (n : Vt.U8; x : Vt.U8) return Boolean is
eq : Boolean := False;
begin
-- code
return eq;
end AproxU8;

function Read_I32 (Register : Vt.Address_Range) return Vt.Int_32 is
Data : Vt.Int_32;
begin
-- code
return Data;
end Read_ I32;

procedure Test_Get_Register(
Reg : Address_Range; -- Register to test
Page : Page_Range; -- Page of target register
Expected : Vt.U8; -- Expected value of read
ID : String; -- Test case identification
) is
begin
-- code
end Test_Get_Register;

@donho
Copy link
Member

donho commented May 5, 2024

@ronww
Thank you!

@donho donho closed this in 8ab9b99 May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistencies in listing functions in Function list
6 participants