From 5bdef288372d3a6a8134479a6497c44f3b17c4dc Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 27 Apr 2016 20:54:50 +0100 Subject: Replace parboiled parser with hand-written parser --- .../Couscous/java/lang/IllegalArgumentException.cs | 8 ++++++++ dotnet/Mammoth/Couscous/java/math/BigInteger.cs | 24 ++++++++++++++++++++++ dotnet/Mammoth/Couscous/java/util/Arrays.cs | 7 +++++++ .../Couscous/java/util/function/BiConsumer.cs | 5 +++++ 4 files changed, 44 insertions(+) create mode 100644 dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs create mode 100644 dotnet/Mammoth/Couscous/java/math/BigInteger.cs create mode 100644 dotnet/Mammoth/Couscous/java/util/Arrays.cs create mode 100644 dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs (limited to 'dotnet/Mammoth/Couscous/java') diff --git a/dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs b/dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs new file mode 100644 index 0000000..57ef62b --- /dev/null +++ b/dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs @@ -0,0 +1,8 @@ +using System; + +namespace Mammoth.Couscous.java.lang { + internal class IllegalArgumentException : RuntimeException { + internal IllegalArgumentException(string message) : base(message) { + } + } +} diff --git a/dotnet/Mammoth/Couscous/java/math/BigInteger.cs b/dotnet/Mammoth/Couscous/java/math/BigInteger.cs new file mode 100644 index 0000000..40ac3d3 --- /dev/null +++ b/dotnet/Mammoth/Couscous/java/math/BigInteger.cs @@ -0,0 +1,24 @@ +namespace Mammoth.Couscous.java.math { + internal class BigInteger { + internal static readonly BigInteger _ONE = new BigInteger(1); + + // TOOD: use proper BigInteger + private readonly long _value; + + internal BigInteger(string value) { + _value = long.Parse(value); + } + + internal BigInteger(long value) { + _value = value; + } + + internal BigInteger subtract(BigInteger other) { + return new BigInteger(_value - other._value); + } + + internal string toString() { + return _value.ToString(); + } + } +} diff --git a/dotnet/Mammoth/Couscous/java/util/Arrays.cs b/dotnet/Mammoth/Couscous/java/util/Arrays.cs new file mode 100644 index 0000000..093db83 --- /dev/null +++ b/dotnet/Mammoth/Couscous/java/util/Arrays.cs @@ -0,0 +1,7 @@ +namespace Mammoth.Couscous.java.util { + internal static class Arrays { + internal static List asList(T[] elements) { + return ToJava.ListToList(elements); + } + } +} diff --git a/dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs b/dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs new file mode 100644 index 0000000..9479a78 --- /dev/null +++ b/dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs @@ -0,0 +1,5 @@ +namespace Mammoth.Couscous.java.util.function { + internal interface BiConsumer { + void accept(T1 first, T2 second); + } +} -- cgit v1.2.3