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

Comments before the first line of code are removed [CORE6466] #6698

Closed
firebird-automations opened this issue Jan 12, 2021 · 11 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Sergio Toniutti (sergiot_ericed.it)

Is duplicated by CORE6467

Seems Firebird removes comments before the first line of code when i execute create or alter procedure.
If i have:
SET TERM ^^ ;
CREATE OR ALTER PROCEDURE P_INC (
INT_A Integer)
returns (
INT_B Integer)
AS
/*
this is a bug!
*/
declare variable int_c integer=2;
begin
/* code */
int_b=int_a+int_c+2;
suspend;
end ^^
SET TERM ; ^^

the result is:

SET TERM ^^ ;
CREATE OR ALTER PROCEDURE P_INC (
INT_A Integer)
returns (
INT_B Integer)
AS
declare variable int_c integer=2;
begin
/* code */
int_b=int_a+int_c+2;
suspend;
end ^^
SET TERM ; ^^

Thanks,
Sergio

Commits: 32e7474 a8e6309 820fd7e 7811862 dfcb0ba c26edb9

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

As another datapoint: when there is no declare statement, the comment is preserved.

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

Link: This issue is duplicated by CORE6467 [ CORE6467 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

This bug is not reproducible in master but looks like only due to internal and unrelated parser changes to support sub routines.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Comments at the end are also suppressed.

My understand is that as comments are not tokens, they may be tied to token before or after it.

We must tie them to both and when creating the source string the code gets the initial token (with their leading) comments and the final token (with their trailing comments)

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Version: 3.0.7 [ 10940 ]

Version: 4.0 Beta 2 [ 10888 ]

summary: Seems Firebird removes comments before the first line of code => Comments before the first line of code are removed

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.8 [ 10960 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Fix Version: 4.0.0 [ 10931 ]

Fix Version: 3.0.8 [ 10960 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Fix Version: 3.0.8 [ 10960 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment