-
Notifications
You must be signed in to change notification settings - Fork 78
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
Fixing issue #2009 #2010
base: main
Are you sure you want to change the base?
Fixing issue #2009 #2010
Conversation
Issue #2009 is about character classes like
So let's add some more tests for that and fix them, and then merge the PR when that's done. I'm shifting back to draft. So this now still breaks when programmers use escapes in literals that are part of types like |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2010 +/- ##
=======================================
Coverage 49% 49%
+ Complexity 6310 6302 -8
=======================================
Files 664 664
Lines 59601 59567 -34
Branches 8646 8641 -5
=======================================
- Hits 29483 29479 -4
+ Misses 27902 27870 -32
- Partials 2216 2218 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, great that you also added new tests 👍🏼
} | ||
else if (s.startsWith("\\")) { | ||
// builtin escape | ||
int cha = s.codePointAt(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes 👍
@DavyLandman I added more initially failing tests for the literals in types, such as |
src/org/rascalmpl/library/lang/rascal/tests/concrete/Character.rsc
Outdated
Show resolved
Hide resolved
try { | ||
String lit = ((StringConstant.Lexical) sep).getString(); | ||
// this should be the exact notation for string literals in vallang | ||
IValue string = new StandardTextReader().read(factory, new StringReader(lit)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparing the code, \\f
is not in vallang StandardTextReader
. the rest is there it seems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a test case showing that with this change an \f
in a character class is not translated to form feed char correctly.
@jurgenvinju I've fixed 2 bugs I found, and made an extra test case. But I think we have to bring back the escape code. as letting vallang take care breaks support for |
We have to add it to vallang then. In another PR. Let's merge this one because it fixes some serious issues? |
The SymbolFactory is/was still implementating the escaping and character encoding of SDF2 and not that of Rascal. This produces weird errors with unicode characters and escapes (\a, \u and \U).