private static LineMappingEntry GetLineSpanDirectiveEntry(LineSpanDirectiveTriviaSyntax spanDirective, int unmappedLine)
 {
     if (!spanDirective.HasErrors &&
         tryGetPosition(spanDirective.Start, isEnd: false, out LinePosition mappedStart) &&
         tryGetPosition(spanDirective.End, isEnd: true, out LinePosition mappedEnd) &&
         tryGetOptionalCharacterOffset(spanDirective.CharacterOffset, out int?characterOffset) &&
         tryGetStringLiteralValue(spanDirective.File, out string?mappedPathOpt))
     {
         return(new LineMappingEntry(unmappedLine, new LinePositionSpan(mappedStart, mappedEnd), characterOffset, mappedPathOpt));
     }
     return(new LineMappingEntry(unmappedLine, unmappedLine, mappedPathOpt: null, PositionState.Unmapped));
Exemple #2
0
 private void ClassifyLineSpanDirective(LineSpanDirectiveTriviaSyntax node)
 {
     AddClassification(node.HashToken, ClassificationTypeNames.PreprocessorKeyword);
     AddClassification(node.LineKeyword, ClassificationTypeNames.PreprocessorKeyword);
     ClassifyLineDirectivePosition(node.Start);
     AddClassification(node.MinusToken, ClassificationTypeNames.Operator);
     ClassifyLineDirectivePosition(node.End);
     AddOptionalClassification(node.CharacterOffset, ClassificationTypeNames.NumericLiteral);
     AddOptionalClassification(node.File, ClassificationTypeNames.StringLiteral);
     ClassifyDirectiveTrivia(node);
 }
 public override void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node)
 {
     Log(node, "Unsupported Syntax !");
 }