diff options
Diffstat (limited to 'runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions')
18 files changed, 0 insertions, 2048 deletions
diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Antlr3.Runtime.JavaExtensions.csproj b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Antlr3.Runtime.JavaExtensions.csproj deleted file mode 100644 index 2c90504..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Antlr3.Runtime.JavaExtensions.csproj +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{A7EEC557-EB14-451C-9616-B7A61F4ECE69}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Antlr3.Runtime.JavaExtensions</RootNamespace> - <AssemblyName>Antlr3.Runtime.JavaExtensions</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <TargetFrameworkProfile>Client</TargetFrameworkProfile> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup> - <SignAssembly>true</SignAssembly> - </PropertyGroup> - <PropertyGroup> - <AssemblyOriginatorKeyFile>..\..\..\..\..\..\..\..\..\keys\antlr\Key.snk</AssemblyOriginatorKeyFile> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="DictionaryExtensions.cs" /> - <Compile Include="ExceptionExtensions.cs" /> - <Compile Include="IOExtensions.cs" /> - <Compile Include="LexerExtensions.cs" /> - <Compile Include="JSystem.cs" /> - <Compile Include="ListExtensions.cs" /> - <Compile Include="ObjectExtensions.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="SetExtensions.cs" /> - <Compile Include="StackExtensions.cs" /> - <Compile Include="StringBuilderExtensions.cs" /> - <Compile Include="StringExtensions.cs" /> - <Compile Include="StringTokenizer.cs" /> - <Compile Include="SubList.cs" /> - <Compile Include="TreeExtensions.cs" /> - <Compile Include="TypeExtensions.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\Antlr3.Runtime\Antlr3.Runtime.csproj"> - <Project>{8FDC0A87-9005-4D5A-AB75-E55CEB575559}</Project> - <Name>Antlr3.Runtime</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <None Include="..\..\..\..\..\..\..\..\..\keys\antlr\Key.snk"> - <Link>Key.snk</Link> - </None> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project>
\ No newline at end of file diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Antlr3.Runtime.JavaExtensions.csproj.vspscc b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Antlr3.Runtime.JavaExtensions.csproj.vspscc deleted file mode 100644 index b27adcc..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Antlr3.Runtime.JavaExtensions.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "relative:antlr\\main\\runtime\\CSharp3\\Sources\\Antlr3.Runtime.JavaExtensions" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/DictionaryExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/DictionaryExtensions.cs deleted file mode 100644 index cd32ce9..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/DictionaryExtensions.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace Antlr.Runtime.JavaExtensions -{ - using System.Collections.Generic; - using System.Linq; - - using IDictionary = System.Collections.IDictionary; - using ObsoleteAttribute = System.ObsoleteAttribute; - - public static class DictionaryExtensions - { - [Obsolete] - public static bool containsKey( this IDictionary map, object key ) - { - return map.Contains( key ); - } - - [Obsolete] - public static object get( this IDictionary map, object key ) - { - return map[key]; - } - - public static TValue get<TKey, TValue>( this IDictionary<TKey, TValue> map, TKey key ) - { - TValue value; - if ( map.TryGetValue( key, out value ) ) - return value; - - if ( typeof( TValue ).IsValueType ) - throw new KeyNotFoundException(); - - return default( TValue ); - } - - // disambiguates - public static TValue get<TKey, TValue>( this Dictionary<TKey, TValue> map, TKey key ) - { - TValue value; - if ( map.TryGetValue( key, out value ) ) - return value; - - if ( typeof( TValue ).IsValueType ) - throw new KeyNotFoundException(); - - return default( TValue ); - } - - public static TValue get<TKey, TValue>( this SortedList<TKey, TValue> map, TKey key ) - { - TValue value; - if ( map.TryGetValue( key, out value ) ) - return value; - - if ( typeof( TValue ).IsValueType ) - throw new KeyNotFoundException(); - - return default( TValue ); - } - - [Obsolete] - public static void put( this IDictionary map, object key, object value ) - { - map[key] = value; - } - - [Obsolete] - public static void put<TKey, TValue>( this IDictionary<TKey, TValue> map, TKey key, TValue value ) - { - map[key] = value; - } - - [Obsolete] - public static void put<TKey, TValue>( this Dictionary<TKey, TValue> map, TKey key, TValue value ) - { - map[key] = value; - } - - [Obsolete] - public static HashSet<object> keySet( this IDictionary map ) - { - return new HashSet<object>( map.Keys.Cast<object>() ); - } - - [Obsolete] - public static HashSet<TKey> keySet<TKey, TValue>( this IDictionary<TKey, TValue> map ) - { - return new HashSet<TKey>( map.Keys ); - } - - // disambiguates for Dictionary, which implements both IDictionary<T,K> and IDictionary - [Obsolete] - public static HashSet<TKey> keySet<TKey, TValue>( this Dictionary<TKey, TValue> map ) - { - return new HashSet<TKey>( map.Keys ); - } - - [Obsolete] - public static HashSet<object> keySet<TKey, TValue>( this SortedList<TKey, TValue> map ) - { - return new HashSet<object>( map.Keys.Cast<object>() ); - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ExceptionExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ExceptionExtensions.cs deleted file mode 100644 index 65696c8..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ExceptionExtensions.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Diagnostics; -using System.Linq; - -using TargetInvocationException = System.Reflection.TargetInvocationException; - -namespace Antlr.Runtime.JavaExtensions -{ - public static class ExceptionExtensions - { -#if DEBUG - [Obsolete] - public static string getMessage( this Exception e ) - { - return e.Message; - } -#endif - - public static StackFrame[] getStackTrace( this Exception e ) - { - StackTrace trace = new StackTrace( e, true ); - StackFrame[] frames = trace.GetFrames(); - if ( frames == null ) - { - // don't include this helper function in the trace - frames = new StackTrace( true ).GetFrames().Skip( 1 ).ToArray(); - } - return frames; - } - -#if DEBUG - [Obsolete] - public static string getMethodName( this StackFrame frame ) - { - return frame.GetMethod().Name; - } - - [Obsolete] - public static string getClassName( this StackFrame frame ) - { - return frame.GetMethod().DeclaringType.Name; - } -#endif - - public static void PrintStackTrace( this Exception e ) - { - e.PrintStackTrace( Console.Out ); - } - public static void PrintStackTrace( this Exception e, System.IO.TextWriter writer ) - { - writer.WriteLine( e.ToString() ); - string trace = e.StackTrace ?? string.Empty; - foreach ( string line in trace.Split( '\n', '\r' ) ) - { - if ( !string.IsNullOrEmpty( line ) ) - writer.WriteLine( " " + line ); - } - } - -#if DEBUG - [Obsolete] - public static Exception getTargetException( this TargetInvocationException e ) - { - return e.InnerException ?? e; - } -#endif - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/IOExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/IOExtensions.cs deleted file mode 100644 index 52b529c..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/IOExtensions.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008-2009 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace Antlr.Runtime.JavaExtensions -{ - using System; - - using TextReader = System.IO.TextReader; - using TextWriter = System.IO.TextWriter; - - public static class IOExtensions - { - [Obsolete] - public static void close( this TextReader reader ) - { - reader.Close(); - } - - [Obsolete] - public static void close( this TextWriter writer ) - { - writer.Close(); - } - - [Obsolete] - public static void print<T>( this TextWriter writer, T value ) - { - writer.Write( value ); - } - - [Obsolete] - public static void println( this TextWriter writer ) - { - writer.WriteLine(); - } - - [Obsolete] - public static void println<T>( this TextWriter writer, T value ) - { - writer.WriteLine( value ); - } - - [Obsolete] - public static void write<T>( this TextWriter writer, T value ) - { - writer.Write( value ); - } - - [Obsolete] - public static int read( this TextReader reader, char[] buffer, int index, int count ) - { - return reader.Read( buffer, index, count ); - } - - [Obsolete] - public static string readLine( this TextReader reader ) - { - return reader.ReadLine(); - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/JSystem.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/JSystem.cs deleted file mode 100644 index 1574937..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/JSystem.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace Antlr.Runtime.JavaExtensions -{ - using System; - using System.IO; - - public static class JSystem - { - [Obsolete] - public static TextWriter err - { - get - { - return Console.Error; - } - } - - [Obsolete] - public static TextWriter @out - { - get - { - return Console.Out; - } - } - - [Obsolete] - public static void arraycopy<T>( T[] sourceArray, int sourceIndex, T[] destinationArray, int destinationIndex, int length ) - { - Array.Copy( sourceArray, sourceIndex, destinationArray, destinationIndex, length ); - } - - [Obsolete] - public static string getProperty( string name ) - { - switch ( name ) - { - case "file.encoding": - return System.Text.Encoding.Default.WebName; - - case "line.separator": - return Environment.NewLine; - - case "java.io.tmpdir": - return System.IO.Path.GetTempPath(); - - case "user.home": - return Environment.GetFolderPath( Environment.SpecialFolder.Personal ); - - default: - throw new ArgumentException( string.Format( "Unknown system property: '{0}'", name ) ); - } - } - - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/LexerExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/LexerExtensions.cs deleted file mode 100644 index 4300b38..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/LexerExtensions.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace Antlr.Runtime.JavaExtensions -{ - public static class LexerExtensions - { - public static void skip( this Lexer lexer ) - { - lexer.Skip(); - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ListExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ListExtensions.cs deleted file mode 100644 index 51c16bc..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ListExtensions.cs +++ /dev/null @@ -1,237 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; - -using ICollection = System.Collections.ICollection; -using IEnumerable = System.Collections.IEnumerable; -using IList = System.Collections.IList; - -namespace Antlr.Runtime.JavaExtensions -{ - public static class ListExtensions - { -#if DEBUG - [Obsolete] - public static bool add( this IList list, object value ) - { - int count = list.Count; - list.Add( value ); - return list.Count == count + 1; - } - - [Obsolete] - public static void add<T>( this ICollection<T> list, T value ) - { - list.Add( value ); - } - - [Obsolete] - public static void add<T>( this List<T> list, T value ) - { - list.Add( value ); - } - - [Obsolete] - public static void add( this IList list, int index, object value ) - { - list.Insert( index, value ); - } - - [Obsolete] - public static void addAll( this List<object> list, IEnumerable items ) - { - list.AddRange( items.Cast<object>() ); - } -#endif - - public static void addAll( this IList list, IEnumerable items ) - { - foreach ( object item in items ) - list.Add( item ); - } - - public static void addAll<T>( this ICollection<T> list, IEnumerable<T> items ) - { - foreach ( T item in items ) - list.Add( item ); - } - -#if DEBUG - [Obsolete] - public static void addElement( this List<object> list, object value ) - { - list.Add( value ); - } - - [Obsolete] - public static void clear( this IList list ) - { - list.Clear(); - } - - [Obsolete] - public static bool contains( this IList list, object value ) - { - return list.Contains( value ); - } - - [Obsolete] - public static bool contains<T>( this ICollection<T> list, T value ) - { - return list.Contains( value ); - } - - [Obsolete] - public static T elementAt<T>( this IList<T> list, int index ) - { - return list[index]; - } - - [Obsolete] - public static object get( this IList list, int index ) - { - return list[index]; - } - - [Obsolete] - public static T get<T>( this IList<T> list, int index ) - { - return list[index]; - } - - // disambiguate - [Obsolete] - public static T get<T>( this List<T> list, int index ) - { - return list[index]; - } - - [Obsolete] - public static object remove( this IList list, int index ) - { - object o = list[index]; - list.RemoveAt( index ); - return o; - } - - [Obsolete] - public static void remove<T>( this IList<T> list, T item ) - { - list.Remove( item ); - } - - [Obsolete] - public static void set( this IList list, int index, object value ) - { - list[index] = value; - } - - [Obsolete] - public static void set<T>( this IList<T> list, int index, T value ) - { - list[index] = value; - } - - [Obsolete] - public static void set<T>( this List<T> list, int index, T value ) - { - list[index] = value; - } -#endif - - public static void setSize<T>( this List<T> list, int size ) - { - if ( list.Count < size ) - { - list.AddRange( Enumerable.Repeat( default( T ), size - list.Count ) ); - } - else if ( list.Count > size ) - { - list.RemoveRange(size, list.Count - size); - } - } - -#if DEBUG - [Obsolete] - public static int size( this ICollection collection ) - { - return collection.Count; - } - - [Obsolete] - public static int size<T>( this ICollection<T> collection ) - { - return collection.Count; - } - - [Obsolete] - public static int size<T>( this List<T> list ) - { - return list.Count; - } -#endif - - public static IList subList( this IList list, int fromIndex, int toIndex ) - { - return new SubList( list, fromIndex, toIndex ); - //return - // list - // .Cast<object>() - // .Skip( fromIndex ) - // .Take( toIndex - fromIndex + 1 ) - // .ToList(); - } - - public static IList<T> subList<T>( this IList<T> list, int fromIndex, int toIndex ) - { - return new SubList<T>( list, fromIndex, toIndex ); - //return - // list - // .Skip( fromIndex ) - // .Take( toIndex - fromIndex + 1 ) - // .ToList(); - } - - public static IList<T> subList<T>( this List<T> list, int fromIndex, int toIndex ) - { - return new SubList<T>( list, fromIndex, toIndex ); - //return - // list - // .Skip( fromIndex ) - // .Take( toIndex - fromIndex + 1 ) - // .ToList(); - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ObjectExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ObjectExtensions.cs deleted file mode 100644 index fe6a274..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/ObjectExtensions.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace Antlr.Runtime.JavaExtensions -{ - public static class ObjectExtensions - { -#if DEBUG - [Obsolete] - public static bool booleanValue( this bool value ) - { - return value; - } - - [Obsolete] - public static Type getClass( this object o ) - { - return o.GetType(); - } -#endif - - public static int ShiftPrimeXOR( int a, int b ) - { - int hash = 23; - hash = ( ( hash << 5 ) * 37 ) ^ a; - hash = ( ( hash << 5 ) * 37 ) ^ b; - return hash; - } - - public static int ShiftPrimeXOR( int a, int b, int c ) - { - int hash = 23; - hash = ( ( hash << 5 ) * 37 ) ^ a; - hash = ( ( hash << 5 ) * 37 ) ^ b; - hash = ( ( hash << 5 ) * 37 ) ^ c; - return hash; - } - - public static int ShiftPrimeXOR( int a, int b, int c, int d ) - { - int hash = 23; - hash = ( ( hash << 5 ) * 37 ) ^ a; - hash = ( ( hash << 5 ) * 37 ) ^ b; - hash = ( ( hash << 5 ) * 37 ) ^ c; - hash = ( ( hash << 5 ) * 37 ) ^ d; - return hash; - } - - public static int ShiftPrimeXOR( params int[] a ) - { - int hash = 23; - foreach ( int i in a ) - hash = ( ( hash << 5 ) * 37 ) ^ i; - return hash; - } - - public static int ShiftPrimeAdd( int a, int b ) - { - int hash = 23; - hash = ( ( hash << 5 ) * 37 ) + a; - hash = ( ( hash << 5 ) * 37 ) + b; - return hash; - } - - public static int ShiftPrimeAdd( int a, int b, int c ) - { - int hash = 23; - hash = ( ( hash << 5 ) * 37 ) + a; - hash = ( ( hash << 5 ) * 37 ) + b; - hash = ( ( hash << 5 ) * 37 ) + c; - return hash; - } - - public static int ShiftPrimeAdd( int a, int b, int c, int d ) - { - int hash = 23; - hash = ( ( hash << 5 ) * 37 ) + a; - hash = ( ( hash << 5 ) * 37 ) + b; - hash = ( ( hash << 5 ) * 37 ) + c; - hash = ( ( hash << 5 ) * 37 ) + d; - return hash; - } - - public static int ShiftPrimeAdd( params int[] a ) - { - int hash = 23; - foreach ( int i in a ) - hash = ( ( hash << 5 ) * 37 ) + i; - return hash; - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Properties/AssemblyInfo.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Properties/AssemblyInfo.cs deleted file mode 100644 index 00e66a9..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008-2010 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle( "Antlr3.Runtime.JavaExtensions" )] -[assembly: AssemblyDescription( "" )] -[assembly: AssemblyConfiguration( "" )] -[assembly: AssemblyCompany( "Tunnel Vision Laboratories, LLC" )] -[assembly: AssemblyProduct( "Antlr3.Runtime.JavaExtensions" )] -[assembly: AssemblyCopyright( "Copyright © Sam Harwell 2013" )] -[assembly: AssemblyTrademark( "" )] -[assembly: AssemblyCulture( "" )] -[assembly: CLSCompliant( true )] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible( false )] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid( "ad48c7f7-0b1d-4b1e-9602-83425cb5699f" )] - -/* Version information for an assembly consists of four values in the following order: - * - * Major.Minor.Build.Revision - * - * These values are updated according to the following: - * 1. Major.Minor follows the ANTLR release schedule - * 2. Build is incremented each time the C# port is packaged for release (regardless - * of whether it's an incremental or nightly). The value resets to zero whenever - * the Major or Minor version is incremented. - */ -[assembly: AssemblyVersion("3.5.0.2")] -[assembly: AssemblyFileVersion("3.5.0.2")] diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/SetExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/SetExtensions.cs deleted file mode 100644 index 881326e..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/SetExtensions.cs +++ /dev/null @@ -1,89 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -#if DEBUG -using System.Linq; -#endif - -namespace Antlr.Runtime.JavaExtensions -{ - public static class SetExtensions - { -#if DEBUG - [Obsolete] - public static bool add<T>( this HashSet<T> set, T item ) - { - return set.Add( item ); - } -#endif - - public static void addAll<T>( this HashSet<T> set, IEnumerable<T> items ) - { - foreach ( T item in items ) - set.Add( item ); - } - -#if DEBUG - [Obsolete] - public static void clear<T>( this HashSet<T> set ) - { - set.Clear(); - } - - [Obsolete] - public static bool contains<T>( this HashSet<T> set, T value ) - { - return set.Contains( value ); - } - - [Obsolete] - public static bool remove<T>( this HashSet<T> set, T item ) - { - return set.Remove( item ); - } - - [Obsolete] - public static int size<T>( this HashSet<T> set ) - { - return set.Count; - } - - [Obsolete] - public static T[] toArray<T>( this HashSet<T> set ) - { - return set.ToArray(); - } -#endif - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StackExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StackExtensions.cs deleted file mode 100644 index ab9ec71..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StackExtensions.cs +++ /dev/null @@ -1,84 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -#if DEBUG -using System.Linq; -#endif - -namespace Antlr.Runtime.JavaExtensions -{ - public static class StackExtensions - { -#if DEBUG - [Obsolete] - public static T elementAt<T>( this Stack<T> stack, int index ) - { - return stack.ElementAt( index ); - } - - [Obsolete] - public static T peek<T>( this Stack<T> stack ) - { - return stack.Peek(); - } - - [Obsolete] - public static T pop<T>( this Stack<T> stack ) - { - return stack.Pop(); - } - - [Obsolete] - public static void push<T>( this Stack<T> stack, T obj ) - { - stack.Push( obj ); - } - - [Obsolete] - public static int size<T>( this Stack<T> stack ) - { - return stack.Count; - } -#endif - - public static void setSize<T>( this Stack<T> stack, int size ) - { - if ( size > stack.Count ) - throw new ArgumentException(); - - while ( stack.Count > size ) - stack.Pop(); - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringBuilderExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringBuilderExtensions.cs deleted file mode 100644 index 6ef6f27..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringBuilderExtensions.cs +++ /dev/null @@ -1,75 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -using StringBuilder = System.Text.StringBuilder; - -#if DEBUG - -namespace Antlr.Runtime.JavaExtensions -{ - public static class StringBuilderExtensions - { - [Obsolete] - public static void append<T>( this StringBuilder buffer, T value ) - { - buffer.Append( value ); - } - - [Obsolete] - public static char charAt( this StringBuilder buffer, int index ) - { - return buffer[index]; - } - - [Obsolete] - public static int length( this StringBuilder buffer ) - { - return buffer.Length; - } - - [Obsolete] - public static void setCharAt( this StringBuilder buffer, int index, char c ) - { - buffer[index] = c; - } - - [Obsolete] - public static void setLength( this StringBuilder buffer, int length ) - { - buffer.Length = length; - } - } -} - -#endif diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringExtensions.cs deleted file mode 100644 index 837908a..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringExtensions.cs +++ /dev/null @@ -1,151 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if DEBUG -namespace Antlr.Runtime.JavaExtensions -{ - using ObsoleteAttribute = System.ObsoleteAttribute; - using Regex = System.Text.RegularExpressions.Regex; - using StringBuilder = System.Text.StringBuilder; - - public static class StringExtensions - { - [Obsolete] - public static char charAt( this string str, int index ) - { - return str[index]; - } - - [Obsolete] - public static bool endsWith( this string str, string value ) - { - return str.EndsWith( value ); - } - - [Obsolete] - public static int indexOf( this string str, char value ) - { - return str.IndexOf( value ); - } - - [Obsolete] - public static int indexOf( this string str, char value, int startIndex ) - { - return str.IndexOf( value, startIndex ); - } - - [Obsolete] - public static int indexOf( this string str, string value ) - { - return str.IndexOf( value ); - } - - [Obsolete] - public static int indexOf( this string str, string value, int startIndex ) - { - return str.IndexOf( value, startIndex ); - } - - [Obsolete] - public static int lastIndexOf( this string str, char value ) - { - return str.LastIndexOf( value ); - } - - [Obsolete] - public static int lastIndexOf( this string str, string value ) - { - return str.LastIndexOf( value ); - } - - [Obsolete] - public static int length( this string str ) - { - return str.Length; - } - - [Obsolete] - public static string replace(this string str, char oldValue, char newValue) - { - return str.Replace(oldValue, newValue); - } - - [Obsolete] - public static string replaceAll( this string str, string regex, string newValue ) - { - return Regex.Replace( str, regex, newValue ); - } - - [Obsolete] - public static string replaceFirst( this string str, string regex, string replacement ) - { - return Regex.Replace( str, regex, replacement ); - } - - [Obsolete] - public static bool startsWith( this string str, string value ) - { - return str.StartsWith( value ); - } - - [Obsolete] - public static string substring( this string str, int startOffset ) - { - return str.Substring( startOffset ); - } - - [Obsolete] - public static string substring(this string str, int startOffset, int endOffset) - { - return str.Substring( startOffset, endOffset - startOffset ); - } - - [Obsolete] - public static char[] toCharArray( this string str ) - { - return str.ToCharArray(); - } - - [Obsolete] - public static string toUpperCase( this string str ) - { - return str.ToUpperInvariant(); - } - - [Obsolete] - public static string trim( this string str ) - { - return str.Trim(); - } - } -} -#endif diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringTokenizer.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringTokenizer.cs deleted file mode 100644 index 0145df5..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/StringTokenizer.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Linq; - -namespace Antlr.Runtime.JavaExtensions -{ - public class StringTokenizer - { - string[] _tokens; - int _current; - - public StringTokenizer( string str, string separator ) - : this( str, separator, false ) - { - } - public StringTokenizer( string str, string separator, bool returnDelims ) - { - _tokens = str.Split( separator.ToCharArray(), StringSplitOptions.None ); - if ( returnDelims ) - { - char[] delims = separator.ToCharArray(); - _tokens = _tokens.SelectMany( ( token, i ) => - { - if ( i == _tokens.Length - 1 ) - { - if ( delims.Contains( str[str.Length - 1] ) ) - return new string[0]; - else - return new string[] { token }; - } - else if ( i == 0 ) - { - if ( delims.Contains( str[0] ) ) - return new string[] { str[0].ToString() }; - else - return new string[] { token }; - } - else - { - return new string[] { token, str[_tokens.Take( i + 1 ).Select( t => t.Length + 1 ).Sum() - 1].ToString() }; - } - } ).ToArray(); - } - } - - public bool hasMoreTokens() - { - return _current < _tokens.Length; - } - - public string nextToken() - { - return _tokens[_current++]; - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/SubList.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/SubList.cs deleted file mode 100644 index 97025bf..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/SubList.cs +++ /dev/null @@ -1,423 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Collections; - -namespace Antlr.Runtime.JavaExtensions -{ - public class SubList - : IList - { - IList _source; - int _startIndex; - int _endIndex; - - public SubList( IList source, int startIndex, int endIndex ) - { - if ( source == null ) - throw new ArgumentNullException( "source" ); - if ( startIndex < 0 || endIndex < 0 ) - throw new ArgumentOutOfRangeException(); - if ( startIndex > endIndex || endIndex >= source.Count ) - throw new ArgumentException(); - - _source = source; - _startIndex = startIndex; - _endIndex = endIndex; - } - - #region IList Members - - public int Add( object value ) - { - throw new NotSupportedException(); - } - - public void Clear() - { - throw new NotSupportedException(); - } - - public bool Contains( object value ) - { - return _source - .Cast<object>() - .Skip( _startIndex ) - .Take( _endIndex - _startIndex + 1 ) - .Contains( value ); - } - - public int IndexOf( object value ) - { - for ( int i = 0; i < Count; i++ ) - { - if ( object.Equals( this[i], value ) ) - return i; - } - - return -1; - } - - public void Insert( int index, object value ) - { - throw new NotSupportedException(); - } - - public bool IsFixedSize - { - get - { - return true; - } - } - - public bool IsReadOnly - { - get - { - return true; - } - } - - public void Remove( object value ) - { - throw new NotSupportedException(); - } - - public void RemoveAt( int index ) - { - throw new NotSupportedException(); - } - - public object this[int index] - { - get - { - if ( index < 0 || index >= Count ) - throw new ArgumentOutOfRangeException(); - - return _source[index + _startIndex]; - } - set - { - if ( index < 0 || index >= Count ) - throw new ArgumentOutOfRangeException(); - - _source[index + _startIndex] = value; - } - } - - #endregion - - #region ICollection Members - - public void CopyTo( Array array, int index ) - { - if ( array == null ) - throw new ArgumentNullException( "array" ); - - if ( index < 0 ) - throw new ArgumentOutOfRangeException(); - - if ( index + Count > array.Length ) - throw new ArgumentException(); - - for ( int i = 0; i < Count; i++ ) - { - array.SetValue( this[i], index + i ); - } - } - - public int Count - { - get - { - return _endIndex - _startIndex + 1; - } - } - - public bool IsSynchronized - { - get - { - return false; - } - } - - public object SyncRoot - { - get - { - return _source.SyncRoot; - } - } - - #endregion - - #region IEnumerable Members - - public System.Collections.IEnumerator GetEnumerator() - { - return _source.Cast<object>() - .Skip( _startIndex ) - .Take( _endIndex - _startIndex + 1 ) - .GetEnumerator(); - } - - #endregion - } - - public class SubList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable - { - IList<T> _source; - int _startIndex; - int _endIndex; - - public SubList( IList<T> source, int startIndex, int endIndex ) - { - if ( source == null ) - throw new ArgumentNullException( "source" ); - if ( startIndex < 0 || endIndex < 0 ) - throw new ArgumentOutOfRangeException(); - if ( startIndex > endIndex || endIndex >= source.Count ) - throw new ArgumentException(); - - _source = source; - _startIndex = startIndex; - _endIndex = endIndex; - } - - #region IEnumerable Members - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - #endregion - - #region ICollection Members - - void ICollection.CopyTo( Array array, int index ) - { - if ( array == null ) - throw new ArgumentNullException( "array" ); - - if ( index < 0 ) - throw new ArgumentOutOfRangeException(); - - if ( index + Count > array.Length ) - throw new ArgumentException(); - - for ( int i = 0; i < Count; i++ ) - { - array.SetValue( this[i], index + i ); - } - } - - public int Count - { - get - { - return _endIndex - _startIndex + 1; - } - } - - public bool IsSynchronized - { - get - { - ICollection sourceCollection = _source as ICollection; - if ( sourceCollection != null ) - return sourceCollection.IsSynchronized; - - return false; - } - } - - public object SyncRoot - { - get - { - ICollection sourceCollection = _source as ICollection; - if ( sourceCollection != null ) - return sourceCollection.SyncRoot; - - return _source; - } - } - - #endregion - - #region IList Members - - int IList.Add( object value ) - { - throw new NotSupportedException(); - } - - void IList.Clear() - { - throw new NotSupportedException(); - } - - public bool Contains( object value ) - { - return _source.Cast<object>().Skip( _startIndex ).Take( Count ).Contains( value ); - } - - public int IndexOf( object value ) - { - for ( int i = _startIndex; i <= _endIndex; i++ ) - { - if ( object.Equals( _source[i], value ) ) - return i - _startIndex; - } - - return -1; - } - - void IList.Insert( int index, object value ) - { - throw new NotSupportedException(); - } - - public bool IsFixedSize - { - get - { - var sourceCollection = _source as IList; - if ( sourceCollection != null ) - return sourceCollection.IsFixedSize; - - return false; - } - } - - public bool IsReadOnly - { - get - { - return true; - } - } - - void IList.Remove( object value ) - { - throw new NotSupportedException(); - } - - void IList.RemoveAt( int index ) - { - throw new NotSupportedException(); - } - - object IList.this[int index] - { - get - { - return this[index]; - } - set - { - this[index] = (T)value; - } - } - - #endregion - - #region IEnumerable<T> Members - - public IEnumerator<T> GetEnumerator() - { - return _source.Skip( _startIndex ).Take( Count ).GetEnumerator(); - } - - #endregion - - #region ICollection<T> Members - - void ICollection<T>.Add( T item ) - { - throw new NotSupportedException(); - } - - void ICollection<T>.Clear() - { - throw new NotSupportedException(); - } - - public bool Contains( T item ) - { - return _source.Skip( _startIndex ).Take( Count ).Contains( item ); - } - - public void CopyTo( T[] array, int arrayIndex ) - { - if ( array == null ) - throw new ArgumentNullException( "array" ); - - if ( arrayIndex < 0 ) - throw new ArgumentOutOfRangeException(); - - if ( arrayIndex + Count > array.Length ) - throw new ArgumentException(); - - for ( int i = 0; i < Count; i++ ) - { - array[arrayIndex + i] = this[i]; - } - } - - bool ICollection<T>.Remove( T item ) - { - throw new NotSupportedException(); - } - - #endregion - - #region IList<T> Members - - public int IndexOf( T item ) - { - for ( int i = 0; i < Count; i++ ) - { - if ( object.Equals( this[i], item ) ) - return i; - } - - return -1; - } - - void IList<T>.Insert( int index, T item ) - { - throw new NotSupportedException(); - } - - void IList<T>.RemoveAt( int index ) - { - throw new NotSupportedException(); - } - - public T this[int index] - { - get - { - if ( index < 0 || index >= Count ) - throw new ArgumentOutOfRangeException(); - - return _source[index + _startIndex]; - } - set - { - if ( index < 0 || index >= Count ) - throw new ArgumentOutOfRangeException(); - - _source[index + _startIndex] = value; - } - } - - #endregion - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/TreeExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/TreeExtensions.cs deleted file mode 100644 index 6f7182f..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/TreeExtensions.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008-2009 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using ITree = Antlr.Runtime.Tree.ITree; - -namespace Antlr.Runtime.JavaExtensions -{ - public static class TreeExtensions - { - public static ITree getNextSibling( this ITree tree ) - { - return tree.Parent.GetChild( tree.ChildIndex + 1 ); - //throw new NotImplementedException(); - } - - public static void setFirstChild( this ITree tree, ITree child ) - { - if ( tree.ChildCount == 0 ) - tree.AddChild( child ); - else - tree.SetChild( 0, child ); - } - } -} diff --git a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/TypeExtensions.cs b/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/TypeExtensions.cs deleted file mode 100644 index 42c0368..0000000 --- a/runtime/CSharp3/Sources/Antlr3.Runtime.JavaExtensions/TypeExtensions.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* - * [The "BSD licence"] - * Copyright (c) 2005-2008 Terence Parr - * All rights reserved. - * - * Conversion to C#: - * Copyright (c) 2008 Sam Harwell, Pixel Mine, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Reflection; - -#if DEBUG - -namespace Antlr.Runtime.JavaExtensions -{ - public static class TypeExtensions - { - [Obsolete] - public static object get( this FieldInfo field, object obj ) - { - return field.GetValue( obj ); - } - - [Obsolete] - public static Type getComponentType( this Type type ) - { - return type.GetElementType(); - } - - [Obsolete] - public static ConstructorInfo getConstructor( this Type type, Type[] argumentTypes ) - { - return type.GetConstructor( argumentTypes ); - } - - [Obsolete] - public static FieldInfo getField( this Type type, string name ) - { - FieldInfo field = type.GetField( name ); - if ( field == null ) - throw new TargetException(); - - return field; - } - - [Obsolete] - public static string getName( this Type type ) - { - return type.Name; - } - - [Obsolete] - public static object invoke( this MethodInfo method, object obj, params object[] parameters ) - { - return method.Invoke( obj, parameters ); - } - - [Obsolete] - public static bool isArray( this Type type ) - { - return type.IsArray; - } - - [Obsolete] - public static bool isPrimitive( this Type type ) - { - return type.IsPrimitive; - } - - [Obsolete] - public static object newInstance( this Type type ) - { - return type.GetConstructor( new Type[0] ).Invoke( new object[0] ); - } - } -} - -#endif |