private int ParseNamedCharRef(bool expand, StringBuilder internalSubsetBuilder)
{
for (;;)
{
int newPos;
switch (newPos = ParseNamedCharRefInline(_ps.charPos, expand, internalSubsetBuilder))
{
case -1:
return -1;
case -2:
// read new characters in the buffer
if (ReadData() == 0)
{
return -1;
}
Debug.Assert(_ps.chars[_ps.charPos] == '&');
continue;
default:
if (expand)
{
_ps.charPos = newPos - 1;
}
return newPos;
}
}
}