export interface LocalCodeLocation { line : number ; column : number ; } export type CodeLocation = LocalCodeLocation ; export interface CodeLocationRange { start : CodeLocation ; end : CodeLocation ; } export const rangesEqual = ( a , b ) => a . line === b . line && a . column === b . column ; export const rangesIntervalEqual = ( a , b ) => rangesEqual ( a . start , b . start ) && rangesEqual ( a . end , b . end ) ; export const localRangeMin = ( v , max ) : CodeLocation => { if ( v . line < max . line ) { return v ; } if ( v . line === max . line ) { return { line : v . line , column : Math . min ( v . column , max . column ) , } ; } return { ... max , } ; } ; export const localRangeMax = ( v , min ) : CodeLocation => { if ( v . line > min . line ) { return v ; } if ( v . line === min . line ) { return { line : v . line , column : Math . max ( v . column , min . column ) , } ; } return { ... min , } ; } ; export const createRange = ( line , column ) : CodeLocation => ( { line , column , } ) ;