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)); }
public static IndexSpan ToIndexSpan(this Range range, ILocationConverter lc) => IndexSpan.FromBounds(lc.LocationToIndex(range.start), lc.LocationToIndex(range.end));
public static IndexSpan ToIndexSpan(this SourceSpan span, ILocationConverter lc) => IndexSpan.FromBounds(lc.LocationToIndex(span.Start), lc.LocationToIndex(span.End));
public static int ToIndex(this SourceLocation location, ILocationConverter lc) => lc.LocationToIndex(location);