コード例 #1
0
        public static SourceLocation ToSourceLocation(this Position position, ILocationConverter lc = null)
        {
            var location = new SourceLocation(position.line + 1, position.character + 1);

            if (lc == null)
            {
                return(location);
            }

            return(new SourceLocation(lc.LocationToIndex(location), location.Line, location.Column));
        }
コード例 #2
0
 public static IndexSpan ToIndexSpan(this Range range, ILocationConverter lc)
 => IndexSpan.FromBounds(lc.LocationToIndex(range.start), lc.LocationToIndex(range.end));
コード例 #3
0
 public static IndexSpan ToIndexSpan(this SourceSpan span, ILocationConverter lc)
 => IndexSpan.FromBounds(lc.LocationToIndex(span.Start), lc.LocationToIndex(span.End));
コード例 #4
0
 public static int ToIndex(this SourceLocation location, ILocationConverter lc) => lc.LocationToIndex(location);