/// <summary> /// Get the proper end position based on the span marker type. /// </summary> private int GetNextTokenEndPosition(SpanMarkerType spanMarkerType, SyntaxToken nextToken) { Contract.ThrowIfTrue(spanMarkerType == SpanMarkerType.BeginningOfFile); Contract.ThrowIfTrue(nextToken.RawKind == 0); if (spanMarkerType == SpanMarkerType.Normal) { return(nextToken.GetPreviousToken(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true).Span.End); } return(nextToken.Span.End); }
public SpanMarker(SpanMarkerType type = SpanMarkerType.Normal, SpanMarkerType oppositeMarkerType = SpanMarkerType.Normal) : this(type, oppositeMarkerType, new SyntaxAnnotation(AnnotationId, string.Format("{0} {1}", type, oppositeMarkerType))) { }
private SpanMarker(SpanMarkerType type, SpanMarkerType oppositeMarkerType, SyntaxAnnotation annotation) { this.Type = type; this.OppositeMarkerType = oppositeMarkerType; this.Annotation = annotation; }
/// <summary> /// get proper end position based on span marker type /// </summary> private int GetNextTokenEndPosition(SpanMarkerType spanMarkerType, SyntaxToken nextToken) { Contract.ThrowIfTrue(spanMarkerType == SpanMarkerType.BeginningOfFile); Contract.ThrowIfTrue(nextToken.RawKind == 0); if (spanMarkerType == SpanMarkerType.Normal) { return nextToken.GetPreviousToken(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true).Span.End; } return nextToken.Span.End; }