forked from jasder/antlr
Add Runtime.Substring and Arrays.CopyOf
This commit is contained in:
parent
3ba462d403
commit
8d4c3252f5
|
@ -145,6 +145,8 @@
|
||||||
<Compile Include="RecognitionException.cs" />
|
<Compile Include="RecognitionException.cs" />
|
||||||
<Compile Include="Recognizer`2.cs" />
|
<Compile Include="Recognizer`2.cs" />
|
||||||
<Compile Include="RuleContext.cs" />
|
<Compile Include="RuleContext.cs" />
|
||||||
|
<Compile Include="Sharpen\Arrays.cs" />
|
||||||
|
<Compile Include="Sharpen\Runtime.cs" />
|
||||||
<Compile Include="TokenStreamRewriter.cs" />
|
<Compile Include="TokenStreamRewriter.cs" />
|
||||||
<Compile Include="Tree\AbstractParseTreeVisitor`1.cs" />
|
<Compile Include="Tree\AbstractParseTreeVisitor`1.cs" />
|
||||||
<Compile Include="Tree\ErrorNodeImpl.cs" />
|
<Compile Include="Tree\ErrorNodeImpl.cs" />
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Sharpen
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
|
||||||
|
internal static class Arrays
|
||||||
|
{
|
||||||
|
public static T[] CopyOf<T>(T[] array, int newSize)
|
||||||
|
{
|
||||||
|
Array.Resize(ref array, newSize);
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace Sharpen
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
|
||||||
|
internal static class Runtime
|
||||||
|
{
|
||||||
|
public static string Substring(string str, int beginOffset, int endOffset)
|
||||||
|
{
|
||||||
|
if (str == null)
|
||||||
|
throw new ArgumentNullException("str");
|
||||||
|
|
||||||
|
return str.Substring(beginOffset, endOffset - beginOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue