Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2026-03-12 16:16:57 -04:00

View File

@@ -37,17 +37,22 @@ public class LParser{
String string(){ String string(){
int from = pos; int from = pos;
int utflen = 0;
while(++pos < chars.length){ while(++pos < chars.length){
var c = chars[pos]; char c = chars[pos];
if(c == '\n'){ if(c == '\n'){
error("Missing closing quote \" before end of line."); error("Missing closing quote \" before end of line.");
}else if(c == '"'){ }else if(c == '"'){
break; break;
} }
// See ByteBufferOutput.writeUTF()
utflen += c != 0 && c <= 0x7F ? 1 : c <= 0x7FF ? 2 : 3;
} }
if(pos >= chars.length || chars[pos] != '"') error("Missing closing quote \" before end of file."); if(pos >= chars.length || chars[pos] != '"') error("Missing closing quote \" before end of file.");
if(utflen > 65535) error("String value too long.");
return new String(chars, from, ++pos - from); return new String(chars, from, ++pos - from);
} }