forked from jasder/antlr
Map IndexOutOfRangeException to ArgumentOutOfRangeException
This commit is contained in:
parent
8ab7c20411
commit
12d092143f
|
@ -67,12 +67,12 @@ namespace Antlr4.Runtime.Atn
|
|||
|
||||
public override PredictionContext GetParent(int index)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
public override int GetReturnState(int index)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
public override int FindReturnState(int returnState)
|
||||
|
|
|
@ -242,8 +242,8 @@ namespace Antlr4.Runtime
|
|||
{
|
||||
if (i < 0 || i >= tokens.Count)
|
||||
{
|
||||
throw new IndexOutOfRangeException("token index " + i + " out of range 0.." + (tokens
|
||||
.Count - 1));
|
||||
throw new ArgumentOutOfRangeException("token index " + i + " out of range 0.." +
|
||||
(tokens.Count - 1));
|
||||
}
|
||||
return tokens[i];
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ namespace Antlr4.Runtime
|
|||
LazyInit();
|
||||
if (start < 0 || stop >= tokens.Count || stop < 0 || start >= tokens.Count)
|
||||
{
|
||||
throw new IndexOutOfRangeException("start " + start + " or stop " + stop + " not in 0.."
|
||||
throw new ArgumentOutOfRangeException("start " + start + " or stop " + stop + " not in 0.."
|
||||
+ (tokens.Count - 1));
|
||||
}
|
||||
if (start > stop)
|
||||
|
@ -494,8 +494,8 @@ namespace Antlr4.Runtime
|
|||
LazyInit();
|
||||
if (tokenIndex < 0 || tokenIndex >= tokens.Count)
|
||||
{
|
||||
throw new IndexOutOfRangeException(tokenIndex + " not in 0.." + (tokens.Count - 1
|
||||
));
|
||||
throw new ArgumentOutOfRangeException(tokenIndex + " not in 0.." + (tokens.Count
|
||||
- 1));
|
||||
}
|
||||
int nextOnChannel = NextTokenOnChannel(tokenIndex + 1, Lexer.DefaultTokenChannel);
|
||||
int to;
|
||||
|
@ -539,8 +539,8 @@ namespace Antlr4.Runtime
|
|||
LazyInit();
|
||||
if (tokenIndex < 0 || tokenIndex >= tokens.Count)
|
||||
{
|
||||
throw new IndexOutOfRangeException(tokenIndex + " not in 0.." + (tokens.Count - 1
|
||||
));
|
||||
throw new ArgumentOutOfRangeException(tokenIndex + " not in 0.." + (tokens.Count
|
||||
- 1));
|
||||
}
|
||||
int prevOnChannel = PreviousTokenOnChannel(tokenIndex - 1, Lexer.DefaultTokenChannel
|
||||
);
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace Antlr4.Runtime
|
|||
int index = p + i - 1;
|
||||
if (index < 0)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (index > n)
|
||||
{
|
||||
|
|
|
@ -147,7 +147,7 @@ namespace Antlr4.Runtime
|
|||
int bufferStartIndex = GetBufferStartIndex();
|
||||
if (i < bufferStartIndex || i >= bufferStartIndex + n)
|
||||
{
|
||||
throw new IndexOutOfRangeException("get(" + i + ") outside buffer: " + bufferStartIndex
|
||||
throw new ArgumentOutOfRangeException("get(" + i + ") outside buffer: " + bufferStartIndex
|
||||
+ ".." + (bufferStartIndex + n));
|
||||
}
|
||||
return tokens[i - bufferStartIndex];
|
||||
|
@ -163,7 +163,7 @@ namespace Antlr4.Runtime
|
|||
int index = p + i - 1;
|
||||
if (index < 0)
|
||||
{
|
||||
throw new IndexOutOfRangeException("LT(" + i + ") gives negative index");
|
||||
throw new ArgumentOutOfRangeException("LT(" + i + ") gives negative index");
|
||||
}
|
||||
if (index >= n)
|
||||
{
|
||||
|
|
|
@ -179,6 +179,7 @@
|
|||
|
||||
-typeMapping org.antlr.v4.runtime.misc.ParseCancellationException ParseCanceledException
|
||||
-typeMapping java.util.concurrent.CancellationException System.OperationCanceledException
|
||||
-typeMapping java.lang.IndexOutOfBoundsException ArgumentOutOfRangeException
|
||||
|
||||
-typeMapping org.antlr.v4.runtime.misc.Tuple System.Tuple
|
||||
-typeMapping org.antlr.v4.runtime.misc.Tuple2<,> System.Tuple
|
||||
|
|
Loading…
Reference in New Issue