diff --git a/contributors.txt b/contributors.txt index ebfee2365..230e494f2 100644 --- a/contributors.txt +++ b/contributors.txt @@ -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,10 +203,10 @@ 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 2018/11/14, nxtstep, Adriaan (Arjan) Duz, codewithadriaan[et]gmail[dot]com 2018/11/15, amykyta3, Alex Mykyta, amykyta3@users.noreply.github.com -2018/11/29, hannemann-tamas, Ralf Hannemann-Tamas, ralf.ht@gmail.com +2018/11/29, hannemann-tamas, Ralf Hannemann-Tamas, ralf.ht@gmail.com \ No newline at end of file diff --git a/runtime/Java/src/org/antlr/v4/runtime/CodePointCharStream.java b/runtime/Java/src/org/antlr/v4/runtime/CodePointCharStream.java index 107faa7b1..241354556 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/CodePointCharStream.java +++ b/runtime/Java/src/org/antlr/v4/runtime/CodePointCharStream.java @@ -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.