Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switched sequence and choice in JNI to varargs

  • Loading branch information...
commit 8976238bcc2f6952af6b5f93e6ee1a7eba4d0e27 1 parent 62501e5
@ae-g-i-s ae-g-i-s authored
View
4 jni/Example.java
@@ -77,12 +77,12 @@ public static void main(String args[])
out("choice");
Parser two32s[] = {Hammer.intRange(Hammer.uInt32(), 0x00, 0x01), Hammer.int32()};
- handle(Hammer.parse(Hammer.choice(two32s), ints, ints.length));
+ handle(Hammer.parse(Hammer.choice(Hammer.intRange(Hammer.uInt32(), 0x00, 0x01), Hammer.int32()), ints, ints.length));
out("sequence");
byte i3[] = {(byte)'i', (byte)3, (byte)0xFF};
Parser i3parsers[] = {Hammer.ch((byte)'i'), Hammer.uInt8(), Hammer.int8()};
- handle(Hammer.parse(Hammer.sequence(i3parsers), i3, i3.length));
+ handle(Hammer.parse(Hammer.sequence(Hammer.ch((byte)'i'), Hammer.uInt8(), Hammer.int8()), i3, i3.length));
}
View
4 jni/com/upstandinghackers/hammer/Hammer.java
@@ -55,8 +55,8 @@
public static native Parser in(byte[] charset, int length);
public static native Parser endP();
public static native Parser nothingP();
- public static native Parser sequence(Parser[] parsers);
- public static native Parser choice(Parser[] parsers);
+ public static native Parser sequence(Parser... parsers);
+ public static native Parser choice(Parser... parsers);
public static native Parser butNot(Parser p1, Parser p2);
public static native Parser difference(Parser p1, Parser p2);
public static native Parser xor(Parser p1, Parser p2);
Please sign in to comment.
Something went wrong with that request. Please try again.