Skip to content

Commit

Permalink
fixed unicode issues in character class reification code
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Nov 20, 2024
1 parent 228a6f4 commit e56bf91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/org/rascalmpl/library/lang/rascal/tests/basic/Strings1.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,21 @@ test bool tstSqueezeCase4() = squeeze("aabbcc", "a-c") == "abc";
test bool tstSqueezeCase5() = squeeze("aaabc", "a-c") == "abc";

// second squeeze
test bool tstSqueeze1(str S) = /<c:[a-zA-Z]><c>/ !:= squeeze(S, #[a-zA-Z]);
test bool tstSqueeze2(str S) = squeeze(S, #[]) == S;
test bool tstSqueeze3(str S) {
test bool tstSqueeze1CC(str S) = /<c:[a-zA-Z]><c>/ !:= squeeze(S, #[a-zA-Z]);
test bool tstSqueeze2CC(str S) = squeeze(S, #[]) == S;
test bool tstSqueeze3CC(str S) {
if (/<c:[a-zA-Z]><c>/ := S) {
return /<c><c>/ := squeeze(S, #[0-9]);
}
return true;
}

test bool tstSqueezeUnicode() = squeeze("Hi 🍝🍝World", #[🍝]) == "Hi 🍝World";
test bool tstSqueezeCase1() = squeeze("abc", #[a-c]) == "abc";
test bool tstSqueezeCase2() = squeeze("aabc", #[a-c]) == "abc";
test bool tstSqueezeCase3() = squeeze("aabcc", #[a-c]) == "abc";
test bool tstSqueezeCase4() = squeeze("aabbcc", #[a-c]) == "abc";
test bool tstSqueezeCase5() = squeeze("aaabc", #[a-c]) == "abc";
test bool tstSqueezeUnicodeCC() = squeeze("Hi 🍝🍝World", #[🍝]) == "Hi 🍝World";
test bool tstSqueezeCase1CC() = squeeze("abc", #[a-c]) == "abc";
test bool tstSqueezeCase2CC() = squeeze("aabc", #[a-c]) == "abc";
test bool tstSqueezeCase3CC() = squeeze("aabcc", #[a-c]) == "abc";
test bool tstSqueezeCase4CC() = squeeze("aabbcc", #[a-c]) == "abc";
test bool tstSqueezeCase5CC() = squeeze("aaabc", #[a-c]) == "abc";

test bool tstStartsWith(str S1, str S2) = startsWith(S1+S2, S1);

Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/values/parsetrees/SymbolFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private static IValue char2int(Char character) {
return factory.integer(Integer.parseUnsignedInt(s.substring(2), 16));

Check warning on line 348 in src/org/rascalmpl/values/parsetrees/SymbolFactory.java

View check run for this annotation

Codecov / codecov/patch

src/org/rascalmpl/values/parsetrees/SymbolFactory.java#L348

Added line #L348 was not covered by tests
}
else {
char cha = s.charAt(1);
int cha = s.codePointAt(1);

Check warning on line 351 in src/org/rascalmpl/values/parsetrees/SymbolFactory.java

View check run for this annotation

Codecov / codecov/patch

src/org/rascalmpl/values/parsetrees/SymbolFactory.java#L351

Added line #L351 was not covered by tests
switch (cha) {
case 't': return factory.integer('\t');
case 'n': return factory.integer('\n');
Expand All @@ -365,7 +365,7 @@ private static IValue char2int(Char character) {
}
}
else {
char cha = s.charAt(0);
int cha = s.codePointAt(0);
return factory.integer(cha);
}
}
Expand Down

0 comments on commit e56bf91

Please sign in to comment.