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);