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

Add indent and blank line rules for subprogram instantiation declarations #1365

Open
JHertz5 opened this issue Dec 21, 2024 · 3 comments · May be fixed by #1379
Open

Add indent and blank line rules for subprogram instantiation declarations #1365

JHertz5 opened this issue Dec 21, 2024 · 3 comments · May be fixed by #1379
Assignees

Comments

@JHertz5
Copy link
Contributor

JHertz5 commented Dec 21, 2024

Related to #1318.
Implement indent and blank line rules for subprogram instantiation declarations.
For example, rules to fix this

  constant c_test1 : integer;
function my_func is new my_generic_func

    generic map (
      test => 2
    );
  constant c_test2 : integer;
      procedure my_proc is new my_generic_proc

    generic map (
      test => 2
    );

to this

  constant c_test1 : integer;

  function my_func is new my_generic_func
    generic map (
      test => 2
    );

  constant c_test2 : integer;

  procedure my_proc is new my_generic_proc
    generic map (
      test => 2
    );
@JHertz5
Copy link
Contributor Author

JHertz5 commented Dec 28, 2024

Because the function or procedure keyword at the start of the subprogram instantiation is a regular subprogram_kind token, it is non-trivial to implement a previous_line rule (equivalent to package_instantiation_200). I'm going to leave this rule out of the PR. It can be added in the future if requested by a user.

@JHertz5
Copy link
Contributor Author

JHertz5 commented Dec 29, 2024

I've raised PR #1379 to resolve this issue.

@JHertz5
Copy link
Contributor Author

JHertz5 commented Dec 29, 2024

Hi @jeremiah-c-leary

I'm having a bit of trouble with implementing the indent rules due to the first token on the line being a subprogram_kind token (which is not exclusive to subprogram instantiation declarations) rather than a subprogram_instantiation_declaration token. This would be a lot easier to implement if the token was changed to be a subprogram_instantiation_declaration token. However, the token being subprogram_kind matches the LRM. The only alternative that I can see is to make a modifed indent rule that checks the second token in the line rather the first. Do you have any opinions on this or suggestions for alternative solutions?

Thanks,
Jukka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
1 participant