Updated to latest reference build of ANTLR 4

This commit is contained in:
Sam Harwell 2013-02-26 11:14:46 -06:00
parent 54c4bc826f
commit e0b1d7dd26
3 changed files with 20 additions and 14 deletions

@ -1 +1 @@
Subproject commit a1b85fb2ae7d6475ca83559f47978f2fefd13e4f Subproject commit 873001d30c2baa6148783f2ce3be1044c5275d7d

View File

@ -197,11 +197,14 @@ namespace Antlr4.Runtime.Dfa
public virtual DFAState GetTarget(int symbol) public virtual DFAState GetTarget(int symbol)
{ {
if (edges == null) lock (this)
{ {
return null; if (edges == null)
{
return null;
}
return edges[symbol];
} }
return edges[symbol];
} }
public virtual void SetTarget(int symbol, DFAState target) public virtual void SetTarget(int symbol, DFAState target)
@ -230,15 +233,18 @@ namespace Antlr4.Runtime.Dfa
public virtual DFAState GetContextTarget(int invokingState) public virtual DFAState GetContextTarget(int invokingState)
{ {
if (contextEdges == null) lock (this)
{ {
return null; if (contextEdges == null)
{
return null;
}
if (invokingState == PredictionContext.EmptyFullStateKey)
{
invokingState = -1;
}
return contextEdges[invokingState];
} }
if (invokingState == PredictionContext.EmptyFullStateKey)
{
invokingState = -1;
}
return contextEdges[invokingState];
} }
public virtual void SetContextTarget(int invokingState, DFAState target) public virtual void SetContextTarget(int invokingState, DFAState target)

View File

@ -234,7 +234,7 @@ namespace Antlr4.Runtime
{ {
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
if (this.n > 0 && data[this.n - 1] == IntStreamConstants.Eof) if (this.n > 0 && data[this.n - 1] == (char)IntStreamConstants.Eof)
{ {
return i; return i;
} }
@ -284,7 +284,7 @@ namespace Antlr4.Runtime
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
if (index > n) if (index >= n)
{ {
return IntStreamConstants.Eof; return IntStreamConstants.Eof;
} }
@ -432,7 +432,7 @@ namespace Antlr4.Runtime
if (interval.a < bufferStartIndex || interval.b >= bufferStartIndex + n) if (interval.a < bufferStartIndex || interval.b >= bufferStartIndex + n)
{ {
throw new NotSupportedException("interval " + interval + " outside buffer: " + bufferStartIndex throw new NotSupportedException("interval " + interval + " outside buffer: " + bufferStartIndex
+ ".." + (bufferStartIndex + n)); + ".." + (bufferStartIndex + n - 1));
} }
// convert from absolute to local index // convert from absolute to local index
int i = interval.a - bufferStartIndex; int i = interval.a - bufferStartIndex;