using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; internal class DocumentationCommentParser : SyntaxParser { private enum SkipResult { Continue, Abort } private readonly SyntaxListPool _pool = new SyntaxListPool(); private bool _isDelimited; private readonly HashSet _attributesSeen = new HashSet(); private bool IsEndOfCrefAttribute { get { switch (base.CurrentToken.Kind) { case SyntaxKind.SingleQuoteToken: return (base.Mode & LexerMode.XmlCrefQuote) == LexerMode.XmlCrefQuote; case SyntaxKind.DoubleQuoteToken: return (base.Mode & LexerMode.XmlCrefDoubleQuote) == LexerMode.XmlCrefDoubleQuote; case SyntaxKind.EndOfDocumentationCommentToken: case SyntaxKind.EndOfFileToken: return true; case SyntaxKind.BadToken: if (!(base.CurrentToken.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken))) { return IsNonAsciiQuotationMark(base.CurrentToken); } return true; default: return false; } } } private bool InCref { get { LexerMode lexerMode = base.Mode & (LexerMode.XmlCrefQuote | LexerMode.XmlCrefDoubleQuote); if (lexerMode == LexerMode.XmlCrefQuote || lexerMode == LexerMode.XmlCrefDoubleQuote) { return true; } return false; } } private bool IsEndOfNameAttribute { get { switch (base.CurrentToken.Kind) { case SyntaxKind.SingleQuoteToken: return (base.Mode & LexerMode.XmlNameQuote) == LexerMode.XmlNameQuote; case SyntaxKind.DoubleQuoteToken: return (base.Mode & LexerMode.XmlNameDoubleQuote) == LexerMode.XmlNameDoubleQuote; case SyntaxKind.EndOfDocumentationCommentToken: case SyntaxKind.EndOfFileToken: return true; case SyntaxKind.BadToken: if (!(base.CurrentToken.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken))) { return IsNonAsciiQuotationMark(base.CurrentToken); } return true; default: return false; } } } internal DocumentationCommentParser(Lexer lexer, LexerMode modeflags) : base(lexer, LexerMode.XmlDocComment | modeflags, null, null, allowModeReset: true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown _isDelimited = (modeflags & LexerMode.XmlDocCommentStyleDelimited) != 0; } internal void ReInitialize(LexerMode modeflags) { ReInitialize(); base.Mode = LexerMode.XmlDocComment | modeflags; _isDelimited = (modeflags & LexerMode.XmlDocCommentStyleDelimited) != 0; } private LexerMode SetMode(LexerMode mode) { LexerMode mode2 = base.Mode; base.Mode = mode | (mode2 & (LexerMode.MaskXmlDocCommentLocation | LexerMode.MaskXmlDocCommentStyle)); return mode2; } private void ResetMode(LexerMode mode) { base.Mode = mode; } public DocumentationCommentTriviaSyntax ParseDocumentationComment(out bool isTerminated) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) SyntaxListBuilder val = _pool.Allocate(); try { ParseXmlNodes(val); if (base.CurrentToken.Kind != SyntaxKind.EndOfDocumentationCommentToken) { ParseRemainder(val); } SyntaxToken syntaxToken = EatToken(SyntaxKind.EndOfDocumentationCommentToken); isTerminated = !_isDelimited || (syntaxToken.LeadingTrivia.Count > 0 && ((object)syntaxToken.LeadingTrivia[syntaxToken.LeadingTrivia.Count - 1]).ToString() == "*/"); return SyntaxFactory.DocumentationCommentTrivia(_isDelimited ? SyntaxKind.MultiLineDocumentationCommentTrivia : SyntaxKind.SingleLineDocumentationCommentTrivia, val.ToList(), syntaxToken); } finally { _pool.Free(SyntaxListBuilder.op_Implicit(val)); } } public void ParseRemainder(SyntaxListBuilder nodes) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) bool flag = base.CurrentToken.Kind == SyntaxKind.LessThanSlashToken; LexerMode mode = SetMode(LexerMode.XmlCDataSectionText); SyntaxListBuilder val = _pool.Allocate(); try { while (base.CurrentToken.Kind != SyntaxKind.EndOfDocumentationCommentToken) { SyntaxToken syntaxToken = EatToken(); val.Add((GreenNode)(object)syntaxToken); } XmlTextSyntax node = SyntaxFactory.XmlText(SyntaxList.op_Implicit(val.ToList())); XmlParseErrorCode code = (flag ? XmlParseErrorCode.XML_EndTagNotExpected : XmlParseErrorCode.XML_ExpectedEndOfXml); node = WithAdditionalDiagnostics(node, new XmlSyntaxDiagnosticInfo(0, 1, code)); nodes.Add((XmlNodeSyntax)node); } finally { _pool.Free(val); } ResetMode(mode); } private void ParseXmlNodes(SyntaxListBuilder nodes) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) while (true) { XmlNodeSyntax xmlNodeSyntax = ParseXmlNode(); if (xmlNodeSyntax == null) { break; } nodes.Add(xmlNodeSyntax); } } private XmlNodeSyntax ParseXmlNode() { switch (base.CurrentToken.Kind) { case SyntaxKind.XmlEntityLiteralToken: case SyntaxKind.XmlTextLiteralToken: case SyntaxKind.XmlTextLiteralNewLineToken: return ParseXmlText(); case SyntaxKind.LessThanToken: return ParseXmlElement(); case SyntaxKind.XmlCommentStartToken: return ParseXmlComment(); case SyntaxKind.XmlCDataStartToken: return ParseXmlCDataSection(); case SyntaxKind.XmlProcessingInstructionStartToken: return ParseXmlProcessingInstruction(); case SyntaxKind.EndOfDocumentationCommentToken: return null; default: return null; } } private bool IsXmlNodeStartOrStop() { switch (base.CurrentToken.Kind) { case SyntaxKind.LessThanToken: case SyntaxKind.GreaterThanToken: case SyntaxKind.SlashGreaterThanToken: case SyntaxKind.LessThanSlashToken: case SyntaxKind.XmlCommentStartToken: case SyntaxKind.XmlCDataStartToken: case SyntaxKind.XmlProcessingInstructionStartToken: case SyntaxKind.EndOfDocumentationCommentToken: return true; default: return false; } } private XmlNodeSyntax ParseXmlText() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) SyntaxListBuilder val = _pool.Allocate(); while (base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken || base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken || base.CurrentToken.Kind == SyntaxKind.XmlEntityLiteralToken) { val.Add((GreenNode)(object)EatToken()); } SyntaxList val2 = val.ToList(); _pool.Free(val); return SyntaxFactory.XmlText(SyntaxList.op_Implicit(val2)); } private XmlNodeSyntax ParseXmlElement() { //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) SyntaxToken syntaxToken = EatToken(SyntaxKind.LessThanToken); LexerMode mode = SetMode(LexerMode.XmlElementTag); XmlNameSyntax elementName = ParseXmlName(); if (((GreenNode)syntaxToken).GetTrailingTriviaWidth() > 0 || ((GreenNode)elementName).GetLeadingTriviaWidth() > 0) { elementName = WithXmlParseError(elementName, XmlParseErrorCode.XML_InvalidWhitespace); } SyntaxListBuilder val = _pool.Allocate(); try { ParseXmlAttributes(ref elementName, val); if (base.CurrentToken.Kind == SyntaxKind.GreaterThanToken) { XmlElementStartTagSyntax startTag = SyntaxFactory.XmlElementStartTag(syntaxToken, elementName, SyntaxListBuilder.op_Implicit(val), EatToken()); SetMode(LexerMode.XmlDocComment); SyntaxListBuilder val2 = _pool.Allocate(); try { ParseXmlNodes(val2); SyntaxToken syntaxToken2 = EatToken(SyntaxKind.LessThanSlashToken, reportError: false); XmlNameSyntax startNode; SyntaxToken greaterThanToken; if (((GreenNode)syntaxToken2).IsMissing) { ResetMode(mode); syntaxToken2 = WithXmlParseError(syntaxToken2, XmlParseErrorCode.XML_EndTagExpected, ((object)elementName).ToString()); startNode = SyntaxFactory.XmlName(null, SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken)); greaterThanToken = SyntaxFactory.MissingToken(SyntaxKind.GreaterThanToken); } else { SetMode(LexerMode.XmlElementTag); startNode = ParseXmlName(); if (((GreenNode)syntaxToken2).GetTrailingTriviaWidth() > 0 || ((GreenNode)startNode).GetLeadingTriviaWidth() > 0) { startNode = WithXmlParseError(startNode, XmlParseErrorCode.XML_InvalidWhitespace); } if (!((GreenNode)startNode).IsMissing && !MatchingXmlNames(elementName, startNode)) { startNode = WithXmlParseError(startNode, XmlParseErrorCode.XML_ElementTypeMatch, ((object)startNode).ToString(), ((object)elementName).ToString()); } if (base.CurrentToken.Kind != SyntaxKind.GreaterThanToken) { SkipBadTokens(ref startNode, null, (DocumentationCommentParser p) => p.CurrentToken.Kind != SyntaxKind.GreaterThanToken, (DocumentationCommentParser p) => p.IsXmlNodeStartOrStop(), XmlParseErrorCode.XML_InvalidToken); } greaterThanToken = EatToken(SyntaxKind.GreaterThanToken); } XmlElementEndTagSyntax endTag = SyntaxFactory.XmlElementEndTag(syntaxToken2, startNode, greaterThanToken); ResetMode(mode); return SyntaxFactory.XmlElement(startTag, val2.ToList(), endTag); } finally { _pool.Free(SyntaxListBuilder.op_Implicit(val2)); } } SyntaxToken syntaxToken3 = EatToken(SyntaxKind.SlashGreaterThanToken, reportError: false); if (((GreenNode)syntaxToken3).IsMissing && !((GreenNode)elementName).IsMissing) { syntaxToken3 = WithXmlParseError(syntaxToken3, XmlParseErrorCode.XML_ExpectedEndOfTag, ((object)elementName).ToString()); } ResetMode(mode); return SyntaxFactory.XmlEmptyElement(syntaxToken, elementName, SyntaxListBuilder.op_Implicit(val), syntaxToken3); } finally { _pool.Free(SyntaxListBuilder.op_Implicit(val)); } } private static bool MatchingXmlNames(XmlNameSyntax name, XmlNameSyntax endName) { if (name == endName) { return true; } if (!((GreenNode)name).HasLeadingTrivia && !((GreenNode)endName).HasTrailingTrivia && ((GreenNode)name).IsEquivalentTo((GreenNode)(object)endName)) { return true; } return ((object)name).ToString() == ((object)endName).ToString(); } private void ParseXmlAttributes(ref XmlNameSyntax elementName, SyntaxListBuilder attrs) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) _attributesSeen.Clear(); while (true) { if (base.CurrentToken.Kind == SyntaxKind.IdentifierToken) { XmlAttributeSyntax xmlAttributeSyntax = ParseXmlAttribute(elementName); string text = ((object)xmlAttributeSyntax.Name).ToString(); if (!_attributesSeen.Add(text)) { xmlAttributeSyntax = WithXmlParseError(xmlAttributeSyntax, XmlParseErrorCode.XML_DuplicateAttribute, text); } attrs.Add(xmlAttributeSyntax); } else if (SkipBadTokens(ref elementName, SyntaxListBuilder.op_Implicit(attrs), (DocumentationCommentParser p) => p.CurrentToken.Kind != SyntaxKind.IdentifierName, (DocumentationCommentParser p) => p.CurrentToken.Kind == SyntaxKind.GreaterThanToken || p.CurrentToken.Kind == SyntaxKind.SlashGreaterThanToken || p.CurrentToken.Kind == SyntaxKind.LessThanToken || p.CurrentToken.Kind == SyntaxKind.LessThanSlashToken || p.CurrentToken.Kind == SyntaxKind.EndOfDocumentationCommentToken || p.CurrentToken.Kind == SyntaxKind.EndOfFileToken, XmlParseErrorCode.XML_InvalidToken) == SkipResult.Abort) { break; } } } private SkipResult SkipBadTokens(ref T startNode, SyntaxListBuilder list, Func isNotExpectedFunction, Func abortFunction, XmlParseErrorCode error) where T : CSharpSyntaxNode { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) SyntaxListBuilder val = default(SyntaxListBuilder); bool flag = false; try { SkipResult result = SkipResult.Continue; while (isNotExpectedFunction(this)) { if (abortFunction(this)) { result = SkipResult.Abort; break; } if (val.IsNull) { val = _pool.Allocate(); } SyntaxToken syntaxToken = EatToken(); if (!flag) { syntaxToken = WithXmlParseError(syntaxToken, error, ((object)syntaxToken).ToString()); flag = true; } val.Add(syntaxToken); } if (!val.IsNull && val.Count > 0) { if (list == null || list.Count == 0) { startNode = AddTrailingSkippedSyntax(startNode, val.ToListNode()); } else { list[list.Count - 1] = (GreenNode)(object)AddTrailingSkippedSyntax((CSharpSyntaxNode)(object)list[list.Count - 1], val.ToListNode()); } return result; } return SkipResult.Abort; } finally { if (!val.IsNull) { _pool.Free(SyntaxListBuilder.op_Implicit(val)); } } } private XmlAttributeSyntax ParseXmlAttribute(XmlNameSyntax elementName) { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) XmlNameSyntax xmlNameSyntax = ParseXmlName(); if (((GreenNode)xmlNameSyntax).GetLeadingTriviaWidth() == 0) { xmlNameSyntax = WithXmlParseError(xmlNameSyntax, XmlParseErrorCode.XML_WhitespaceMissing); } SyntaxToken syntaxToken = EatToken(SyntaxKind.EqualsToken, reportError: false); if (((GreenNode)syntaxToken).IsMissing) { syntaxToken = WithXmlParseError(syntaxToken, XmlParseErrorCode.XML_MissingEqualsAttribute); SyntaxKind kind = base.CurrentToken.Kind; if (kind - 8213 > SyntaxKind.List) { return SyntaxFactory.XmlTextAttribute(xmlNameSyntax, syntaxToken, SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken), default(SyntaxList), SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken)); } } string valueText = xmlNameSyntax.LocalName.ValueText; bool flag = xmlNameSyntax.Prefix == null; SyntaxToken startQuote; SyntaxToken endQuote; if (flag && DocumentationCommentXmlNames.AttributeEquals(valueText, "cref") && !IsVerbatimCref()) { ParseCrefAttribute(out startQuote, out var cref, out endQuote); return SyntaxFactory.XmlCrefAttribute(xmlNameSyntax, syntaxToken, startQuote, cref, endQuote); } if (flag && DocumentationCommentXmlNames.AttributeEquals(valueText, "name") && XmlElementSupportsNameAttribute(elementName)) { ParseNameAttribute(out startQuote, out var identifier, out endQuote); return SyntaxFactory.XmlNameAttribute(xmlNameSyntax, syntaxToken, startQuote, identifier, endQuote); } SyntaxListBuilder val = _pool.Allocate(); try { ParseXmlAttributeText(out startQuote, val, out endQuote); return SyntaxFactory.XmlTextAttribute(xmlNameSyntax, syntaxToken, startQuote, SyntaxListBuilder.op_Implicit(val), endQuote); } finally { _pool.Free(SyntaxListBuilder.op_Implicit(val)); } } private static bool XmlElementSupportsNameAttribute(XmlNameSyntax elementName) { if (elementName.Prefix != null) { return false; } string valueText = elementName.LocalName.ValueText; if (!DocumentationCommentXmlNames.ElementEquals(valueText, "param", false) && !DocumentationCommentXmlNames.ElementEquals(valueText, "paramref", false) && !DocumentationCommentXmlNames.ElementEquals(valueText, "typeparam", false)) { return DocumentationCommentXmlNames.ElementEquals(valueText, "typeparamref", false); } return true; } private bool IsVerbatimCref() { bool result = false; ResetPoint point = GetResetPoint(); SyntaxToken syntaxToken = EatToken((base.CurrentToken.Kind == SyntaxKind.SingleQuoteToken) ? SyntaxKind.SingleQuoteToken : SyntaxKind.DoubleQuoteToken); SetMode(LexerMode.XmlCharacter); SyntaxToken currentToken = base.CurrentToken; if ((currentToken.Kind == SyntaxKind.XmlTextLiteralToken || currentToken.Kind == SyntaxKind.XmlEntityLiteralToken) && currentToken.ValueText != SyntaxFacts.GetText(syntaxToken.Kind) && currentToken.ValueText != ":") { EatToken(); currentToken = base.CurrentToken; if ((currentToken.Kind == SyntaxKind.XmlTextLiteralToken || currentToken.Kind == SyntaxKind.XmlEntityLiteralToken) && currentToken.ValueText == ":") { result = true; } } Reset(ref point); Release(ref point); return result; } private void ParseCrefAttribute(out SyntaxToken startQuote, out CrefSyntax cref, out SyntaxToken endQuote) { startQuote = ParseXmlAttributeStartQuote(); SyntaxKind kind = startQuote.Kind; LexerMode mode = SetMode((kind == SyntaxKind.SingleQuoteToken) ? LexerMode.XmlCrefQuote : LexerMode.XmlCrefDoubleQuote); cref = ParseCrefAttributeValue(); ResetMode(mode); endQuote = ParseXmlAttributeEndQuote(kind); } private void ParseNameAttribute(out SyntaxToken startQuote, out IdentifierNameSyntax identifier, out SyntaxToken endQuote) { startQuote = ParseXmlAttributeStartQuote(); SyntaxKind kind = startQuote.Kind; LexerMode mode = SetMode((kind == SyntaxKind.SingleQuoteToken) ? LexerMode.XmlNameQuote : LexerMode.XmlNameDoubleQuote); identifier = ParseNameAttributeValue(); ResetMode(mode); endQuote = ParseXmlAttributeEndQuote(kind); } private void ParseXmlAttributeText(out SyntaxToken startQuote, SyntaxListBuilder textTokens, out SyntaxToken endQuote) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) startQuote = ParseXmlAttributeStartQuote(); SyntaxKind kind = startQuote.Kind; if (((GreenNode)startQuote).IsMissing && ((GreenNode)startQuote).FullWidth == 0) { endQuote = SyntaxFactory.MissingToken(kind); return; } LexerMode mode = SetMode((kind == SyntaxKind.SingleQuoteToken) ? LexerMode.XmlAttributeTextQuote : LexerMode.XmlAttributeTextDoubleQuote); while (base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken || base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken || base.CurrentToken.Kind == SyntaxKind.XmlEntityLiteralToken || base.CurrentToken.Kind == SyntaxKind.LessThanToken) { SyntaxToken syntaxToken = EatToken(); if (syntaxToken.Kind == SyntaxKind.LessThanToken) { syntaxToken = WithXmlParseError(syntaxToken, XmlParseErrorCode.XML_LessThanInAttributeValue); } textTokens.Add(syntaxToken); } ResetMode(mode); endQuote = ParseXmlAttributeEndQuote(kind); } private SyntaxToken ParseXmlAttributeStartQuote() { if (IsNonAsciiQuotationMark(base.CurrentToken)) { return SkipNonAsciiQuotationMark(); } SyntaxKind kind = ((base.CurrentToken.Kind == SyntaxKind.SingleQuoteToken) ? SyntaxKind.SingleQuoteToken : SyntaxKind.DoubleQuoteToken); SyntaxToken syntaxToken = EatToken(kind, reportError: false); if (((GreenNode)syntaxToken).IsMissing) { syntaxToken = WithXmlParseError(syntaxToken, XmlParseErrorCode.XML_StringLiteralNoStartQuote); } return syntaxToken; } private SyntaxToken ParseXmlAttributeEndQuote(SyntaxKind quoteKind) { if (IsNonAsciiQuotationMark(base.CurrentToken)) { return SkipNonAsciiQuotationMark(); } SyntaxToken syntaxToken = EatToken(quoteKind, reportError: false); if (((GreenNode)syntaxToken).IsMissing) { syntaxToken = WithXmlParseError(syntaxToken, XmlParseErrorCode.XML_StringLiteralNoEndQuote); } return syntaxToken; } private SyntaxToken SkipNonAsciiQuotationMark() { SyntaxToken node = SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken); node = AddTrailingSkippedSyntax(node, (GreenNode)(object)EatToken()); return WithXmlParseError(node, XmlParseErrorCode.XML_StringLiteralNonAsciiQuote); } private static bool IsNonAsciiQuotationMark(SyntaxToken token) { if (token.Text.Length == 1) { return SyntaxFacts.IsNonAsciiQuotationMark(token.Text[0]); } return false; } private XmlNameSyntax ParseXmlName() { SyntaxToken syntaxToken = EatToken(SyntaxKind.IdentifierToken); XmlPrefixSyntax prefix = null; if (base.CurrentToken.Kind == SyntaxKind.ColonToken) { SyntaxToken syntaxToken2 = EatToken(); int trailingTriviaWidth = ((GreenNode)syntaxToken).GetTrailingTriviaWidth(); int leadingTriviaWidth = ((GreenNode)syntaxToken2).GetLeadingTriviaWidth(); if (trailingTriviaWidth > 0 || leadingTriviaWidth > 0) { int offset = -trailingTriviaWidth; int width = trailingTriviaWidth + leadingTriviaWidth; syntaxToken2 = WithAdditionalDiagnostics(syntaxToken2, new XmlSyntaxDiagnosticInfo(offset, width, XmlParseErrorCode.XML_InvalidWhitespace)); } prefix = SyntaxFactory.XmlPrefix(syntaxToken, syntaxToken2); syntaxToken = EatToken(SyntaxKind.IdentifierToken); int trailingTriviaWidth2 = ((GreenNode)syntaxToken2).GetTrailingTriviaWidth(); int leadingTriviaWidth2 = ((GreenNode)syntaxToken).GetLeadingTriviaWidth(); if (trailingTriviaWidth2 > 0 || leadingTriviaWidth2 > 0) { int offset2 = -trailingTriviaWidth2; int width2 = trailingTriviaWidth2 + leadingTriviaWidth2; syntaxToken = WithAdditionalDiagnostics(syntaxToken, new XmlSyntaxDiagnosticInfo(offset2, width2, XmlParseErrorCode.XML_InvalidWhitespace)); } } return SyntaxFactory.XmlName(prefix, syntaxToken); } private XmlCommentSyntax ParseXmlComment() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) SyntaxToken lessThanExclamationMinusMinusToken = EatToken(SyntaxKind.XmlCommentStartToken); LexerMode mode = SetMode(LexerMode.XmlCommentText); SyntaxListBuilder val = _pool.Allocate(); while (base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken || base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken || base.CurrentToken.Kind == SyntaxKind.MinusMinusToken) { SyntaxToken syntaxToken = EatToken(); if (syntaxToken.Kind == SyntaxKind.MinusMinusToken) { syntaxToken = WithXmlParseError(syntaxToken, XmlParseErrorCode.XML_IncorrectComment); } val.Add(syntaxToken); } SyntaxList textTokens = val.ToList(); _pool.Free(SyntaxListBuilder.op_Implicit(val)); SyntaxToken minusMinusGreaterThanToken = EatToken(SyntaxKind.XmlCommentEndToken); ResetMode(mode); return SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); } private XmlCDataSectionSyntax ParseXmlCDataSection() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) SyntaxToken startCDataToken = EatToken(SyntaxKind.XmlCDataStartToken); LexerMode mode = SetMode(LexerMode.XmlCDataSectionText); SyntaxListBuilder val = default(SyntaxListBuilder); val._002Ector(10); while (base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken || base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken) { val.Add(EatToken()); } SyntaxToken endCDataToken = EatToken(SyntaxKind.XmlCDataEndToken); ResetMode(mode); return SyntaxFactory.XmlCDataSection(startCDataToken, SyntaxListBuilder.op_Implicit(val), endCDataToken); } private XmlProcessingInstructionSyntax ParseXmlProcessingInstruction() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) SyntaxToken startProcessingInstructionToken = EatToken(SyntaxKind.XmlProcessingInstructionStartToken); LexerMode mode = SetMode(LexerMode.XmlElementTag); XmlNameSyntax name = ParseXmlName(); SetMode(LexerMode.XmlProcessingInstructionText); SyntaxListBuilder val = default(SyntaxListBuilder); val._002Ector(10); while (base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken || base.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken) { SyntaxToken syntaxToken = EatToken(); val.Add(syntaxToken); } SyntaxToken endProcessingInstructionToken = EatToken(SyntaxKind.XmlProcessingInstructionEndToken); ResetMode(mode); return SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, SyntaxListBuilder.op_Implicit(val), endProcessingInstructionToken); } protected override SyntaxDiagnosticInfo GetExpectedTokenError(SyntaxKind expected, SyntaxKind actual, int offset, int length) { if (InCref) { SyntaxDiagnosticInfo expectedTokenError = base.GetExpectedTokenError(expected, actual, offset, length); return new SyntaxDiagnosticInfo(expectedTokenError.Offset, expectedTokenError.Width, ErrorCode.WRN_ErrorOverride, expectedTokenError, ((DiagnosticInfo)expectedTokenError).Code); } if (expected == SyntaxKind.IdentifierToken) { return new XmlSyntaxDiagnosticInfo(offset, length, XmlParseErrorCode.XML_ExpectedIdentifier); } return new XmlSyntaxDiagnosticInfo(offset, length, XmlParseErrorCode.XML_InvalidToken, SyntaxFacts.GetText(actual)); } protected override SyntaxDiagnosticInfo GetExpectedTokenError(SyntaxKind expected, SyntaxKind actual) { if (InCref) { GetDiagnosticSpanForMissingToken(out var offset, out var width); return GetExpectedTokenError(expected, actual, offset, width); } if (expected == SyntaxKind.IdentifierToken) { return new XmlSyntaxDiagnosticInfo(XmlParseErrorCode.XML_ExpectedIdentifier); } return new XmlSyntaxDiagnosticInfo(XmlParseErrorCode.XML_InvalidToken, SyntaxFacts.GetText(actual)); } private TNode WithXmlParseError(TNode node, XmlParseErrorCode code) where TNode : CSharpSyntaxNode { return WithAdditionalDiagnostics(node, new XmlSyntaxDiagnosticInfo(0, ((GreenNode)node).Width, code)); } private TNode WithXmlParseError(TNode node, XmlParseErrorCode code, params string[] args) where TNode : CSharpSyntaxNode { DiagnosticInfo[] array = new DiagnosticInfo[1]; array[0] = new XmlSyntaxDiagnosticInfo(0, ((GreenNode)node).Width, code, args); return WithAdditionalDiagnostics(node, (DiagnosticInfo[])(object)array); } private SyntaxToken WithXmlParseError(SyntaxToken node, XmlParseErrorCode code, params string[] args) { DiagnosticInfo[] array = new DiagnosticInfo[1]; array[0] = new XmlSyntaxDiagnosticInfo(0, ((GreenNode)node).Width, code, args); return WithAdditionalDiagnostics(node, (DiagnosticInfo[])(object)array); } protected override TNode WithAdditionalDiagnostics(TNode node, params DiagnosticInfo[] diagnostics) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)((ParseOptions)base.Options).DocumentationMode < 2) { return node; } return base.WithAdditionalDiagnostics(node, diagnostics); } private CrefSyntax ParseCrefAttributeValue() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) TypeSyntax typeSyntax = ParseCrefType(typeArgumentsMustBeIdentifiers: true, checkForMember: true); CrefSyntax crefSyntax; if (typeSyntax == null) { crefSyntax = ParseMemberCref(); } else if (IsEndOfCrefAttribute) { crefSyntax = SyntaxFactory.TypeCref(typeSyntax); } else if (typeSyntax.Kind != SyntaxKind.QualifiedName && base.CurrentToken.Kind == SyntaxKind.OpenParenToken) { CrefParameterListSyntax parameters = ParseCrefParameterList(); crefSyntax = SyntaxFactory.NameMemberCref(typeSyntax, parameters); } else { SyntaxToken dotToken = EatToken(SyntaxKind.DotToken); MemberCrefSyntax member = ParseMemberCref(); crefSyntax = SyntaxFactory.QualifiedCref(typeSyntax, dotToken, member); } bool flag = !IsEndOfCrefAttribute || ((GreenNode)crefSyntax).ContainsDiagnostics; if (!IsEndOfCrefAttribute) { SyntaxListBuilder val = _pool.Allocate(); while (!IsEndOfCrefAttribute) { val.Add(EatToken()); } crefSyntax = AddTrailingSkippedSyntax(crefSyntax, val.ToListNode()); _pool.Free(SyntaxListBuilder.op_Implicit(val)); } if (flag) { crefSyntax = AddError(crefSyntax, ErrorCode.WRN_BadXMLRefSyntax, ((GreenNode)crefSyntax).ToFullString()); } return crefSyntax; } private MemberCrefSyntax ParseMemberCref() { switch (base.CurrentToken.Kind) { case SyntaxKind.ThisKeyword: return ParseIndexerMemberCref(); case SyntaxKind.OperatorKeyword: return ParseOperatorMemberCref(); case SyntaxKind.ExplicitKeyword: case SyntaxKind.ImplicitKeyword: return ParseConversionOperatorMemberCref(); default: return ParseNameMemberCref(); } } private NameMemberCrefSyntax ParseNameMemberCref() { SimpleNameSyntax name = ParseCrefName(typeArgumentsMustBeIdentifiers: true); CrefParameterListSyntax parameters = ParseCrefParameterList(); return SyntaxFactory.NameMemberCref(name, parameters); } private IndexerMemberCrefSyntax ParseIndexerMemberCref() { SyntaxToken thisKeyword = EatToken(); CrefBracketedParameterListSyntax parameters = ParseBracketedCrefParameterList(); return SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); } private OperatorMemberCrefSyntax ParseOperatorMemberCref() { SyntaxToken operatorKeyword = EatToken(); SyntaxToken checkedKeyword = TryEatCheckedKeyword(isConversion: false, ref operatorKeyword); SyntaxToken syntaxToken; if (SyntaxFacts.IsAnyOverloadableOperator(base.CurrentToken.Kind)) { syntaxToken = EatToken(); } else { syntaxToken = SyntaxFactory.MissingToken(SyntaxKind.PlusToken); GetDiagnosticSpanForMissingToken(out var offset, out var width); if (SyntaxFacts.IsUnaryOperatorDeclarationToken(base.CurrentToken.Kind) || SyntaxFacts.IsBinaryExpressionOperatorToken(base.CurrentToken.Kind)) { syntaxToken = AddTrailingSkippedSyntax(syntaxToken, (GreenNode)(object)EatToken()); } SyntaxDiagnosticInfo syntaxDiagnosticInfo = new SyntaxDiagnosticInfo(offset, width, ErrorCode.ERR_OvlOperatorExpected); SyntaxDiagnosticInfo syntaxDiagnosticInfo2 = new SyntaxDiagnosticInfo(offset, width, ErrorCode.WRN_ErrorOverride, syntaxDiagnosticInfo, ((DiagnosticInfo)syntaxDiagnosticInfo).Code); syntaxToken = WithAdditionalDiagnostics(syntaxToken, syntaxDiagnosticInfo2); } if (syntaxToken.Kind == SyntaxKind.GreaterThanToken && ((GreenNode)syntaxToken).GetTrailingTriviaWidth() == 0 && ((GreenNode)base.CurrentToken).GetLeadingTriviaWidth() == 0) { if (base.CurrentToken.Kind == SyntaxKind.GreaterThanToken) { SyntaxToken syntaxToken2 = EatToken(); bool flag = ((GreenNode)syntaxToken2).GetTrailingTriviaWidth() == 0 && ((GreenNode)base.CurrentToken).GetLeadingTriviaWidth() == 0; if (flag) { SyntaxKind kind = base.CurrentToken.Kind; bool flag2 = ((kind == SyntaxKind.GreaterThanToken || kind == SyntaxKind.GreaterThanEqualsToken) ? true : false); flag = flag2; } if (flag) { SyntaxToken syntaxToken3 = EatToken(); if (syntaxToken3.Kind == SyntaxKind.GreaterThanToken) { syntaxToken = SyntaxFactory.Token(syntaxToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanToken, syntaxToken.Text + syntaxToken2.Text + syntaxToken3.Text, syntaxToken.ValueText + syntaxToken2.ValueText + syntaxToken3.ValueText, syntaxToken3.GetTrailingTrivia()); syntaxToken = CheckFeatureAvailability(syntaxToken, MessageID.IDS_FeatureUnsignedRightShift, forceWarning: true); } else { SyntaxToken syntaxToken4 = SyntaxFactory.Token(syntaxToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, syntaxToken.Text + syntaxToken2.Text + syntaxToken3.Text, syntaxToken.ValueText + syntaxToken2.ValueText + syntaxToken3.ValueText, syntaxToken3.GetTrailingTrivia()); syntaxToken = SyntaxFactory.MissingToken(SyntaxKind.PlusToken); syntaxToken = AddTrailingSkippedSyntax(syntaxToken, (GreenNode)(object)syntaxToken4); int width2 = ((GreenNode)syntaxToken4).Width; SyntaxDiagnosticInfo syntaxDiagnosticInfo3 = new SyntaxDiagnosticInfo(0, width2, ErrorCode.ERR_OvlOperatorExpected); SyntaxDiagnosticInfo syntaxDiagnosticInfo4 = new SyntaxDiagnosticInfo(0, width2, ErrorCode.WRN_ErrorOverride, syntaxDiagnosticInfo3, ((DiagnosticInfo)syntaxDiagnosticInfo3).Code); syntaxToken = WithAdditionalDiagnostics(syntaxToken, syntaxDiagnosticInfo4); } } else { syntaxToken = SyntaxFactory.Token(syntaxToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanToken, syntaxToken.Text + syntaxToken2.Text, syntaxToken.ValueText + syntaxToken2.ValueText, syntaxToken2.GetTrailingTrivia()); } } else if (base.CurrentToken.Kind == SyntaxKind.EqualsToken) { SyntaxToken syntaxToken5 = EatToken(); syntaxToken = SyntaxFactory.Token(syntaxToken.GetLeadingTrivia(), SyntaxKind.GreaterThanEqualsToken, syntaxToken.Text + syntaxToken5.Text, syntaxToken.ValueText + syntaxToken5.ValueText, syntaxToken5.GetTrailingTrivia()); } else if (base.CurrentToken.Kind == SyntaxKind.GreaterThanEqualsToken) { SyntaxToken syntaxToken6 = EatToken(); SyntaxToken syntaxToken7 = SyntaxFactory.Token(syntaxToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanEqualsToken, syntaxToken.Text + syntaxToken6.Text, syntaxToken.ValueText + syntaxToken6.ValueText, syntaxToken6.GetTrailingTrivia()); syntaxToken = SyntaxFactory.MissingToken(SyntaxKind.PlusToken); syntaxToken = AddTrailingSkippedSyntax(syntaxToken, (GreenNode)(object)syntaxToken7); int width3 = ((GreenNode)syntaxToken7).Width; SyntaxDiagnosticInfo syntaxDiagnosticInfo5 = new SyntaxDiagnosticInfo(0, width3, ErrorCode.ERR_OvlOperatorExpected); SyntaxDiagnosticInfo syntaxDiagnosticInfo6 = new SyntaxDiagnosticInfo(0, width3, ErrorCode.WRN_ErrorOverride, syntaxDiagnosticInfo5, ((DiagnosticInfo)syntaxDiagnosticInfo5).Code); syntaxToken = WithAdditionalDiagnostics(syntaxToken, syntaxDiagnosticInfo6); } } CrefParameterListSyntax parameters = ParseCrefParameterList(); return SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, syntaxToken, parameters); } private SyntaxToken TryEatCheckedKeyword(bool isConversion, ref SyntaxToken operatorKeyword) { SyntaxToken syntaxToken = tryEatCheckedOrHandleUnchecked(ref operatorKeyword); if (syntaxToken != null && (isConversion || SyntaxFacts.IsAnyOverloadableOperator(base.CurrentToken.Kind))) { syntaxToken = CheckFeatureAvailability(syntaxToken, MessageID.IDS_FeatureCheckedUserDefinedOperators, forceWarning: true); } return syntaxToken; SyntaxToken tryEatCheckedOrHandleUnchecked(ref SyntaxToken reference) { if (base.CurrentToken.Kind == SyntaxKind.UncheckedKeyword) { SyntaxToken skippedSyntax = AddErrorAsWarning(EatToken(), ErrorCode.ERR_MisplacedUnchecked); reference = AddTrailingSkippedSyntax(reference, (GreenNode)(object)skippedSyntax); return null; } return TryEatToken(SyntaxKind.CheckedKeyword); } } private ConversionOperatorMemberCrefSyntax ParseConversionOperatorMemberCref() { SyntaxToken implicitOrExplicitKeyword = EatToken(); SyntaxToken operatorKeyword = EatToken(SyntaxKind.OperatorKeyword); return SyntaxFactory.ConversionOperatorMemberCref(checkedKeyword: TryEatCheckedKeyword(isConversion: true, ref operatorKeyword), type: ParseCrefType(typeArgumentsMustBeIdentifiers: false), parameters: ParseCrefParameterList(), implicitOrExplicitKeyword: implicitOrExplicitKeyword, operatorKeyword: operatorKeyword); } private CrefParameterListSyntax ParseCrefParameterList() { return (CrefParameterListSyntax)ParseBaseCrefParameterList(useSquareBrackets: false); } private CrefBracketedParameterListSyntax ParseBracketedCrefParameterList() { return (CrefBracketedParameterListSyntax)ParseBaseCrefParameterList(useSquareBrackets: true); } private BaseCrefParameterListSyntax ParseBaseCrefParameterList(bool useSquareBrackets) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) SyntaxKind syntaxKind = (useSquareBrackets ? SyntaxKind.OpenBracketToken : SyntaxKind.OpenParenToken); SyntaxKind syntaxKind2 = (useSquareBrackets ? SyntaxKind.CloseBracketToken : SyntaxKind.CloseParenToken); if (base.CurrentToken.Kind != syntaxKind) { return null; } SyntaxToken syntaxToken = EatToken(syntaxKind); SeparatedSyntaxListBuilder val = _pool.AllocateSeparated(); try { while (base.CurrentToken.Kind == SyntaxKind.CommaToken || IsPossibleCrefParameter()) { val.Add(ParseCrefParameter()); if (base.CurrentToken.Kind != syntaxKind2) { SyntaxToken syntaxToken2 = EatToken(SyntaxKind.CommaToken); if (!((GreenNode)syntaxToken2).IsMissing || IsPossibleCrefParameter()) { val.AddSeparator((GreenNode)(object)syntaxToken2); } } } SyntaxToken syntaxToken3 = EatToken(syntaxKind2); return useSquareBrackets ? ((BaseCrefParameterListSyntax)SyntaxFactory.CrefBracketedParameterList(syntaxToken, SeparatedSyntaxListBuilder.op_Implicit(ref val), syntaxToken3)) : ((BaseCrefParameterListSyntax)SyntaxFactory.CrefParameterList(syntaxToken, SeparatedSyntaxListBuilder.op_Implicit(ref val), syntaxToken3)); } finally { _pool.Free(ref val); } } private bool IsPossibleCrefParameter() { SyntaxKind kind = base.CurrentToken.Kind; if (kind - 8360 <= (SyntaxKind)2 || kind == SyntaxKind.IdentifierToken) { return true; } return SyntaxFacts.IsPredefinedType(kind); } private CrefParameterSyntax ParseCrefParameter() { SyntaxToken syntaxToken = null; SyntaxKind kind = base.CurrentToken.Kind; if (kind - 8360 <= (SyntaxKind)2) { syntaxToken = EatToken(); } SyntaxToken readOnlyKeyword = null; if (base.CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword && syntaxToken != null) { if (syntaxToken.Kind != SyntaxKind.RefKeyword) { SyntaxToken skippedSyntax = AddErrorAsWarning(EatToken(), ErrorCode.ERR_RefReadOnlyWrongOrdering); syntaxToken = AddTrailingSkippedSyntax(syntaxToken, (GreenNode)(object)skippedSyntax); } else { readOnlyKeyword = EatToken(); } } TypeSyntax type = ParseCrefType(typeArgumentsMustBeIdentifiers: false); return SyntaxFactory.CrefParameter(syntaxToken, readOnlyKeyword, type); } private SimpleNameSyntax ParseCrefName(bool typeArgumentsMustBeIdentifiers) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) SyntaxToken identifier = EatToken(SyntaxKind.IdentifierToken); if (base.CurrentToken.Kind != SyntaxKind.LessThanToken) { return SyntaxFactory.IdentifierName(identifier); } SyntaxToken node = EatToken(); SeparatedSyntaxListBuilder val = _pool.AllocateSeparated(); try { while (true) { TypeSyntax typeSyntax = ParseCrefType(typeArgumentsMustBeIdentifiers); if (typeArgumentsMustBeIdentifiers && typeSyntax.Kind != SyntaxKind.IdentifierName) { typeSyntax = AddError(typeSyntax, ErrorCode.WRN_ErrorOverride, new SyntaxDiagnosticInfo(ErrorCode.ERR_TypeParamMustBeIdentifier), $"{81:d4}"); } val.Add(typeSyntax); SyntaxKind kind = base.CurrentToken.Kind; if (kind != SyntaxKind.CommaToken && kind != SyntaxKind.IdentifierToken && !SyntaxFacts.IsPredefinedType(base.CurrentToken.Kind)) { break; } val.AddSeparator((GreenNode)(object)EatToken(SyntaxKind.CommaToken)); } SyntaxToken greaterThanToken = EatToken(SyntaxKind.GreaterThanToken); node = CheckFeatureAvailability(node, MessageID.IDS_FeatureGenerics, forceWarning: true); return SyntaxFactory.GenericName(identifier, SyntaxFactory.TypeArgumentList(node, SeparatedSyntaxListBuilder.op_Implicit(ref val), greaterThanToken)); } finally { _pool.Free(ref val); } } private TypeSyntax ParseCrefType(bool typeArgumentsMustBeIdentifiers, bool checkForMember = false) { TypeSyntax typeSyntax = ParseCrefTypeHelper(typeArgumentsMustBeIdentifiers, checkForMember); if (!typeArgumentsMustBeIdentifiers) { return ParseCrefTypeSuffix(typeSyntax); } return typeSyntax; } private TypeSyntax ParseCrefTypeHelper(bool typeArgumentsMustBeIdentifiers, bool checkForMember = false) { if (SyntaxFacts.IsPredefinedType(base.CurrentToken.Kind)) { return SyntaxFactory.PredefinedType(EatToken()); } NameSyntax nameSyntax; if (base.CurrentToken.Kind == SyntaxKind.IdentifierToken && PeekToken(1).Kind == SyntaxKind.ColonColonToken) { SyntaxToken syntaxToken = EatToken(); if (syntaxToken.ContextualKind == SyntaxKind.GlobalKeyword) { syntaxToken = SyntaxParser.ConvertToKeyword(syntaxToken); } syntaxToken = CheckFeatureAvailability(syntaxToken, MessageID.IDS_FeatureGlobalNamespace, forceWarning: true); SyntaxToken colonColonToken = EatToken(); SimpleNameSyntax name = ParseCrefName(typeArgumentsMustBeIdentifiers); nameSyntax = SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(syntaxToken), colonColonToken, name); } else { ResetPoint point = GetResetPoint(); nameSyntax = ParseCrefName(typeArgumentsMustBeIdentifiers); if (checkForMember && (((GreenNode)nameSyntax).IsMissing || base.CurrentToken.Kind != SyntaxKind.DotToken)) { Reset(ref point); Release(ref point); return null; } Release(ref point); } while (base.CurrentToken.Kind == SyntaxKind.DotToken) { ResetPoint point2 = GetResetPoint(); SyntaxToken dotToken = EatToken(); SimpleNameSyntax simpleNameSyntax = ParseCrefName(typeArgumentsMustBeIdentifiers); if (checkForMember && (((GreenNode)simpleNameSyntax).IsMissing || base.CurrentToken.Kind != SyntaxKind.DotToken)) { Reset(ref point2); Release(ref point2); return nameSyntax; } Release(ref point2); nameSyntax = SyntaxFactory.QualifiedName(nameSyntax, dotToken, simpleNameSyntax); } return nameSyntax; } private TypeSyntax ParseCrefTypeSuffix(TypeSyntax type) { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (base.CurrentToken.Kind == SyntaxKind.QuestionToken) { type = SyntaxFactory.NullableType(type, EatToken()); } while (base.CurrentToken.Kind == SyntaxKind.AsteriskToken) { type = SyntaxFactory.PointerType(type, EatToken()); } if (base.CurrentToken.Kind == SyntaxKind.OpenBracketToken) { OmittedArraySizeExpressionSyntax omittedArraySizeExpressionSyntax = SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); SyntaxListBuilder val = _pool.Allocate(); try { while (base.CurrentToken.Kind == SyntaxKind.OpenBracketToken) { SyntaxToken openBracketToken = EatToken(); SeparatedSyntaxListBuilder val2 = _pool.AllocateSeparated(); try { while (base.CurrentToken.Kind != SyntaxKind.CloseBracketToken && base.CurrentToken.Kind == SyntaxKind.CommaToken) { val2.Add((ExpressionSyntax)omittedArraySizeExpressionSyntax); val2.AddSeparator((GreenNode)(object)EatToken()); } if ((val2.Count & 1) == 0) { val2.Add((ExpressionSyntax)omittedArraySizeExpressionSyntax); } SyntaxToken closeBracketToken = EatToken(SyntaxKind.CloseBracketToken); val.Add(SyntaxFactory.ArrayRankSpecifier(openBracketToken, SeparatedSyntaxListBuilder.op_Implicit(ref val2), closeBracketToken)); } finally { _pool.Free(ref val2); } } type = SyntaxFactory.ArrayType(type, SyntaxListBuilder.op_Implicit(val)); } finally { _pool.Free(SyntaxListBuilder.op_Implicit(val)); } } return type; } private IdentifierNameSyntax ParseNameAttributeValue() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) SyntaxToken syntaxToken = EatToken(SyntaxKind.IdentifierToken, reportError: false); if (!IsEndOfNameAttribute) { SyntaxListBuilder val = _pool.Allocate(); while (!IsEndOfNameAttribute) { val.Add(EatToken()); } syntaxToken = AddTrailingSkippedSyntax(syntaxToken, val.ToListNode()); _pool.Free(SyntaxListBuilder.op_Implicit(val)); } return SyntaxFactory.IdentifierName(syntaxToken); } }