Microsoft.Language.Xml.Scanner.ScanXmlStringUnQuoted C# (CSharp) Method

ScanXmlStringUnQuoted() private method

private ScanXmlStringUnQuoted ( ) : SyntaxToken
return SyntaxToken
        internal SyntaxToken ScanXmlStringUnQuoted()
        {
            if (!CanGetChar())
            {
                return MakeEofToken();
            }

            var Here = 0;
            var scratch = GetScratch();
            while (CanGetCharAtOffset(Here))
            {
                char c = PeekAheadChar(Here);
                // this is for the case where opening quote is omitted, but closing is present
                if (c == '\'' || c == '"')
                {
                    if (Here > 0)
                    {
                        return XmlMakeAttributeDataToken(null, Here, scratch);
                    }
                    else
                    {
                        if (c == '\'')
                        {
                            return XmlMakeSingleQuoteToken(null, c, isOpening: false);
                        }
                        else
                        {
                            return XmlMakeDoubleQuoteToken(null, c, isOpening: false);
                        }
                    }
                }

                switch (c)
                {
                    case UCH_CR:
                    case UCH_LF:
                    case ' ':
                    case UCH_TAB:
                        if (Here > 0)
                        {
                            return XmlMakeAttributeDataToken(null, Here, scratch);
                        }
                        else
                        {
                            return MakeMissingToken(null, SyntaxKind.SingleQuoteToken);
                        }
                    case '<':
                    case '>':
                    case '?':
                        // This cannot be in a string. terminate the string.
                        if (Here != 0)
                        {
                            return XmlMakeAttributeDataToken(null, Here, scratch);
                        }
                        else
                        {
                            return MakeMissingToken(null, SyntaxKind.SingleQuoteToken);
                        }
                    case '&':
                        if (Here > 0)
                        {
                            return XmlMakeAttributeDataToken(null, Here, scratch);
                        }
                        else
                        {
                            return ScanXmlReference(null);
                        }
                    case '/':
                        if (CanGetCharAtOffset(Here + 1) && PeekAheadChar(Here + 1) == '>')
                        {
                            if (Here != 0)
                            {
                                return XmlMakeAttributeDataToken(null, Here, scratch);
                            }
                            else
                            {
                                return MakeMissingToken(null, SyntaxKind.SingleQuoteToken);
                            }
                        }

                        goto default;
                    default:
                        var xmlCh = ScanXmlChar(Here);
                        if (xmlCh.Length == 0)
                        {
                            // bad char
                            if (Here > 0)
                            {
                                return XmlMakeAttributeDataToken(null, Here, scratch);
                            }
                            else
                            {
                                return XmlMakeBadToken(null, 1, ERRID.ERR_IllegalChar);
                            }
                        }

                        xmlCh.AppendTo(scratch);
                        Here += xmlCh.Length;
                        break;
                }
            }

            return XmlMakeAttributeDataToken(null, Here, scratch);
        }
Scanner