private bool ScanCast()
{
if (Current.Kind != SyntaxKind.OpenParenToken)
return false;
NextToken();
var type = ScanType();
if (type == ScanTypeFlags.NotType)
return false;
if (Current.Kind != SyntaxKind.CloseParenToken)
return false;
if (type == ScanTypeFlags.MustBeType)
return true;
NextToken();
// check for ambiguous type or expression followed by disambiguating token. i.e.
//
// "(A)b" is a cast. But "(A)+b" is not a cast.
return (type == ScanTypeFlags.TypeOrExpression) && SyntaxFacts.CanFollowCast(Current.Kind);
}