IdentifierParseRule .java

net.minecraft.util.parsing.packrat.commands.IdentifierParseRule (class): members: INSTANCE, parse. imports: Rule, ParseState, StringReader, Identifier.

net.minecraft.util.parsing.packrat.commandsclass26 linescommon784 B

Implements

API Surface (0)

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

Fields & Constants (1)

INSTANCE

Code Graph: Dependencies (3)

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

Full Source

IdentifierParseRule.java26 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.parsing.packrat.commands;
2
3
import com.mojang.brigadier.StringReader;
4
import com.mojang.brigadier.exceptions.CommandSyntaxException;
5
import net.minecraft.resources.Identifier;
6
import net.minecraft.util.parsing.packrat.ParseState;
7
import net.minecraft.util.parsing.packrat.Rule;
8
import org.jspecify.annotations.Nullable;
9
10
public class IdentifierParseRule implements Rule<StringReader, Identifier> {
11
	public static final Rule<StringReader, Identifier> INSTANCE = new IdentifierParseRule();
12
13
	private IdentifierParseRule() {
14
	}
15
16
	public @Nullable Identifier parse(final ParseState<StringReader> state) {
17
		state.input().skipWhitespace();
18
19
		try {
20
			return Identifier.readNonEmpty(state.input());
21
		} catch (CommandSyntaxException e) {
22
			return null;
23
		}
24
	}
25
}
26

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