From bd8d057d02383bb8cda4c8001e4fa26a0d32fb18 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 4 Jul 2014 20:39:54 -0500 Subject: [PATCH] Map java.util.Reader to System.IO.TextReader --- reference/sharpen-all-options.txt | 2 +- runtime/CSharp/Antlr4.Runtime/ANTLRInputStream.cs | 10 +++++----- runtime/CSharp/Antlr4.Runtime/Misc/TestRig.cs | 6 +++--- runtime/CSharp/Antlr4.Runtime/UnbufferedCharStream.cs | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/reference/sharpen-all-options.txt b/reference/sharpen-all-options.txt index 2d600ae80..20b40823c 100644 --- a/reference/sharpen-all-options.txt +++ b/reference/sharpen-all-options.txt @@ -132,7 +132,7 @@ -typeMapping java.util.zip.ZipException ICSharpCode.SharpZipLib.SharpZipBaseException -typeMapping java.util.zip.DataFormatException ICSharpCode.SharpZipLib.SharpZipBaseException -typeMapping java.io.FileNotFoundException System.IO.FileNotFoundException --typeMapping java.io.Reader System.IO.StreamReader +-typeMapping java.io.Reader System.IO.TextReader -typeMapping java.util.SortedSet<> System.Collections.Generic.ICollection -typeMapping java.lang.AssertionError System.Exception -typeMapping java.io.InterruptedIOException System.Threading.ThreadInterruptedException diff --git a/runtime/CSharp/Antlr4.Runtime/ANTLRInputStream.cs b/runtime/CSharp/Antlr4.Runtime/ANTLRInputStream.cs index 3c2f2bced..8588196be 100644 --- a/runtime/CSharp/Antlr4.Runtime/ANTLRInputStream.cs +++ b/runtime/CSharp/Antlr4.Runtime/ANTLRInputStream.cs @@ -37,7 +37,7 @@ namespace Antlr4.Runtime { /// /// Vacuum all input from a - /// + /// /// / /// /// and then treat it @@ -87,19 +87,19 @@ namespace Antlr4.Runtime } /// - public AntlrInputStream(StreamReader r) + public AntlrInputStream(TextReader r) : this(r, InitialBufferSize, ReadBufferSize) { } /// - public AntlrInputStream(StreamReader r, int initialSize) + public AntlrInputStream(TextReader r, int initialSize) : this(r, initialSize, ReadBufferSize) { } /// - public AntlrInputStream(StreamReader r, int initialSize, int readChunkSize) + public AntlrInputStream(TextReader r, int initialSize, int readChunkSize) { Load(r, initialSize, readChunkSize); } @@ -123,7 +123,7 @@ namespace Antlr4.Runtime } /// - public virtual void Load(StreamReader r, int size, int readChunkSize) + public virtual void Load(TextReader r, int size, int readChunkSize) { if (r == null) { diff --git a/runtime/CSharp/Antlr4.Runtime/Misc/TestRig.cs b/runtime/CSharp/Antlr4.Runtime/Misc/TestRig.cs index b430d290e..8117beb81 100644 --- a/runtime/CSharp/Antlr4.Runtime/Misc/TestRig.cs +++ b/runtime/CSharp/Antlr4.Runtime/Misc/TestRig.cs @@ -220,7 +220,7 @@ namespace Antlr4.Runtime.Misc if (inputFiles.IsEmpty()) { Stream @is = Sharpen.Runtime.@in; - StreamReader r; + TextReader r; if (encoding != null) { r = new StreamReader(@is, encoding); @@ -239,7 +239,7 @@ namespace Antlr4.Runtime.Misc { @is = new FileInputStream(inputFile); } - StreamReader r; + TextReader r; if (encoding != null) { r = new StreamReader(@is, encoding); @@ -260,7 +260,7 @@ namespace Antlr4.Runtime.Misc /// /// /// - protected internal virtual void Process<_T0>(Lexer lexer, Type<_T0> parserClass, Parser parser, Stream @is, StreamReader r) + protected internal virtual void Process<_T0>(Lexer lexer, Type<_T0> parserClass, Parser parser, Stream @is, TextReader r) where _T0 : Parser { try diff --git a/runtime/CSharp/Antlr4.Runtime/UnbufferedCharStream.cs b/runtime/CSharp/Antlr4.Runtime/UnbufferedCharStream.cs index d8e109123..953c99ea8 100644 --- a/runtime/CSharp/Antlr4.Runtime/UnbufferedCharStream.cs +++ b/runtime/CSharp/Antlr4.Runtime/UnbufferedCharStream.cs @@ -126,7 +126,7 @@ namespace Antlr4.Runtime /// protected internal int currentCharIndex = 0; - protected internal StreamReader input; + protected internal TextReader input; /// The name or source of this char stream. /// The name or source of this char stream. @@ -152,7 +152,7 @@ namespace Antlr4.Runtime { } - public UnbufferedCharStream(StreamReader input) + public UnbufferedCharStream(TextReader input) : this(input, 256) { } @@ -164,7 +164,7 @@ namespace Antlr4.Runtime Fill(1); } - public UnbufferedCharStream(StreamReader input, int bufferSize) + public UnbufferedCharStream(TextReader input, int bufferSize) : this(bufferSize) { // prime