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

Bug: "if else if" block recognized incorrectly as INDENTATION atom #54

Open
AlbertSGS opened this issue May 2, 2023 · 0 comments · May be fixed by #55
Open

Bug: "if else if" block recognized incorrectly as INDENTATION atom #54

AlbertSGS opened this issue May 2, 2023 · 0 comments · May be fixed by #55

Comments

@AlbertSGS
Copy link

Issue Description:

Consider the following snippet of code:

if (X) {
...
} else if (Y) {
...
} else {
...
}

The tool would make a mistake and detect the 5th line (i.e. the line where the last "else" is) as an INDENTATION atom, since it does not align with the if statement it follows. However, in reality, it should consider the position of the closed square bracket in the begining of the line 5.

Proposed solution:

When detecting INDENTATION atom in an "if else" context, first check the parent context to see whether the parent context is an "if else" context. If so, change the starting index in the 'if else' block currently being analyzed to the ending index of the parent block. In the example above, the starting index of the "if(Y)" would be changed to the ending index of the first "if(X)".

AlbertSGS added a commit to AlbertSGS/atoms-of-confusion-detector that referenced this issue May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant