Skip to content

Conversation

@rodinaarssen
Copy link
Member

This solves an error in the outline of Rascal source files. Fixes #89.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2025

@DavyLandman
Copy link
Member

What happens now in case of an newline char? I can hardly imagine this fixing it, it such a small fix ;)

@rodinaarssen
Copy link
Member Author

The regular expression that was changed in this PR intended to strip a leading backslash from the input, returning all characters trailing the backslash character. Instead, it would match against any backslash character in the input. New line characters are changed to a space in another overload of clean.

In the outline case, the string that is fed into clean is (cutting some corners), for a production P, "<p.syms>". In the failing example from #89, this corresponds to the string "\"BBB\\nBBB\"" (note that the backslash and n are separate characters here). The "leading backslash" clean overload would match against the \\ at index 4 and incorrectly return "nBBB\"". Now, it correctly returns the input.

@DavyLandman
Copy link
Member

aah, right, it was for the case of an constructor named \if or \while. right :) thanks for explaining.

@DavyLandman DavyLandman merged commit 2b10eee into main Jan 9, 2025
14 checks passed
@rodinaarssen rodinaarssen deleted the fix-rascal-outline branch January 9, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rascal outline does not properly handle escaped characters in literals

2 participants