public SourceLocation substringLocation ( int start , int end ) { checkElementIndex ( start , rawText . length ( ) , "start" ) ; checkArgument ( start < end ) ; checkArgument ( end <= rawText . length ( ) ) ; if ( offsets == null ) { return getSourceLocation ( ) ; } return new SourceLocation ( getSourceLocation ( ) . getFilePath ( ) , offsets . getPoint ( rawText , start ) , // source locations are inclusive, the end locations should point at the last character // in the string, whereas substring is usually specified exclusively, so subtract 1 to make // up the difference offsets . getPoint ( rawText , end - 1 ) ) ; }
Returns the source location of the given substring .