/// <summary> /// Given an existing left hand side node or token, parse a qualified name if possible. Returns /// null with success if a dot token is not available /// </summary> private Result <StackFrameQualifiedNameNode> TryParseQualifiedName(StackFrameNameNode lhs) { if (!_lexer.ScanCurrentCharAsTokenIfMatch(StackFrameKind.DotToken, out var dotToken)) { return(Result <StackFrameQualifiedNameNode> .Empty); } // Check if this is a generated identifier (var success, StackFrameSimpleNameNode? rhs) = TryScanGeneratedName(); if (!success) { return(Result <StackFrameQualifiedNameNode> .Abort); } if (rhs is not null) { return(new StackFrameQualifiedNameNode(lhs, dotToken, rhs)); } // The identifier is not a generated name, parse as a normal identifier and check for generics var identifier = _lexer.TryScanIdentifier(); if (!identifier.HasValue) { return(Result <StackFrameQualifiedNameNode> .Abort); } (success, rhs) = TryScanGenericTypeIdentifier(identifier.Value); if (!success) { return(Result <StackFrameQualifiedNameNode> .Abort); } RoslynDebug.AssertNotNull(rhs); return(new StackFrameQualifiedNameNode(lhs, dotToken, rhs)); }
/// <summary> /// Given an existing left hand side node or token, parse a qualified name if possible. Returns /// null with success if a dot token is not available /// </summary> private Result <StackFrameQualifiedNameNode> TryParseQualifiedName(StackFrameNameNode lhs) { if (!_lexer.ScanCurrentCharAsTokenIfMatch(StackFrameKind.DotToken, out var dotToken)) { return(Result <StackFrameQualifiedNameNode> .Empty); } var identifier = _lexer.TryScanIdentifier(); if (!identifier.HasValue) { return(Result <StackFrameQualifiedNameNode> .Abort); } var(success, rhs) = TryScanGenericTypeIdentifier(identifier.Value); if (!success) { return(Result <StackFrameQualifiedNameNode> .Abort); } RoslynDebug.AssertNotNull(rhs); return(new StackFrameQualifiedNameNode(lhs, dotToken, rhs)); }