* @param {number} start - Index of first character
* @returns {number} - Index of the character after this
*/
parse(context,start){
this.context=context;
const{
parseNode,
src
}=context;
let{
atLineStart,
lineStart
}=context;
if(!atLineStart&&this.type===PlainValue.Type.SEQ_ITEM)this.error=newPlainValue.YAMLSemanticError(this,'Sequence items must not have preceding content on the same line');
if(src[end-1]!=='"')errors.push(newPlainValue.YAMLSyntaxError(this,'Missing closing "quote'));// Using String#replace is too painful with escaped newlines preceded by
// escaped backslashes; also, this should be faster.
letstr='';
for(leti=start+1;i<end-1;++i){
constch=src[i];
if(ch==='\n'){
if(PlainValue.Node.atDocumentBoundary(src,i+1))errors.push(newPlainValue.YAMLSemanticError(this,'Document boundary indicators are not allowed within string values'));
const{
fold,
offset,
error
}=PlainValue.Node.foldNewline(src,i,indent);
str+=fold;
i=offset;
if(error)errors.push(newPlainValue.YAMLSemanticError(this,'Multi-line double-quoted string needs to be sufficiently indented'));
}elseif(ch==='\\'){
i+=1;
switch(src[i]){
case'0':
str+='\0';
break;
// null character
case'a':
str+='\x07';
break;
// bell character
case'b':
str+='\b';
break;
// backspace
case'e':
str+='\x1b';
break;
// escape character
case'f':
str+='\f';
break;
// form feed
case'n':
str+='\n';
break;
// line feed
case'r':
str+='\r';
break;
// carriage return
case't':
str+='\t';
break;
// horizontal tab
case'v':
str+='\v';
break;
// vertical tab
case'N':
str+='\u0085';
break;
// Unicode next line
case'_':
str+='\u00a0';
break;
// Unicode non-breaking space
case'L':
str+='\u2028';
break;
// Unicode line separator
case'P':
str+='\u2029';
break;
// Unicode paragraph separator
case' ':
str+=' ';
break;
case'"':
str+='"';
break;
case'/':
str+='/';
break;
case'\\':
str+='\\';
break;
case'\t':
str+='\t';
break;
case'x':
str+=this.parseCharCode(i+1,2,errors);
i+=2;
break;
case'u':
str+=this.parseCharCode(i+1,4,errors);
i+=4;
break;
case'U':
str+=this.parseCharCode(i+1,8,errors);
i+=8;
break;
case'\n':
// skip escaped newlines, but still trim the following line
if(PlainValue.Node.atDocumentBoundary(src,i+1))errors.push(newPlainValue.YAMLSemanticError(this,'Document boundary indicators are not allowed within string values'));
const{
fold,
offset,
error
}=PlainValue.Node.foldNewline(src,i,indent);
str+=fold;
i=offset;
if(error)errors.push(newPlainValue.YAMLSemanticError(this,'Multi-line single-quoted string needs to be sufficiently indented'));
}elseif(ch==="'"){
str+=ch;
i+=1;
if(src[i]!=="'")errors.push(newPlainValue.YAMLSyntaxError(this,'Unescaped single quote? This should not happen.'));