Skip to content

Instantly share code, notes, and snippets.

@kikugie
Created February 13, 2026 13:58
Show Gist options
  • Select an option

  • Save kikugie/3ea8abd9082017d394a5741825d0badd to your computer and use it in GitHub Desktop.

Select an option

Save kikugie/3ea8abd9082017d394a5741825d0badd to your computer and use it in GitHub Desktop.
// TokenStream.java
import kotlin.Metadata;
import org.jetbrains.annotations.Nullable;
@Metadata(
mv = {2, 3, 0},
k = 1,
xi = 48,
d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\bf\u0018\u00002\u00020\u0001J\n\u0010\u0002\u001a\u0004\u0018\u00010\u0003H&J\b\u0010\u0004\u001a\u00020\u0005H&¨\u0006\u0006À\u0006\u0003"},
d2 = {"LTokenStream;", "", "peek", "", "consume", "", "Sources of Stonecutter.stitcher.main"}
)
public interface TokenStream {
@Nullable
String peek();
void consume();
}
// TokenStreamIterator.java
import java.util.Iterator;
import java.util.NoSuchElementException;
import kotlin.Metadata;
import kotlin.jvm.JvmInline;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.markers.KMappedMarker;
import org.jetbrains.annotations.NotNull;
@JvmInline
@Metadata(
mv = {2, 3, 0},
k = 1,
xi = 48,
d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010(\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0005\b\u0087@\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u000f\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0004\b\u0005\u0010\u0006J\u0011\u0010\t\u001a\u00020\nH\u0096\u0082\u0004¢\u0006\u0004\b\u000b\u0010\fJ\u0011\u0010\r\u001a\u00020\u0002H\u0096\u0082\u0004¢\u0006\u0004\b\u000e\u0010\u000fJ\u001b\u0010\u0010\u001a\u00020\n2\b\u0010\u0011\u001a\u0004\u0018\u00010\u0012HÖ\u0083\u0004¢\u0006\u0004\b\u0013\u0010\u0014J\u0011\u0010\u0015\u001a\u00020\u0016HÖ\u0081\u0004¢\u0006\u0004\b\u0017\u0010\u0018J\u0011\u0010\u0019\u001a\u00020\u0002HÖ\u0081\u0004¢\u0006\u0004\b\u001a\u0010\u000fR\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\b\u0088\u0001\u0003¨\u0006\u001b"},
d2 = {"LTokenStreamIterator;", "", "", "stream", "LTokenStream;", "constructor-impl", "(LTokenStream;)LTokenStream;", "getStream", "()LTokenStream;", "hasNext", "", "hasNext-impl", "(LTokenStream;)Z", "next", "next-impl", "(LTokenStream;)Ljava/lang/String;", "equals", "other", "", "equals-impl", "(LTokenStream;Ljava/lang/Object;)Z", "hashCode", "", "hashCode-impl", "(LTokenStream;)I", "toString", "toString-impl", "Sources of Stonecutter.stitcher.main"}
)
public final class TokenStreamIterator implements Iterator, KMappedMarker {
@NotNull
private final TokenStream stream;
@NotNull
public final TokenStream getStream() {
return this.stream;
}
public static boolean hasNext_impl/* $FF was: hasNext-impl*/(TokenStream arg0) {
return arg0.peek() != null;
}
public boolean hasNext() {
return hasNext-impl(this.stream);
}
@NotNull
public static String next_impl/* $FF was: next-impl*/(TokenStream arg0) {
String it = arg0.peek();
int var2 = 0;
if (it == null) {
throw new NoSuchElementException("Reached EOF token");
} else {
arg0.consume();
return it;
}
}
@NotNull
public String next() {
return next-impl(this.stream);
}
public static String toString_impl/* $FF was: toString-impl*/(TokenStream arg0) {
return "TokenStreamIterator(stream=" + arg0 + ')';
}
public String toString() {
return toString-impl(this.stream);
}
public static int hashCode_impl/* $FF was: hashCode-impl*/(TokenStream arg0) {
return arg0.hashCode();
}
public int hashCode() {
return hashCode-impl(this.stream);
}
public static boolean equals_impl/* $FF was: equals-impl*/(TokenStream arg0, Object other) {
if (!(other instanceof TokenStreamIterator)) {
return false;
} else {
return Intrinsics.areEqual(arg0, ((TokenStreamIterator)other).unbox-impl());
}
}
public boolean equals(Object other) {
return equals-impl(this.stream, other);
}
public void remove() {
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
}
// $FF: synthetic method
private TokenStreamIterator(TokenStream stream) {
this.stream = stream;
}
@NotNull
public static TokenStream constructor_impl/* $FF was: constructor-impl*/(@NotNull TokenStream stream) {
Intrinsics.checkNotNullParameter(stream, "stream");
return stream;
}
// $FF: synthetic method
public static final TokenStreamIterator box_impl/* $FF was: box-impl*/(TokenStream v) {
return new TokenStreamIterator(v);
}
// $FF: synthetic method
public final TokenStream unbox_impl/* $FF was: unbox-impl*/() {
return this.stream;
}
public static final boolean equals_impl0/* $FF was: equals-impl0*/(TokenStream p1, TokenStream p2) {
return Intrinsics.areEqual(p1, p2);
}
// $FF: synthetic method
// $FF: bridge method
public Object next() {
return this.next();
}
}
// ExampleKt.java
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
@Metadata(
mv = {2, 3, 0},
k = 2,
xi = 48,
d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u000e\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003¨\u0006\u0004"},
d2 = {"iterate", "", "stream", "LTokenStream;", "Sources of Stonecutter.stitcher.main"}
)
public final class ExampleKt {
public static final void iterate(@NotNull TokenStream stream) {
Intrinsics.checkNotNullParameter(stream, "stream");
TokenStream var1 = TokenStreamIterator.constructor-impl(stream);
while(((Iterator)TokenStreamIterator.box-impl(var1)).hasNext()) {
String token = TokenStreamIterator.next-impl(var1);
System.out.println(token);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment