private Token toPrefixToken(ILeafNode leaf){
  Lexer lexer=new InternalN4JSLexer();
  String text=leaf.getText();
  String prefix=text.substring(0,endOffset - leaf.getTotalOffset());
  ANTLRStringStream stream=new ANTLRStringStream(prefix);
  lexer.setCharStream(stream);
  Token nextToken=lexer.nextToken();
  return new CommonToken(nextToken.getType(),nextToken.getText());
}

private Token toPrefixToken ( ILeafNode leaf ) { Lexer lexer = new InternalN4JSLexer ( ) ; String text = leaf . getText ( ) ; String prefix = text . substring ( 0 , endOffset - leaf . getTotalOffset ( ) ) ; ANTLRStringStream stream = new ANTLRStringStream ( prefix ) ; lexer . setCharStream ( stream ) ; Token nextToken = lexer . nextToken ( ) ; return new CommonToken ( nextToken . getType ( ) , nextToken . getText ( ) ) ; }
produce an antlr token for the prefix of the given leaf that overlaps the requested region
