Merge branch 'master' of github.com:antlr/antlr4

This commit is contained in:
parrt 2018-12-17 14:43:34 -08:00
commit 9f6dfb1809
2 changed files with 7 additions and 6 deletions

View File

@ -190,6 +190,7 @@ YYYY/MM/DD, github id, Full name, email
2018/02/11, io7m, Mark Raynsford, code@io7m.com
2018/04/24, solussd, Joe Smith, joe@uwcreations.com
2018/15/05, johnvanderholt, jan dillingh johnvanderholte@gmail.com
2018/06/14, scadgek, Sergey Chupov, scadgek@live.com
2018/06/16, EternalPhane, Zongyuan Zuo, eternalphane@gmail.com
2018/06/27, wu-sheng, Wu Sheng, wu.sheng@foxmail.com
2018/02/25, chaseoxide, Marcus Ong, taccs97[at]gmail[dot]com
@ -202,7 +203,7 @@ YYYY/MM/DD, github id, Full name, email
2018/06/16, EternalPhane, Zongyuan Zuo, eternalphane@gmail.com
2018/07/03, jgoppert, James Goppert, james.goppert@gmail.com
2018/07/27, Maksim Novikov, mnovikov.work@gmail.com
2018/07/31 Lucas Henrqiue, lucashenrique580@gmail.com
2018/07/31, Lucas Henrqiue, lucashenrique580@gmail.com
2018/08/03, ENDOH takanao, djmchl@gmail.com
2018/10/29, chrisaycock, Christopher Aycock, chris[at]chrisaycock[dot]com
2018/11/12, vinoski, Steve Vinoski, vinoski@ieee.org

View File

@ -203,8 +203,8 @@ public abstract class CodePointCharStream implements CharStream {
/** Return the UTF-16 encoded string for the given interval */
@Override
public String getText(Interval interval) {
int startIdx = Math.min(interval.a, size - 1);
int len = Math.min(interval.b - interval.a + 1, size);
int startIdx = Math.min(interval.a, size);
int len = Math.min(interval.b - interval.a + 1, size - startIdx);
// We know there are no surrogates in this
// array, since otherwise we would be given a
@ -258,8 +258,8 @@ public abstract class CodePointCharStream implements CharStream {
/** Return the UTF-16 encoded string for the given interval */
@Override
public String getText(Interval interval) {
int startIdx = Math.min(interval.a, size - 1);
int len = Math.min(interval.b - interval.a + 1, size);
int startIdx = Math.min(interval.a, size);
int len = Math.min(interval.b - interval.a + 1, size - startIdx);
// Note that we pass the int[] code points to the String constructor --
// this is supported, and the constructor will convert to UTF-16 internally.