ParseState .java

net.minecraft.util.parsing.packrat.ParseState (interface): members: parseTopRule, acquireControl, errorCollector, releaseControl, restore, scope, mark.

net.minecraft.util.parsing.packratinterface38 linescommon731 B

API Surface (0)

No public/protected methods detected (fields or constants only).

String literals (1)

"Malformed scope: "

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ParseState.java38 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.parsing.packrat;
2
3
import java.util.Optional;
4
import org.jspecify.annotations.Nullable;
5
6
public interface ParseState<S> {
7
	Scope scope();
8
9
	ErrorCollector<S> errorCollector();
10
11
	default <T> Optional<T> parseTopRule(final NamedRule<S, T> rule) {
12
		T result = this.parse(rule);
13
		if (result != null) {
14
			this.errorCollector().finish(this.mark());
15
		}
16
17
		if (!this.scope().hasOnlySingleFrame()) {
18
			throw new IllegalStateException("Malformed scope: " + this.scope());
19
		} else {
20
			return Optional.ofNullable(result);
21
		}
22
	}
23
24
	<T> @Nullable T parse(NamedRule<S, T> rule);
25
26
	S input();
27
28
	int mark();
29
30
	void restore(int mark);
31
32
	Control acquireControl();
33
34
	void releaseControl();
35
36
	ParseState<S> silent();
37
}
38

Decompiled Minecraft 26.3 source of ParseState (net/minecraft/util/parsing/packrat/ParseState.java) with Mojang official mappings, stored verbatim on the site.