Skip to content

Commit

Permalink
ICU4J: Fix bug with '||' in a reserved statement being misparsed
Browse files Browse the repository at this point in the history
  • Loading branch information
catamorphism committed Aug 7, 2024
1 parent 3ac4b37 commit 22ce1cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,10 @@ private String getReservedBody() throws MFParseException {
result.append(firstPart);
while (true) {
int spaceCount = skipWhitespaces();
int beforeNextPart = input.getPosition();
String nextPart = getReservedBodyPart();
if (nextPart.length() == 0) {
// If we didn't parse anything, restore the whitespace
if (input.getPosition() <= beforeNextPart) {
input.backup(spaceCount);
break;
}
Expand Down
3 changes: 2 additions & 1 deletion testdata/message2/reserved-syntax-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{ "src" : "\\\\{ ? 󗟋 𫓜|@} |}", "ignoreCpp": "This would be an error in ICU4C" },
{ "src" : "\\\\{ ? 󗟋 𫓜|@} | \\} @𠟅򑚎𥪙𽧫=|| @򒘒򳷦㥞򉊷=$򸚶񽱆񅗽񤕞 @𰺱:񎫛񢶛򶈎񄮒}", "ignoreCpp": "This would be an error in ICU4C" },
{ "src" : "{ $iFN ^ @USh =$u @l}", "ignoreCpp": "This would be an error in ICU4C" },
{ "src" : ".local $dS ={ $p4 ^ |.| \\\\ @g:FV = $kd}{{@}}", "ignoreCpp": "This would be an error in ICU4C" }
{ "src" : ".local $dS ={ $p4 ^ |.| \\\\ @g:FV = $kd}{{@}}", "ignoreCpp": "This would be an error in ICU4C" },
{ "src" : ".D. \\\\ ||{1}{{}} ", "ignoreCpp": "This would be an error in ICU4C" }
]
}

0 comments on commit 22ce1cd

Please sign in to comment.