예제 #1
0
        protected SyntaxToken InsertMissingToken(SyntaxKind preferred, SyntaxKind[] otherOptions)
        {
            var missingTokenSourceRange = new SourceRange(Current.FullSourceRange.Start, 0);

            var diagnosticSpan = GetDiagnosticSourceRangeForMissingToken();
            var diagnostics    = new List <Diagnostic>(1);

            diagnostics.ReportTokenExpectedMultipleChoices(diagnosticSpan, Current, new[] { preferred }.Concat(otherOptions));

            return(SyntaxToken.CreateMissing(preferred, missingTokenSourceRange, GetSourceFileSpan(missingTokenSourceRange)).WithDiagnostics(diagnostics));
        }
예제 #2
0
        protected SyntaxToken InsertMissingToken(SyntaxKind kind)
        {
            var missingTokenSourceRange = new SourceRange(Current.FullSourceRange.Start, 0);

            var diagnosticSpan = GetDiagnosticSourceRangeForMissingToken();
            var diagnostics    = new List <Diagnostic>(1);

            diagnostics.ReportTokenExpected(diagnosticSpan, Current, kind);

            return(SyntaxToken.CreateMissing(kind, missingTokenSourceRange, GetSourceFileSpan(missingTokenSourceRange)).WithDiagnostics(diagnostics));
        }
예제 #3
0
 internal static SyntaxToken MissingToken(SyntaxKind kind, params RazorDiagnostic[] diagnostics)
 {
     return(SyntaxToken.CreateMissing(kind, diagnostics));
 }