コード例 #1
0
ファイル: LineDirectiveMap.cs プロジェクト: nullai/LeeLang
        protected FileLinePositionSpan TranslateSpan(LineMappingEntry entry, string treeFilePath, LinePosition unmappedStartPos, LinePosition unmappedEndPos)
        {
            string path            = entry.MappedPathOpt ?? treeFilePath;
            int    mappedStartLine = unmappedStartPos.Line - entry.UnmappedLine + entry.MappedLine;
            int    mappedEndLine   = unmappedEndPos.Line - entry.UnmappedLine + entry.MappedLine;

            return(new FileLinePositionSpan(
                       path,
                       new LinePositionSpan(
                           (mappedStartLine == -1) ? new LinePosition(unmappedStartPos.Character) : new LinePosition(mappedStartLine, unmappedStartPos.Character),
                           (mappedEndLine == -1) ? new LinePosition(unmappedEndPos.Character) : new LinePosition(mappedEndLine, unmappedEndPos.Character)),
                       hasMappedPath: entry.MappedPathOpt != null));
        }
コード例 #2
0
 /// <summary>
 /// Initializes the <see cref="FileLinePositionSpan"/> instance.
 /// </summary>
 /// <param name="path">The file identifier - typically a relative or absolute path.</param>
 /// <param name="start">The start line position.</param>
 /// <param name="end">The end line position.</param>
 /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
 public FileLinePositionSpan(string path, LinePosition start, LinePosition end)
     : this(path, new LinePositionSpan(start, end))
 {
 }