()
+ val parser = Parser(descriptor)
+ parser.pos++
+ while (parser.peek() != ')') {
+ val start = parser.pos
+ parser.fieldDescriptor()
+ parameters += descriptor.substring(start, parser.pos)
+ }
+ return MethodDescriptor(parameters, descriptor.substring(parser.pos + 1))
+ }
+
+ /**
+ * Converts a valid field descriptor, or `V`, to the name of the type as it would appear in Java source code.
+ */
+ fun toJavaName(descriptor: String): String {
+ val dimensions = descriptor.takeWhile { it == '[' }.length
+ val element = when (val elementDesc = descriptor.substring(dimensions)) {
+ "B" -> "byte"
+ "C" -> "char"
+ "D" -> "double"
+ "F" -> "float"
+ "I" -> "int"
+ "J" -> "long"
+ "S" -> "short"
+ "Z" -> "boolean"
+ "V" -> "void"
+ else -> elementDesc.removePrefix("L").removeSuffix(";").replace('/', '.')
+ }
+ return element + "[]".repeat(dimensions)
+ }
+
+ private class Parser(val text: String) {
+ var pos = 0
+
+ val atEnd: Boolean
+ get() = pos >= text.length
+
+ fun peek() = text[pos]
+
+ /**
+ * Skips over a field descriptor, returning an error message if it is invalid.
+ */
+ @Nls
+ fun fieldDescriptor(): String? {
+ while (!atEnd && peek() == '[') {
+ pos++
+ }
+ if (atEnd) {
+ return MCDevBundle("minecraft.unpick.descriptor.unexpected_end")
+ }
+ when (val c = peek()) {
+ 'B', 'C', 'D', 'F', 'I', 'J', 'S', 'Z' -> pos++
+ 'L' -> {
+ pos++
+ val start = pos
+ while (!atEnd && peek() != ';') {
+ val nameChar = peek()
+ if (nameChar == '.' || nameChar == '[' || nameChar == '(' || nameChar == ')') {
+ return MCDevBundle("minecraft.unpick.descriptor.illegal_character", nameChar)
+ }
+ pos++
+ }
+ if (atEnd) {
+ return MCDevBundle("minecraft.unpick.descriptor.unexpected_end")
+ }
+ if (pos == start) {
+ return MCDevBundle("minecraft.unpick.descriptor.empty_class_name")
+ }
+ pos++
+ }
+ else -> return MCDevBundle("minecraft.unpick.descriptor.illegal_character", c)
+ }
+ return null
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickDocumentationProvider.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickDocumentationProvider.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickDocumentationProvider.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,56 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.intellij.lang.documentation.AbstractDocumentationProvider
+import com.intellij.lang.documentation.DocumentationMarkup
+import com.intellij.openapi.util.text.StringUtil
+import com.intellij.psi.PsiElement
+
+class UnpickDocumentationProvider : AbstractDocumentationProvider() {
+
+ override fun getQuickNavigateInfo(element: PsiElement, originalElement: PsiElement?): String? {
+ val definition = element as? UnpickGroupDefinition ?: return null
+ return StringUtil.escapeXmlEntities(signature(definition))
+ }
+
+ override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
+ val definition = element as? UnpickGroupDefinition ?: return null
+ val definitions = definition.name?.let { UnpickGroups.findDefinitions(definition, it) } ?: listOf(definition)
+ val docs = definitions.mapNotNull { it.docComment }.ifEmpty { listOfNotNull(definition.docComment) }.distinct()
+
+ return buildString {
+ append(DocumentationMarkup.DEFINITION_START)
+ append(StringUtil.escapeXmlEntities(signature(definition)))
+ append(DocumentationMarkup.DEFINITION_END)
+ if (docs.isNotEmpty()) {
+ append(DocumentationMarkup.CONTENT_START)
+ append(docs.joinToString("") { StringUtil.escapeXmlEntities(it).replace("\n", "
") })
+ append(DocumentationMarkup.CONTENT_END)
+ }
+ }
+ }
+
+ private fun signature(definition: UnpickGroupDefinition): String {
+ return listOfNotNull("group", definition.dataType?.text, definition.name).joinToString(" ")
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickFile.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickFile.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickFile.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,51 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.asset.PlatformAssets
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickHeader
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickItem
+import com.demonwav.mcdev.util.childrenOfType
+import com.intellij.extapi.psi.PsiFileBase
+import com.intellij.psi.FileViewProvider
+
+class UnpickFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, UnpickLanguage) {
+
+ val header: UnpickHeader?
+ get() = firstChild as? UnpickHeader
+
+ /**
+ * The version of the unpick format declared in the header, or `null` if the header is missing or malformed.
+ */
+ val version: Int?
+ get() = header?.version
+
+ val items: Collection
+ get() = childrenOfType()
+
+ val groupDefinitions: Collection
+ get() = childrenOfType()
+
+ override fun getFileType() = UnpickFileType
+ override fun toString() = "Unpick File"
+ override fun getIcon(flags: Int) = PlatformAssets.MINECRAFT_ICON
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickFileType.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickFileType.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickFileType.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,36 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.asset.PlatformAssets
+import com.intellij.openapi.fileTypes.LanguageFileType
+
+object UnpickFileType : LanguageFileType(UnpickLanguage) {
+
+ override fun getName() = "Unpick"
+
+ override fun getDescription() = MCDevBundle("minecraft.unpick.file_type.description")
+
+ override fun getDefaultExtension() = "unpick"
+
+ override fun getIcon() = PlatformAssets.MINECRAFT_ICON
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickFindUsagesProvider.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickFindUsagesProvider.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickFindUsagesProvider.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,48 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickParserDefinition.TokenSets
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.intellij.lang.cacheBuilder.DefaultWordsScanner
+import com.intellij.lang.cacheBuilder.WordsScanner
+import com.intellij.lang.findUsages.FindUsagesProvider
+import com.intellij.psi.PsiElement
+
+class UnpickFindUsagesProvider : FindUsagesProvider {
+ override fun getWordsScanner(): WordsScanner =
+ DefaultWordsScanner(UnpickLexerAdapter(), TokenSets.IDENTIFIERS, TokenSets.COMMENTS, TokenSets.STRINGS)
+
+ override fun canFindUsagesFor(element: PsiElement) = element is UnpickGroupDefinition && element.name != null
+
+ override fun getHelpId(element: PsiElement): String? = null
+
+ override fun getType(element: PsiElement): String {
+ return if (element is UnpickGroupDefinition) MCDevBundle("minecraft.unpick.find_usages.group") else ""
+ }
+
+ override fun getDescriptiveName(element: PsiElement): String {
+ return (element as? UnpickGroupDefinition)?.name ?: ""
+ }
+
+ override fun getNodeText(element: PsiElement, useFullName: Boolean) = getDescriptiveName(element)
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickGroups.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickGroups.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickGroups.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,92 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.index.UnpickGroupIndex
+import com.intellij.openapi.project.DumbService
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiManager
+import com.intellij.psi.search.GlobalSearchScope
+import com.intellij.util.indexing.FileBasedIndex
+
+/**
+ * Lookup of group definitions across all unpick files visible from a given element.
+ */
+object UnpickGroups {
+
+ /**
+ * Finds all definitions of the group with the given name, or of the default group if [name] is `null`.
+ */
+ fun findDefinitions(context: PsiElement, name: String?): List {
+ return findFiles(context, name ?: UnpickGroupIndex.DEFAULT_GROUP_KEY).flatMap { file ->
+ file.groupDefinitions.filter { it.name == name }
+ }
+ }
+
+ /**
+ * Returns all group names visible from the given element, excluding the default group.
+ */
+ fun findAllGroupNames(context: PsiElement): Set {
+ val project = context.project
+ if (DumbService.isDumb(project)) {
+ return (context.containingFile as? UnpickFile)?.groupDefinitions?.mapNotNullTo(HashSet()) { it.name }
+ ?: emptySet()
+ }
+ val scope = searchScope(context)
+ val index = FileBasedIndex.getInstance()
+ val result = HashSet()
+ index.processAllKeys(
+ UnpickGroupIndex.NAME,
+ { key ->
+ if (key != UnpickGroupIndex.DEFAULT_GROUP_KEY && key !in result) {
+ if (index.getContainingFiles(UnpickGroupIndex.NAME, key, scope).isNotEmpty()) {
+ result += key
+ }
+ }
+ true
+ },
+ scope,
+ null,
+ )
+ (context.containingFile as? UnpickFile)?.groupDefinitions?.mapNotNullTo(result) { it.name }
+ return result
+ }
+
+ private fun findFiles(context: PsiElement, key: String): List {
+ val project = context.project
+ val ownFile = context.containingFile?.originalFile as? UnpickFile
+ if (DumbService.isDumb(project)) {
+ return listOfNotNull(ownFile)
+ }
+ val psiManager = PsiManager.getInstance(project)
+ val files = FileBasedIndex.getInstance().getContainingFiles(UnpickGroupIndex.NAME, key, searchScope(context))
+ val result = files.mapNotNull { psiManager.findFile(it) as? UnpickFile }.toMutableList()
+ if (ownFile != null && ownFile !in result) {
+ result += ownFile
+ }
+ return result
+ }
+
+ private fun searchScope(context: PsiElement): GlobalSearchScope {
+ return context.containingFile?.originalFile?.resolveScope ?: GlobalSearchScope.allScope(context.project)
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickLanguage.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickLanguage.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickLanguage.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,29 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.intellij.lang.Language
+import java.io.Serial
+
+object UnpickLanguage : Language("Unpick") {
+ @Serial
+ private fun readResolve(): Any = UnpickLanguage
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickLexerAdapter.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickLexerAdapter.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickLexerAdapter.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,26 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.UnpickLexer
+import com.intellij.lexer.FlexAdapter
+
+class UnpickLexerAdapter : FlexAdapter(UnpickLexer())
Index: src/main/kotlin/platform/minecraft/unpick/UnpickLiterals.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickLiterals.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickLiterals.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,213 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.intellij.psi.tree.IElementType
+import org.jetbrains.annotations.Nls
+
+/**
+ * Parsing of unpick literals, following the behavior of the reference implementation.
+ */
+object UnpickLiterals {
+ sealed interface Result {
+ data class Value(val value: Any) : Result
+ data class Error(@Nls val message: String) : Result
+ }
+
+ /**
+ * Parses the literal with the given token type and text. If [negated] is true, the literal is the direct operand
+ * of a unary minus, which allows it to be one larger than the maximum positive value of its type. As with the
+ * reference implementation, the returned value is not negated (although it may overflow).
+ */
+ fun parse(tokenType: IElementType, text: String, negated: Boolean): Result {
+ return when (tokenType) {
+ UnpickTypes.INTEGER -> parseInt(text, negated)
+ UnpickTypes.LONG -> parseLong(text.dropLast(1), negated)
+ UnpickTypes.FLOAT -> parseFloat(text.dropLast(1))
+ UnpickTypes.DOUBLE -> parseDouble(text)
+ UnpickTypes.CHAR -> parseChar(text)
+ UnpickTypes.STRING -> parseString(text)
+ else -> Result.Error(MCDevBundle("minecraft.unpick.literal.malformed_number"))
+ }
+ }
+
+ /**
+ * Parses an integer literal such as a parameter index, returning `null` if it is invalid.
+ */
+ fun parseInt(text: String): Int? = (parseInt(text, false) as? Result.Value)?.value as? Int
+
+ fun dataTypeOf(tokenType: IElementType): DataType? {
+ return when (tokenType) {
+ UnpickTypes.INTEGER -> DataType.INT
+ UnpickTypes.LONG -> DataType.LONG
+ UnpickTypes.FLOAT -> DataType.FLOAT
+ UnpickTypes.DOUBLE -> DataType.DOUBLE
+ UnpickTypes.CHAR -> DataType.CHAR
+ UnpickTypes.STRING -> DataType.STRING
+ else -> null
+ }
+ }
+
+ private data class Radix(val digits: String, val radix: Int)
+
+ private fun splitRadix(text: String): Radix {
+ return when {
+ text.startsWith("0x") || text.startsWith("0X") -> Radix(text.substring(2), 16)
+ text.startsWith("0b") || text.startsWith("0B") -> Radix(text.substring(2), 2)
+ text.startsWith("0") && text.length > 1 -> Radix(text.substring(1), 8)
+ else -> Radix(text, 10)
+ }
+ }
+
+ private fun parseInt(text: String, negated: Boolean): Result {
+ val (digits, radix) = splitRadix(text)
+ val signed = (if (negated) "-$digits" else digits).toIntOrNull(radix)
+ if (signed != null) {
+ return Result.Value(if (negated) -signed else signed)
+ }
+ // Non-decimal literals may use all the bits of the type, like in Java
+ if (!negated && radix != 10) {
+ digits.toUIntOrNull(radix)?.let { return Result.Value(it.toInt()) }
+ }
+ return Result.Error(MCDevBundle("minecraft.unpick.literal.integer_out_of_bounds"))
+ }
+
+ private fun parseLong(text: String, negated: Boolean): Result {
+ val (digits, radix) = splitRadix(text)
+ val signed = (if (negated) "-$digits" else digits).toLongOrNull(radix)
+ if (signed != null) {
+ return Result.Value(if (negated) -signed else signed)
+ }
+ if (!negated && radix != 10) {
+ digits.toULongOrNull(radix)?.let { return Result.Value(it.toLong()) }
+ }
+ return Result.Error(MCDevBundle("minecraft.unpick.literal.long_out_of_bounds"))
+ }
+
+ private fun parseFloat(text: String): Result {
+ val value = text.toFloatOrNull()
+ ?: return Result.Error(MCDevBundle("minecraft.unpick.literal.malformed_number"))
+ if (!value.isFinite()) {
+ return Result.Error(MCDevBundle("minecraft.unpick.literal.float_out_of_bounds"))
+ }
+ return Result.Value(value)
+ }
+
+ private fun parseDouble(text: String): Result {
+ val value = text.toDoubleOrNull()
+ ?: return Result.Error(MCDevBundle("minecraft.unpick.literal.malformed_number"))
+ if (!value.isFinite()) {
+ return Result.Error(MCDevBundle("minecraft.unpick.literal.double_out_of_bounds"))
+ }
+ return Result.Value(value)
+ }
+
+ private fun parseChar(text: String): Result {
+ if (text.length < 2 || !isTerminated(text)) {
+ return Result.Error(MCDevBundle("minecraft.unpick.literal.unterminated_char"))
+ }
+ val unquoted = unquote(text) ?: return Result.Error(MCDevBundle("minecraft.unpick.literal.illegal_escape"))
+ return when (unquoted.length) {
+ 0 -> Result.Error(MCDevBundle("minecraft.unpick.literal.empty_char"))
+ 1 -> Result.Value(unquoted[0])
+ else -> Result.Error(MCDevBundle("minecraft.unpick.literal.char_too_long"))
+ }
+ }
+
+ private fun parseString(text: String): Result {
+ if (text.length < 2 || !isTerminated(text)) {
+ return Result.Error(MCDevBundle("minecraft.unpick.literal.unterminated_string"))
+ }
+ val unquoted = unquote(text) ?: return Result.Error(MCDevBundle("minecraft.unpick.literal.illegal_escape"))
+ return Result.Value(unquoted)
+ }
+
+ private fun isTerminated(text: String): Boolean {
+ // The lexer only allows the quote character to appear at the end, unless it's escaped
+ val quote = text[0]
+ if (text.last() != quote) {
+ return false
+ }
+ var i = 1
+ while (i < text.length - 1) {
+ if (text[i] == '\\') {
+ i++
+ }
+ i++
+ }
+ return i == text.length - 1
+ }
+
+ /**
+ * Removes the quotes from the given literal and processes escape sequences. Returns `null` if there is an illegal
+ * escape sequence. Unicode escapes are treated as escape sequences rather than being preprocessed like in Java.
+ */
+ private fun unquote(text: String): String? {
+ val result = StringBuilder(text.length - 2)
+ var i = 1
+ val end = text.length - 1
+ while (i < end) {
+ val c = text[i]
+ if (c != '\\') {
+ result.append(c)
+ i++
+ continue
+ }
+ i++
+ if (i >= end) {
+ return null
+ }
+ when (val escape = text[i]) {
+ 'b' -> result.append('\b')
+ 't' -> result.append('\t')
+ 'n' -> result.append('\n')
+ 'f' -> result.append('\u000c')
+ 'r' -> result.append('\r')
+ '"', '\'', '\\' -> result.append(escape)
+ 'u' -> {
+ while (i < end && text[i] == 'u') {
+ i++
+ }
+ if (i + 4 > end) {
+ return null
+ }
+ val code = text.substring(i, i + 4).toIntOrNull(16) ?: return null
+ result.append(code.toChar())
+ i += 3
+ }
+ in '0'..'7' -> {
+ val maxCount = if (escape <= '3') 3 else 2
+ var count = 0
+ while (count < maxCount && i + count < end && text[i + count] in '0'..'7') {
+ count++
+ }
+ result.append(text.substring(i, i + count).toInt(8).toChar())
+ i += count - 1
+ }
+ else -> return null
+ }
+ i++
+ }
+ return result.toString()
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickParserDefinition.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickParserDefinition.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickParserDefinition.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,90 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.parser.UnpickParser
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.intellij.lang.ASTNode
+import com.intellij.lang.LanguageUtil
+import com.intellij.lang.ParserDefinition
+import com.intellij.lang.PsiParser
+import com.intellij.lexer.Lexer
+import com.intellij.openapi.project.Project
+import com.intellij.psi.FileViewProvider
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiFile
+import com.intellij.psi.TokenType
+import com.intellij.psi.tree.IFileElementType
+import com.intellij.psi.tree.TokenSet
+
+class UnpickParserDefinition : ParserDefinition {
+
+ override fun createLexer(project: Project): Lexer = UnpickLexerAdapter()
+ override fun createParser(project: Project): PsiParser = UnpickParser()
+ override fun getFileNodeType(): IFileElementType = TokenSets.FILE
+ override fun getWhitespaceTokens(): TokenSet = TokenSets.WHITE_SPACES
+ override fun getCommentTokens(): TokenSet = TokenSets.COMMENTS
+ override fun getStringLiteralElements(): TokenSet = TokenSets.STRINGS
+ override fun createElement(node: ASTNode): PsiElement = UnpickTypes.Factory.createElement(node)
+ override fun createFile(viewProvider: FileViewProvider): PsiFile = UnpickFile(viewProvider)
+
+ override fun spaceExistenceTypeBetweenTokens(left: ASTNode, right: ASTNode): ParserDefinition.SpaceRequirements {
+ return LanguageUtil.canStickTokensTogetherByLexer(left, right, UnpickLexerAdapter())
+ }
+
+ object TokenSets {
+ val WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE)
+ val COMMENTS = TokenSet.create(UnpickTypes.COMMENT, UnpickTypes.DOC_COMMENT)
+ val STRINGS = TokenSet.create(UnpickTypes.STRING, UnpickTypes.CHAR)
+ val IDENTIFIERS = TokenSet.create(UnpickTypes.IDENTIFIER)
+ val NUMBERS = TokenSet.create(
+ UnpickTypes.INTEGER,
+ UnpickTypes.LONG,
+ UnpickTypes.FLOAT,
+ UnpickTypes.DOUBLE,
+ UnpickTypes.MALFORMED_NUMBER,
+ )
+ val ITEM_KEYWORDS = TokenSet.create(
+ UnpickTypes.UNPICK_KW,
+ UnpickTypes.GROUP_KW,
+ UnpickTypes.TARGET_METHOD_KW,
+ UnpickTypes.TARGET_FIELD_KW,
+ UnpickTypes.TARGET_ANNOTATION_KW,
+ )
+ val OPERATORS = TokenSet.create(
+ UnpickTypes.SHL,
+ UnpickTypes.USHR,
+ UnpickTypes.SHR,
+ UnpickTypes.PIPE,
+ UnpickTypes.CARET,
+ UnpickTypes.AMPERSAND,
+ UnpickTypes.PLUS,
+ UnpickTypes.MINUS,
+ UnpickTypes.STAR,
+ UnpickTypes.SLASH,
+ UnpickTypes.PERCENT,
+ UnpickTypes.TILDE,
+ UnpickTypes.COLON,
+ )
+
+ val FILE = IFileElementType(UnpickLanguage)
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickRenameGroupProcessor.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickRenameGroupProcessor.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickRenameGroupProcessor.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,41 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.intellij.psi.PsiElement
+import com.intellij.refactoring.rename.RenamePsiElementProcessor
+
+/**
+ * A group may be defined in several places, renaming one definition renames all of them.
+ */
+class UnpickRenameGroupProcessor : RenamePsiElementProcessor() {
+ override fun canProcessElement(element: PsiElement) = element is UnpickGroupDefinition && element.name != null
+
+ override fun prepareRenaming(element: PsiElement, newName: String, allRenames: MutableMap) {
+ val definition = element as? UnpickGroupDefinition ?: return
+ for (other in UnpickGroups.findDefinitions(definition, definition.name ?: return)) {
+ if (other != definition) {
+ allRenames[other] = newName
+ }
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickSyntaxHighlighter.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickSyntaxHighlighter.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickSyntaxHighlighter.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,124 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickParserDefinition.TokenSets
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.intellij.openapi.editor.DefaultLanguageHighlighterColors
+import com.intellij.openapi.editor.HighlighterColors
+import com.intellij.openapi.editor.colors.TextAttributesKey
+import com.intellij.openapi.fileTypes.SyntaxHighlighterBase
+import com.intellij.psi.TokenType
+import com.intellij.psi.tree.IElementType
+
+class UnpickSyntaxHighlighter : SyntaxHighlighterBase() {
+
+ override fun getHighlightingLexer() = UnpickLexerAdapter()
+
+ override fun getTokenHighlights(tokenType: IElementType): Array =
+ when (tokenType) {
+ in TokenSets.ITEM_KEYWORDS, UnpickTypes.KEYWORD -> KEYWORD_KEYS
+ in TokenSets.NUMBERS -> NUMBER_KEYS
+ UnpickTypes.STRING, UnpickTypes.CHAR -> STRING_KEYS
+ UnpickTypes.METHOD_DESCRIPTOR, UnpickTypes.FIELD_DESCRIPTOR -> DESCRIPTOR_KEYS
+ in TokenSets.OPERATORS -> OPERATOR_KEYS
+ UnpickTypes.LPAREN, UnpickTypes.RPAREN -> PARENTHESES_KEYS
+ UnpickTypes.DOT -> DOT_KEYS
+ UnpickTypes.AT -> ATTRIBUTE_KEYS
+ UnpickTypes.COMMENT -> COMMENT_KEYS
+ UnpickTypes.DOC_COMMENT -> DOC_COMMENT_KEYS
+ UnpickTypes.UNSUPPORTED_BODY -> UNSUPPORTED_KEYS
+ TokenType.BAD_CHARACTER -> BAD_CHARACTER_KEYS
+ else -> EMPTY_KEYS
+ }
+
+ companion object {
+ val KEYWORD =
+ TextAttributesKey.createTextAttributesKey("UNPICK_KEYWORD", DefaultLanguageHighlighterColors.KEYWORD)
+ val NUMBER =
+ TextAttributesKey.createTextAttributesKey("UNPICK_NUMBER", DefaultLanguageHighlighterColors.NUMBER)
+ val STRING =
+ TextAttributesKey.createTextAttributesKey("UNPICK_STRING", DefaultLanguageHighlighterColors.STRING)
+ val DESCRIPTOR =
+ TextAttributesKey.createTextAttributesKey("UNPICK_DESCRIPTOR", DefaultLanguageHighlighterColors.STRING)
+ val OPERATOR =
+ TextAttributesKey.createTextAttributesKey(
+ "UNPICK_OPERATOR",
+ DefaultLanguageHighlighterColors.OPERATION_SIGN,
+ )
+ val PARENTHESES =
+ TextAttributesKey.createTextAttributesKey(
+ "UNPICK_PARENTHESES",
+ DefaultLanguageHighlighterColors.PARENTHESES,
+ )
+ val DOT =
+ TextAttributesKey.createTextAttributesKey("UNPICK_DOT", DefaultLanguageHighlighterColors.DOT)
+ val ATTRIBUTE =
+ TextAttributesKey.createTextAttributesKey("UNPICK_ATTRIBUTE", DefaultLanguageHighlighterColors.METADATA)
+ val COMMENT =
+ TextAttributesKey.createTextAttributesKey("UNPICK_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT)
+ val DOC_COMMENT =
+ TextAttributesKey.createTextAttributesKey(
+ "UNPICK_DOC_COMMENT",
+ DefaultLanguageHighlighterColors.DOC_COMMENT,
+ )
+ val UNSUPPORTED =
+ TextAttributesKey.createTextAttributesKey(
+ "UNPICK_UNSUPPORTED",
+ DefaultLanguageHighlighterColors.LINE_COMMENT,
+ )
+ val BAD_CHARACTER =
+ TextAttributesKey.createTextAttributesKey("UNPICK_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER)
+
+ // Only applied by the annotator
+ val GROUP_NAME =
+ TextAttributesKey.createTextAttributesKey("UNPICK_GROUP_NAME", DefaultLanguageHighlighterColors.CONSTANT)
+ val CLASS_NAME =
+ TextAttributesKey.createTextAttributesKey(
+ "UNPICK_CLASS_NAME",
+ DefaultLanguageHighlighterColors.CLASS_REFERENCE,
+ )
+ val FIELD_NAME =
+ TextAttributesKey.createTextAttributesKey(
+ "UNPICK_FIELD_NAME",
+ DefaultLanguageHighlighterColors.STATIC_FIELD,
+ )
+ val METHOD_NAME =
+ TextAttributesKey.createTextAttributesKey(
+ "UNPICK_METHOD_NAME",
+ DefaultLanguageHighlighterColors.STATIC_METHOD,
+ )
+
+ private val KEYWORD_KEYS = arrayOf(KEYWORD)
+ private val NUMBER_KEYS = arrayOf(NUMBER)
+ private val STRING_KEYS = arrayOf(STRING)
+ private val DESCRIPTOR_KEYS = arrayOf(DESCRIPTOR)
+ private val OPERATOR_KEYS = arrayOf(OPERATOR)
+ private val PARENTHESES_KEYS = arrayOf(PARENTHESES)
+ private val DOT_KEYS = arrayOf(DOT)
+ private val ATTRIBUTE_KEYS = arrayOf(ATTRIBUTE)
+ private val COMMENT_KEYS = arrayOf(COMMENT)
+ private val DOC_COMMENT_KEYS = arrayOf(DOC_COMMENT)
+ private val UNSUPPORTED_KEYS = arrayOf(UNSUPPORTED)
+ private val BAD_CHARACTER_KEYS = arrayOf(BAD_CHARACTER)
+ private val EMPTY_KEYS = emptyArray()
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/UnpickSyntaxHighlighterFactory.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/UnpickSyntaxHighlighterFactory.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/UnpickSyntaxHighlighterFactory.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,29 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.vfs.VirtualFile
+
+class UnpickSyntaxHighlighterFactory : SyntaxHighlighterFactory() {
+ override fun getSyntaxHighlighter(project: Project?, virtualFile: VirtualFile?) = UnpickSyntaxHighlighter()
+}
Index: src/main/kotlin/platform/minecraft/unpick/eval/UnpickExpressionEvaluator.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/eval/UnpickExpressionEvaluator.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/eval/UnpickExpressionEvaluator.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,482 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.eval
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.DataType
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickBitNotExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickCastExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickFieldExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupConstant
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickLiteralExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickNegateExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickParenExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickBinaryExpressionMixin
+import com.intellij.psi.CommonClassNames
+import com.intellij.psi.JavaPsiFacade
+import com.intellij.psi.JavaTokenType
+import com.intellij.psi.PsiClassObjectAccessExpression
+import com.intellij.psi.PsiCompiledElement
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiField
+import com.intellij.psi.PsiLiteralExpression
+import com.intellij.psi.PsiModifier
+import com.intellij.psi.PsiPrimitiveType
+import com.intellij.psi.PsiReferenceExpression
+import com.intellij.psi.PsiTypes
+import com.intellij.psi.util.CachedValueProvider
+import com.intellij.psi.util.CachedValuesManager
+import com.intellij.psi.util.PsiModificationTracker
+import com.intellij.psi.util.PsiTreeUtil
+import com.intellij.psi.util.PsiUtil
+import com.intellij.psi.util.elementType
+
+/**
+ * Evaluates group constants according to the semantics of the Java language, as required by the unpick spec.
+ */
+object UnpickExpressionEvaluator {
+
+ /**
+ * A value produced by a group constant. For a wildcard constant, [wildcardField] is the field the wildcard was
+ * expanded to.
+ */
+ class EvaluatedConstant(val constant: UnpickGroupConstant, val value: UnpickValue, val wildcardField: PsiField?)
+
+ class Result(val values: List, val problems: Set)
+
+ fun evaluate(constant: UnpickGroupConstant): Result {
+ return CachedValuesManager.getCachedValue(constant) {
+ CachedValueProvider.Result.create(doEvaluate(constant), PsiModificationTracker.MODIFICATION_COUNT)
+ }
+ }
+
+ private fun doEvaluate(constant: UnpickGroupConstant): Result {
+ val expression = constant.expression
+ val groupType = constant.groupDefinition?.dataType?.dataType?.takeIf { it.isValidGroupType }
+ val wildcards = PsiTreeUtil.findChildrenOfType(constant, UnpickFieldExpression::class.java)
+ .filter { it.isWildcard }
+ if (wildcards.size > 1) {
+ // Reported by the annotator
+ return Result(emptyList(), emptySet())
+ }
+
+ val problems = LinkedHashSet()
+ val values = mutableListOf()
+
+ val wildcard = wildcards.singleOrNull()
+ if (wildcard == null) {
+ Evaluation(groupType, null, problems).evaluate(expression)?.let { value ->
+ values += EvaluatedConstant(constant, value, null)
+ checkGroupType(expression, value, groupType, problems)
+ }
+ } else {
+ if (wildcard.className.resolveClass() == null) {
+ return Result(emptyList(), emptySet())
+ }
+ val fields = findWildcardFields(wildcard, groupType)
+ if (fields.isEmpty()) {
+ problems += UnpickProblem.Field(
+ wildcard.wildcardElement ?: wildcard,
+ MCDevBundle("minecraft.unpick.eval.wildcard_no_match", wildcard.className.qualifiedName),
+ )
+ }
+ for (field in fields) {
+ val value = Evaluation(groupType, field, problems).evaluate(expression) ?: continue
+ values += EvaluatedConstant(constant, value, field)
+ checkGroupType(expression, value, groupType, problems)
+ }
+ }
+
+ return Result(values, problems)
+ }
+
+ private fun checkGroupType(
+ expression: UnpickExpression,
+ value: UnpickValue,
+ groupType: DataType?,
+ problems: MutableSet,
+ ) {
+ if (groupType == null || value.type.canWidenTo(groupType)) {
+ return
+ }
+ problems += UnpickProblem.Type(
+ expression,
+ MCDevBundle("minecraft.unpick.eval.incompatible_with_group", value.type.keyword, groupType.keyword),
+ )
+ }
+
+ /**
+ * Finds the fields matching a wildcard field expression, as defined by the unpick spec.
+ */
+ fun findWildcardFields(expression: UnpickFieldExpression, groupType: DataType?): List {
+ val psiClass = expression.className.resolveClass() ?: return emptyList()
+ val explicitType = expression.explicitDataType?.dataType
+ val isStatic = !expression.isInstance
+ return psiClass.fields.filter { field ->
+ if (field.hasModifierProperty(PsiModifier.STATIC) != isStatic) {
+ return@filter false
+ }
+ val fieldType = DataType.fromPsiType(field.type) ?: return@filter false
+ if (explicitType != null) {
+ fieldType == explicitType
+ } else {
+ groupType != null && fieldType.canWidenTo(groupType)
+ }
+ }
+ }
+
+ private const val MAX_CLASS_FIELD_DEPTH = 8
+
+ private class Evaluation(
+ private val groupType: DataType?,
+ private val wildcardField: PsiField?,
+ private val problems: MutableSet,
+ ) {
+ fun evaluate(expression: UnpickExpression?): UnpickValue? {
+ return when (expression) {
+ null -> null
+ is UnpickLiteralExpression -> {
+ val type = expression.dataType ?: return null
+ val value = expression.value ?: return null
+ UnpickValue(type, value)
+ }
+ is UnpickParenExpression -> evaluate(expression.operand)
+ is UnpickNegateExpression -> evaluateNegate(expression)
+ is UnpickBitNotExpression -> evaluateBitNot(expression)
+ is UnpickCastExpression -> evaluateCast(expression)
+ is UnpickFieldExpression -> evaluateField(expression)
+ is UnpickBinaryExpressionMixin -> evaluateBinary(expression)
+ else -> null
+ }
+ }
+
+ private fun typeProblem(element: PsiElement, key: String, vararg params: Any) {
+ problems += UnpickProblem.Type(element, MCDevBundle(key, *params))
+ }
+
+ private fun fieldProblem(element: PsiElement, key: String, vararg params: Any) {
+ problems += UnpickProblem.Field(element, MCDevBundle(key, *params))
+ }
+
+ private fun evaluateNegate(expression: UnpickNegateExpression): UnpickValue? {
+ val operand = evaluate(expression.operand) ?: return null
+ if (!operand.type.isPrimitive) {
+ typeProblem(expression, "minecraft.unpick.eval.bad_unary_operand", "-", operand.type.keyword)
+ return null
+ }
+ val promoted = operand.convertTo(unaryPromote(operand.type))
+ if (!promoted.isKnown) {
+ return promoted
+ }
+ return when (val value = promoted.value) {
+ is Int -> UnpickValue(DataType.INT, -value)
+ is Long -> UnpickValue(DataType.LONG, -value)
+ is Float -> UnpickValue(DataType.FLOAT, -value)
+ is Double -> UnpickValue(DataType.DOUBLE, -value)
+ else -> null
+ }
+ }
+
+ private fun evaluateBitNot(expression: UnpickBitNotExpression): UnpickValue? {
+ val operand = evaluate(expression.operand) ?: return null
+ if (!operand.type.isIntegral) {
+ typeProblem(expression, "minecraft.unpick.eval.bad_unary_operand", "~", operand.type.keyword)
+ return null
+ }
+ val promoted = operand.convertTo(unaryPromote(operand.type))
+ if (!promoted.isKnown) {
+ return promoted
+ }
+ return when (val value = promoted.value) {
+ is Int -> UnpickValue(DataType.INT, value.inv())
+ is Long -> UnpickValue(DataType.LONG, value.inv())
+ else -> null
+ }
+ }
+
+ private fun evaluateCast(expression: UnpickCastExpression): UnpickValue? {
+ val operand = evaluate(expression.operand)
+ val target = expression.dataType.dataType ?: return null
+ if (operand == null) {
+ return null
+ }
+ if (!target.isPrimitive || !operand.type.isPrimitive) {
+ if (target != operand.type) {
+ typeProblem(expression, "minecraft.unpick.eval.bad_cast", operand.type.keyword, target.keyword)
+ return null
+ }
+ }
+ return operand.convertTo(target)
+ }
+
+ private fun evaluateBinary(expression: UnpickBinaryExpressionMixin): UnpickValue? {
+ val left = evaluate(expression.getLeft())
+ val right = evaluate(expression.getRight())
+ if (left == null || right == null) {
+ return null
+ }
+ val operator = expression.operator
+ val operatorText = expression.operatorToken.text
+
+ if (operator == UnpickTypes.PLUS && (left.type == DataType.STRING || right.type == DataType.STRING)) {
+ val leftString = left.toJavaString()
+ val rightString = right.toJavaString()
+ if (leftString == null || rightString == null) {
+ return UnpickValue.unknown(DataType.STRING)
+ }
+ return UnpickValue(DataType.STRING, leftString + rightString)
+ }
+
+ val isArithmetic = operator == UnpickTypes.PLUS || operator == UnpickTypes.MINUS ||
+ operator == UnpickTypes.STAR || operator == UnpickTypes.SLASH || operator == UnpickTypes.PERCENT
+ val isShift = operator == UnpickTypes.SHL || operator == UnpickTypes.SHR || operator == UnpickTypes.USHR
+ val valid = if (isArithmetic) {
+ left.type.isPrimitive && right.type.isPrimitive
+ } else {
+ left.type.isIntegral && right.type.isIntegral
+ }
+ if (!valid) {
+ typeProblem(
+ expression,
+ "minecraft.unpick.eval.bad_binary_operands",
+ operatorText,
+ left.type.keyword,
+ right.type.keyword,
+ )
+ return null
+ }
+
+ if (isShift) {
+ val resultType = unaryPromote(left.type)
+ if (!left.isKnown || !right.isKnown) {
+ return UnpickValue.unknown(resultType)
+ }
+ val distance = right.asLong().toInt()
+ val value = left.convertTo(resultType).value
+ return when (value) {
+ is Int -> UnpickValue(
+ DataType.INT,
+ when (operator) {
+ UnpickTypes.SHL -> value shl distance
+ UnpickTypes.SHR -> value shr distance
+ else -> value ushr distance
+ },
+ )
+ is Long -> UnpickValue(
+ DataType.LONG,
+ when (operator) {
+ UnpickTypes.SHL -> value shl distance
+ UnpickTypes.SHR -> value shr distance
+ else -> value ushr distance
+ },
+ )
+ else -> null
+ }
+ }
+
+ val resultType = binaryPromote(left.type, right.type)
+ if (!left.isKnown || !right.isKnown) {
+ return UnpickValue.unknown(resultType)
+ }
+ val l = left.convertTo(resultType).value
+ val r = right.convertTo(resultType).value
+
+ if ((operator == UnpickTypes.SLASH || operator == UnpickTypes.PERCENT) && resultType.isIntegral &&
+ right.asLong() == 0L
+ ) {
+ problems += UnpickProblem.DivisionByZero(
+ expression.getRight() ?: expression,
+ MCDevBundle("minecraft.unpick.eval.division_by_zero"),
+ )
+ return UnpickValue.unknown(resultType)
+ }
+
+ val result: Any = when (operator) {
+ UnpickTypes.PLUS -> arithmetic(l, r, Int::plus, Long::plus, Float::plus, Double::plus)
+ UnpickTypes.MINUS -> arithmetic(l, r, Int::minus, Long::minus, Float::minus, Double::minus)
+ UnpickTypes.STAR -> arithmetic(l, r, Int::times, Long::times, Float::times, Double::times)
+ UnpickTypes.SLASH -> arithmetic(l, r, Int::div, Long::div, Float::div, Double::div)
+ UnpickTypes.PERCENT -> arithmetic(l, r, Int::rem, Long::rem, Float::rem, Double::rem)
+ UnpickTypes.AMPERSAND -> bitwise(l, r, Int::and, Long::and)
+ UnpickTypes.PIPE -> bitwise(l, r, Int::or, Long::or)
+ UnpickTypes.CARET -> bitwise(l, r, Int::xor, Long::xor)
+ else -> return null
+ }
+ return UnpickValue(resultType, result)
+ }
+
+ private inline fun arithmetic(
+ l: Any?,
+ r: Any?,
+ intOp: (Int, Int) -> Int,
+ longOp: (Long, Long) -> Long,
+ floatOp: (Float, Float) -> Float,
+ doubleOp: (Double, Double) -> Double,
+ ): Any {
+ return when (l) {
+ is Int -> intOp(l, r as Int)
+ is Long -> longOp(l, r as Long)
+ is Float -> floatOp(l, r as Float)
+ else -> doubleOp(l as Double, r as Double)
+ }
+ }
+ private inline fun bitwise(l: Any?, r: Any?, intOp: (Int, Int) -> Int, longOp: (Long, Long) -> Long): Any {
+ return when (l) {
+ is Int -> intOp(l, r as Int)
+ else -> longOp(l as Long, r as Long)
+ }
+ }
+
+ private fun evaluateField(expression: UnpickFieldExpression): UnpickValue? {
+ val field = if (expression.isWildcard) {
+ wildcardField
+ } else {
+ expression.fieldName?.resolveField()
+ } ?: return null
+ val nameElement = expression.fieldName ?: expression.wildcardElement ?: expression
+ val name = field.name
+
+ val isStatic = field.hasModifierProperty(PsiModifier.STATIC)
+ if (isStatic && expression.isInstance) {
+ fieldProblem(nameElement, "minecraft.unpick.eval.field_is_static", name)
+ } else if (!isStatic && !expression.isInstance) {
+ fieldProblem(nameElement, "minecraft.unpick.eval.field_not_static", name)
+ }
+ val fieldType = DataType.fromPsiType(field.type)
+ if (fieldType == null) {
+ fieldProblem(
+ nameElement,
+ "minecraft.unpick.eval.field_unsupported_type",
+ name,
+ field.type.presentableText,
+ )
+ return null
+ }
+ if (!field.hasModifierProperty(PsiModifier.FINAL)) {
+ fieldProblem(nameElement, "minecraft.unpick.eval.field_not_final", name)
+ return UnpickValue.unknown(fieldType)
+ }
+ val explicitType = expression.explicitDataType?.dataType
+ if (explicitType != null && explicitType != fieldType) {
+ fieldProblem(
+ expression.explicitDataType ?: nameElement,
+ "minecraft.unpick.eval.field_type_mismatch",
+ name,
+ fieldType.keyword,
+ explicitType.keyword,
+ )
+ }
+
+ return when (fieldType) {
+ DataType.CLASS -> evaluateClassField(field)
+ DataType.STRING -> {
+ val value = field.computeConstantValue()
+ when {
+ value is String -> UnpickValue(DataType.STRING, value)
+ isNullInitializer(field) -> UnpickValue(DataType.STRING, null)
+ // Compiled fields initialized to null have no constant value to tell us that
+ field is PsiCompiledElement -> UnpickValue.unknown(DataType.STRING)
+ else -> {
+ fieldProblem(nameElement, "minecraft.unpick.eval.field_not_constant", name)
+ UnpickValue.unknown(DataType.STRING)
+ }
+ }
+ }
+ else -> {
+ val value = field.computeConstantValue()
+ val valueType = when (value) {
+ is Byte -> DataType.BYTE
+ is Short -> DataType.SHORT
+ is Char -> DataType.CHAR
+ is Int -> DataType.INT
+ is Long -> DataType.LONG
+ is Float -> DataType.FLOAT
+ is Double -> DataType.DOUBLE
+ else -> null
+ }
+ if (valueType != null) {
+ UnpickValue(valueType, value).convertTo(fieldType)
+ } else {
+ fieldProblem(nameElement, "minecraft.unpick.eval.field_not_constant", name)
+ UnpickValue.unknown(fieldType)
+ }
+ }
+ }
+ }
+
+ private fun isNullInitializer(field: PsiField): Boolean {
+ val initializer = PsiUtil.skipParenthesizedExprDown(field.initializer)
+ return initializer is PsiLiteralExpression &&
+ initializer.firstChild.elementType == JavaTokenType.NULL_KEYWORD
+ }
+
+ private fun evaluateClassField(field: PsiField, depth: Int = 0): UnpickValue {
+ // The TYPE fields of the boxed types are the class objects of the primitive types
+ val containingClass = field.containingClass
+ if (field.name == "TYPE" && containingClass != null) {
+ if (containingClass.qualifiedName == CommonClassNames.JAVA_LANG_VOID) {
+ return UnpickValue(DataType.CLASS, PsiTypes.voidType())
+ }
+ val boxedType = JavaPsiFacade.getElementFactory(field.project).createType(containingClass)
+ PsiPrimitiveType.getUnboxedType(boxedType)?.let { return UnpickValue(DataType.CLASS, it) }
+ }
+ return when (val initializer = PsiUtil.skipParenthesizedExprDown(field.initializer)) {
+ is PsiClassObjectAccessExpression -> UnpickValue(DataType.CLASS, initializer.operand.type)
+ // Follow references to other class constants, such as Integer.TYPE
+ is PsiReferenceExpression -> {
+ val referenced = initializer.resolve() as? PsiField
+ if (referenced != null && depth < MAX_CLASS_FIELD_DEPTH &&
+ DataType.fromPsiType(referenced.type) == DataType.CLASS
+ ) {
+ evaluateClassField(referenced, depth + 1).takeUnless { it.value is PsiField }
+ ?: UnpickValue(DataType.CLASS, field)
+ } else {
+ UnpickValue(DataType.CLASS, field)
+ }
+ }
+ is PsiLiteralExpression -> if (isNullInitializer(field)) {
+ UnpickValue(DataType.CLASS, null)
+ } else {
+ UnpickValue(DataType.CLASS, field)
+ }
+ else -> UnpickValue(DataType.CLASS, field)
+ }
+ }
+
+ private fun unaryPromote(type: DataType): DataType {
+ return when (type) {
+ DataType.BYTE, DataType.SHORT, DataType.CHAR -> DataType.INT
+ else -> type
+ }
+ }
+
+ private fun binaryPromote(a: DataType, b: DataType): DataType {
+ return when {
+ a == DataType.DOUBLE || b == DataType.DOUBLE -> DataType.DOUBLE
+ a == DataType.FLOAT || b == DataType.FLOAT -> DataType.FLOAT
+ a == DataType.LONG || b == DataType.LONG -> DataType.LONG
+ else -> DataType.INT
+ }
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/eval/UnpickProblem.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/eval/UnpickProblem.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/eval/UnpickProblem.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,45 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.eval
+
+import com.intellij.psi.PsiElement
+import org.jetbrains.annotations.Nls
+
+/**
+ * A problem found while evaluating a group constant. Each kind of problem is reported by a separate inspection.
+ */
+sealed class UnpickProblem(val element: PsiElement, @Nls val message: String) {
+ /** A problem with the field referenced by a field expression. */
+ class Field(element: PsiElement, @Nls message: String) : UnpickProblem(element, message)
+
+ /** An operation applied to incompatible types, or a constant incompatible with its group. */
+ class Type(element: PsiElement, @Nls message: String) : UnpickProblem(element, message)
+
+ /** Integral division or remainder by zero. */
+ class DivisionByZero(element: PsiElement, @Nls message: String) : UnpickProblem(element, message)
+
+ override fun equals(other: Any?): Boolean {
+ return other is UnpickProblem && other.javaClass == javaClass && other.element == element &&
+ other.message == message
+ }
+
+ override fun hashCode() = 31 * element.hashCode() + message.hashCode()
+}
Index: src/main/kotlin/platform/minecraft/unpick/eval/UnpickValue.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/eval/UnpickValue.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/eval/UnpickValue.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,131 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.eval
+
+import com.demonwav.mcdev.platform.minecraft.unpick.DataType
+import com.intellij.psi.PsiField
+import com.intellij.psi.PsiType
+
+/**
+ * The result of evaluating an unpick expression.
+ *
+ * The [value] is represented as a Kotlin [Byte], [Short], [Char], [Int], [Long], [Float], [Double] or [String] for the
+ * corresponding data types, or `null` for a `null` `String` or `Class` constant. A `Class` constant is represented by
+ * the [PsiType] it refers to if that can be determined, or otherwise by the [PsiField] it was read from.
+ *
+ * If [isKnown] is false then only the type of the expression is known, not its value.
+ */
+class UnpickValue(val type: DataType, val value: Any?, val isKnown: Boolean = true) {
+
+ fun convertTo(target: DataType): UnpickValue {
+ if (target == type || !isKnown || !type.isPrimitive || !target.isPrimitive) {
+ return UnpickValue(target, value, isKnown)
+ }
+ return UnpickValue(target, convert(value!!, target))
+ }
+
+ fun asLong(): Long = when (value) {
+ is Char -> value.code.toLong()
+ is Number -> value.toLong()
+ else -> throw IllegalStateException("Not an integral value: $value")
+ }
+
+ fun asDouble(): Double = when (value) {
+ is Char -> value.code.toDouble()
+ is Number -> value.toDouble()
+ else -> throw IllegalStateException("Not a numeric value: $value")
+ }
+
+ /**
+ * Converts the value to a string the same way Java string concatenation would.
+ */
+ fun toJavaString(): String? {
+ if (!isKnown) {
+ return null
+ }
+ return when (value) {
+ null -> "null"
+ is String -> value
+ is Char -> value.toString()
+ is Number -> value.toString()
+ else -> null
+ }
+ }
+
+ /**
+ * A human-readable representation of the value, for use in messages.
+ */
+ fun toDisplayString(): String {
+ return when (value) {
+ null -> "null"
+ is String -> "\"" + value.replace("\\", "\\\\").replace("\"", "\\\"") + "\""
+ is Char -> "'$value'"
+ is Long -> "${value}L"
+ is Float -> "${value}f"
+ is PsiType -> value.presentableText + ".class"
+ is PsiField -> value.containingClass?.name + "." + value.name
+ else -> value.toString()
+ }
+ }
+
+ override fun equals(other: Any?): Boolean {
+ return other is UnpickValue && other.isKnown && isKnown && other.type == type && other.value == value
+ }
+
+ override fun hashCode() = 31 * type.hashCode() + value.hashCode()
+
+ override fun toString() = "UnpickValue(type=$type, value=$value, isKnown=$isKnown)"
+
+ companion object {
+ fun unknown(type: DataType) = UnpickValue(type, null, isKnown = false)
+
+ private fun convert(value: Any, target: DataType): Any {
+ if (value is Float || value is Double) {
+ val d = (value as Number).toDouble()
+ return when (target) {
+ DataType.BYTE -> d.toInt().toByte()
+ DataType.SHORT -> d.toInt().toShort()
+ DataType.CHAR -> d.toInt().toChar()
+ DataType.INT -> d.toInt()
+ DataType.LONG -> d.toLong()
+ DataType.FLOAT -> if (value is Float) value else d.toFloat()
+ DataType.DOUBLE -> d
+ else -> value
+ }
+ }
+ val l = when (value) {
+ is Char -> value.code.toLong()
+ is Number -> value.toLong()
+ else -> return value
+ }
+ return when (target) {
+ DataType.BYTE -> l.toInt().toByte()
+ DataType.SHORT -> l.toInt().toShort()
+ DataType.CHAR -> l.toInt().toChar()
+ DataType.INT -> l.toInt()
+ DataType.LONG -> l
+ DataType.FLOAT -> l.toFloat()
+ DataType.DOUBLE -> l.toDouble()
+ else -> value
+ }
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/index/UnpickGroupIndex.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/index/UnpickGroupIndex.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/index/UnpickGroupIndex.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,62 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.index
+
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickFile
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickFileType
+import com.intellij.util.indexing.DataIndexer
+import com.intellij.util.indexing.DefaultFileTypeSpecificInputFilter
+import com.intellij.util.indexing.FileBasedIndex
+import com.intellij.util.indexing.FileContent
+import com.intellij.util.indexing.ID
+import com.intellij.util.indexing.ScalarIndexExtension
+import com.intellij.util.io.EnumeratorStringDescriptor
+import com.intellij.util.io.KeyDescriptor
+
+/**
+ * Indexes the names of the groups defined in each unpick file. The default group is indexed under the empty string.
+ */
+class UnpickGroupIndex : ScalarIndexExtension() {
+ override fun getName() = NAME
+
+ override fun getVersion() = 1
+
+ override fun dependsOnFileContent() = true
+
+ override fun getIndexer(): DataIndexer = Indexer
+
+ override fun getInputFilter(): FileBasedIndex.InputFilter = DefaultFileTypeSpecificInputFilter(UnpickFileType)
+
+ override fun getKeyDescriptor(): KeyDescriptor = EnumeratorStringDescriptor.INSTANCE
+
+ private object Indexer : DataIndexer {
+ override fun map(inputData: FileContent): Map {
+ val file = inputData.psiFile as? UnpickFile ?: return emptyMap()
+ return file.groupDefinitions.associate { (it.name ?: DEFAULT_GROUP_KEY) to null }
+ }
+ }
+
+ companion object {
+ val NAME = ID.create("mcdev.UnpickGroupIndex")
+
+ const val DEFAULT_GROUP_KEY = ""
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/inspections/DuplicateUnpickConstantInspection.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/inspections/DuplicateUnpickConstantInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/inspections/DuplicateUnpickConstantInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,111 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.inspections
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickGroups
+import com.demonwav.mcdev.platform.minecraft.unpick.eval.UnpickExpressionEvaluator
+import com.demonwav.mcdev.platform.minecraft.unpick.eval.UnpickExpressionEvaluator.EvaluatedConstant
+import com.demonwav.mcdev.platform.minecraft.unpick.eval.UnpickValue
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickVisitor
+import com.demonwav.mcdev.util.equivalentTo
+import com.intellij.codeInspection.LocalInspectionTool
+import com.intellij.codeInspection.ProblemsHolder
+import com.intellij.psi.PsiElementVisitor
+
+class DuplicateUnpickConstantInspection : LocalInspectionTool() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor =
+ object : UnpickVisitor() {
+ override fun visitGroupDefinition(element: UnpickGroupDefinition) {
+ val groupType = element.dataType?.dataType?.takeIf { it.isValidGroupType } ?: return
+ val scopes = scopeKey(element)
+
+ // Constants only conflict with constants in the same group with the same scope
+ val definitions = UnpickGroups.findDefinitions(element, element.name)
+ .filter { it.dataType?.dataType == groupType && scopeKey(it) == scopes }
+ .ifEmpty { listOf(element) }
+
+ val byValue = HashMap>()
+ for (definition in definitions) {
+ for (constant in definition.groupConstantList) {
+ for (evaluated in UnpickExpressionEvaluator.evaluate(constant).values) {
+ // Constants of the wrong type are reported by UnpickExpressionTypeInspection
+ if (!evaluated.value.type.canWidenTo(groupType)) {
+ continue
+ }
+ val value = evaluated.value.convertTo(groupType)
+ if (value.isKnown) {
+ byValue.getOrPut(value) { mutableListOf() } += evaluated
+ }
+ }
+ }
+ }
+
+ for (constant in element.groupConstantList) {
+ for (evaluated in UnpickExpressionEvaluator.evaluate(constant).values) {
+ if (!evaluated.value.type.canWidenTo(groupType)) {
+ continue
+ }
+ val value = evaluated.value.convertTo(groupType)
+ val other = byValue[value]?.firstOrNull { !it.isSameAs(evaluated) } ?: continue
+ val description = describe(evaluated)
+ val otherDescription = describeOther(other)
+ holder.registerProblem(
+ constant,
+ if (description == null) {
+ MCDevBundle(
+ "inspection.duplicate_unpick_constant.message",
+ value.toDisplayString(),
+ otherDescription,
+ )
+ } else {
+ MCDevBundle(
+ "inspection.duplicate_unpick_constant.wildcard_message",
+ description,
+ value.toDisplayString(),
+ otherDescription,
+ )
+ },
+ )
+ }
+ }
+ }
+
+ private fun EvaluatedConstant.isSameAs(other: EvaluatedConstant): Boolean {
+ return constant equivalentTo other.constant && wildcardField == other.wildcardField
+ }
+
+ /**
+ * Describes the field a wildcard was expanded to, or returns `null` if this isn't a wildcard constant.
+ */
+ private fun describe(constant: EvaluatedConstant): String? {
+ val field = constant.wildcardField ?: return null
+ return "${field.containingClass?.name}.${field.name}"
+ }
+
+ private fun describeOther(constant: EvaluatedConstant) = describe(constant) ?: constant.constant.text
+
+ private fun scopeKey(definition: UnpickGroupDefinition): Set {
+ return definition.scopes.mapTo(HashSet()) { scope -> scope.text.split(Regex("\\s+")).joinToString(" ") }
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/inspections/UnknownUnpickGroupInspection.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/inspections/UnknownUnpickGroupInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/inspections/UnknownUnpickGroupInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,45 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.inspections
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupRef
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickVisitor
+import com.intellij.codeInspection.LocalInspectionTool
+import com.intellij.codeInspection.ProblemHighlightType
+import com.intellij.codeInspection.ProblemsHolder
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiElementVisitor
+
+class UnknownUnpickGroupInspection : LocalInspectionTool() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor =
+ object : UnpickVisitor() {
+ override fun visitGroupRef(element: UnpickGroupRef) {
+ if (element.resolveDefinitions().isEmpty()) {
+ holder.registerProblem(
+ element as PsiElement,
+ MCDevBundle("inspection.unknown_unpick_group.message", element.text),
+ ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
+ )
+ }
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/inspections/UnpickEvaluationInspection.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/inspections/UnpickEvaluationInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/inspections/UnpickEvaluationInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,51 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.inspections
+
+import com.demonwav.mcdev.platform.minecraft.unpick.eval.UnpickExpressionEvaluator
+import com.demonwav.mcdev.platform.minecraft.unpick.eval.UnpickProblem
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupConstant
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickVisitor
+import com.intellij.codeInspection.LocalInspectionTool
+import com.intellij.codeInspection.ProblemsHolder
+import com.intellij.psi.PsiElementVisitor
+
+/**
+ * Reports one kind of problem found by evaluating group constants.
+ */
+abstract class UnpickEvaluationInspection(private val problemClass: Class) : LocalInspectionTool() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor =
+ object : UnpickVisitor() {
+ override fun visitGroupConstant(element: UnpickGroupConstant) {
+ for (problem in UnpickExpressionEvaluator.evaluate(element).problems) {
+ if (problemClass.isInstance(problem)) {
+ holder.registerProblem(problem.element, problem.message)
+ }
+ }
+ }
+ }
+}
+
+class InvalidUnpickConstantFieldInspection : UnpickEvaluationInspection(UnpickProblem.Field::class.java)
+
+class UnpickExpressionTypeInspection : UnpickEvaluationInspection(UnpickProblem.Type::class.java)
+
+class UnpickDivisionByZeroInspection : UnpickEvaluationInspection(UnpickProblem.DivisionByZero::class.java)
Index: src/main/kotlin/platform/minecraft/unpick/inspections/UnpickGroupTypeConflictInspection.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/inspections/UnpickGroupTypeConflictInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/inspections/UnpickGroupTypeConflictInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,54 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.inspections
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickGroups
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickVisitor
+import com.intellij.codeInspection.LocalInspectionTool
+import com.intellij.codeInspection.ProblemsHolder
+import com.intellij.psi.PsiElementVisitor
+
+class UnpickGroupTypeConflictInspection : LocalInspectionTool() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor =
+ object : UnpickVisitor() {
+ override fun visitGroupDefinition(element: UnpickGroupDefinition) {
+ val name = element.name ?: return
+ val dataTypeElement = element.dataType ?: return
+ val dataType = dataTypeElement.dataType ?: return
+ val otherTypes = UnpickGroups.findDefinitions(element, name)
+ .mapNotNull { it.dataType?.dataType }
+ .filter { it != dataType }
+ .distinct()
+ if (otherTypes.isNotEmpty()) {
+ holder.registerProblem(
+ dataTypeElement,
+ MCDevBundle(
+ "inspection.unpick_group_type_conflict.message",
+ name,
+ otherTypes.joinToString(", ") { it.keyword },
+ ),
+ )
+ }
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/inspections/UnpickTargetMismatchInspection.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/inspections/UnpickTargetMismatchInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/inspections/UnpickTargetMismatchInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,142 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.inspections
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.DataType
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickDescriptors
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickLiterals
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupRef
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTargetAnnotation
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTargetField
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTargetMethod
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickVisitor
+import com.demonwav.mcdev.util.descriptor
+import com.intellij.codeInspection.LocalInspectionTool
+import com.intellij.codeInspection.ProblemsHolder
+import com.intellij.psi.PsiElementVisitor
+
+class UnpickTargetMismatchInspection : LocalInspectionTool() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor =
+ object : UnpickVisitor() {
+ override fun visitTargetMethod(element: UnpickTargetMethod) {
+ val descriptor = element.methodDescriptor?.text ?: return
+ val parsed = UnpickDescriptors.parseMethod(descriptor) ?: return
+
+ for (param in element.targetMethodParamList) {
+ val indexElement = param.index ?: continue
+ val index = UnpickLiterals.parseInt(indexElement.text) ?: continue
+ if (index < 0 || index >= parsed.parameters.size) {
+ holder.registerProblem(
+ indexElement,
+ MCDevBundle(
+ "inspection.unpick_target_mismatch.param_out_of_bounds",
+ index,
+ parsed.parameters.size,
+ ),
+ )
+ continue
+ }
+ val paramDescriptor = parsed.parameters[index]
+ checkCompatible(param.groupRef, paramDescriptor) { groupName, groupType ->
+ MCDevBundle(
+ "inspection.unpick_target_mismatch.param_incompatible",
+ index,
+ UnpickDescriptors.toJavaName(paramDescriptor),
+ groupName,
+ groupType.keyword,
+ )
+ }
+ }
+
+ for (ret in element.targetMethodReturnList) {
+ if (parsed.returnType == "V") {
+ holder.registerProblem(
+ ret.firstChild,
+ MCDevBundle("inspection.unpick_target_mismatch.void_return"),
+ )
+ continue
+ }
+ checkCompatible(ret.groupRef, parsed.returnType) { groupName, groupType ->
+ MCDevBundle(
+ "inspection.unpick_target_mismatch.return_incompatible",
+ UnpickDescriptors.toJavaName(parsed.returnType),
+ groupName,
+ groupType.keyword,
+ )
+ }
+ }
+ }
+
+ override fun visitTargetField(element: UnpickTargetField) {
+ val descriptorElement = element.fieldDescriptor ?: return
+ val descriptor = descriptorElement.text
+ if (UnpickDescriptors.validateField(descriptor) != null) {
+ return
+ }
+
+ val field = element.fieldName?.resolveField()
+ val actualDescriptor = field?.descriptor
+ if (field != null && actualDescriptor != null && actualDescriptor != descriptor) {
+ holder.registerProblem(
+ descriptorElement,
+ MCDevBundle("inspection.unpick_target_mismatch.field_descriptor", field.name, actualDescriptor),
+ )
+ }
+
+ checkCompatible(element.groupRef, descriptor) { groupName, groupType ->
+ MCDevBundle(
+ "inspection.unpick_target_mismatch.field_incompatible",
+ UnpickDescriptors.toJavaName(descriptor),
+ groupName,
+ groupType.keyword,
+ )
+ }
+ }
+
+ override fun visitTargetAnnotation(element: UnpickTargetAnnotation) {
+ val className = element.className ?: return
+ val psiClass = className.resolveClass() ?: return
+ if (!psiClass.isAnnotationType) {
+ holder.registerProblem(
+ className,
+ MCDevBundle("inspection.unpick_target_mismatch.not_annotation", className.qualifiedName),
+ )
+ }
+ }
+
+ private inline fun checkCompatible(
+ groupRef: UnpickGroupRef?,
+ targetDescriptor: String,
+ message: (String, DataType) -> String,
+ ) {
+ groupRef ?: return
+ val targetType = DataType.fromDescriptor(targetDescriptor)
+ val groupTypes = groupRef.resolveDefinitions().mapNotNull { it.dataType?.dataType }.distinct()
+ for (groupType in groupTypes) {
+ if (targetType == null || !targetType.isTargetCompatibleWith(groupType)) {
+ holder.registerProblem(groupRef, message(groupRef.text, groupType))
+ return
+ }
+ }
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/inspections/UnresolvedUnpickReferenceInspection.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/inspections/UnresolvedUnpickReferenceInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/inspections/UnresolvedUnpickReferenceInspection.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,93 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.inspections
+
+import com.demonwav.mcdev.asset.MCDevBundle
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickClassName
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickFieldName
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickMethodName
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickPackageName
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickVisitor
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickClassReference
+import com.intellij.codeInspection.LocalInspectionTool
+import com.intellij.codeInspection.ProblemHighlightType
+import com.intellij.codeInspection.ProblemsHolder
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiElementVisitor
+
+class UnresolvedUnpickReferenceInspection : LocalInspectionTool() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor =
+ object : UnpickVisitor() {
+ override fun visitClassName(element: UnpickClassName) {
+ checkClassReferences(element)
+ }
+
+ override fun visitPackageName(element: UnpickPackageName) {
+ checkClassReferences(element)
+ }
+
+ private fun checkClassReferences(element: PsiElement) {
+ // Only report the first unresolved part, the rest can't resolve either
+ val reference = element.references.filterIsInstance()
+ .firstOrNull { it.resolve() == null } ?: return
+ val message = if (reference.isPackage) {
+ MCDevBundle("inspection.unpick_unresolved_reference.package", reference.targetName)
+ } else {
+ MCDevBundle("inspection.unpick_unresolved_reference.class", reference.targetName)
+ }
+ holder.registerProblem(
+ element,
+ message,
+ ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
+ reference.rangeInElement
+ )
+ }
+
+ override fun visitMethodName(element: UnpickMethodName) {
+ val owner = element.ownerClassName ?: return
+ if (owner.resolveClass() == null || element.multiResolve(false).isNotEmpty()) {
+ return
+ }
+ holder.registerProblem(
+ element as PsiElement,
+ MCDevBundle(
+ "inspection.unpick_unresolved_reference.method",
+ element.canonicalText,
+ element.descriptor ?: "",
+ owner.qualifiedName,
+ ),
+ ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
+ )
+ }
+
+ override fun visitFieldName(element: UnpickFieldName) {
+ val owner = element.ownerClassName ?: return
+ if (owner.resolveClass() == null || element.resolveField() != null) {
+ return
+ }
+ holder.registerProblem(
+ element as PsiElement,
+ MCDevBundle("inspection.unpick_unresolved_reference.field", element.text, owner.qualifiedName),
+ ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
+ )
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/UnpickClassReference.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/UnpickClassReference.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/UnpickClassReference.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,148 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickClassName
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.demonwav.mcdev.util.findQualifiedClass
+import com.intellij.codeInsight.lookup.LookupElementBuilder
+import com.intellij.openapi.util.TextRange
+import com.intellij.psi.JavaPsiFacade
+import com.intellij.psi.PsiClass
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiPackage
+import com.intellij.psi.PsiReference
+import com.intellij.psi.PsiReferenceBase
+import com.intellij.psi.util.ClassUtil
+import com.intellij.util.ArrayUtil
+import com.intellij.util.IncorrectOperationException
+
+/**
+ * A reference from one part of a class or package name to the package or class it names. Class names are binary names,
+ * so a single identifier such as `Outer$Inner` contains a separate reference for each class.
+ */
+class UnpickClassReference(
+ element: PsiElement,
+ range: TextRange,
+ /**
+ * The fully qualified name of the referenced package or class, up to and including this part.
+ */
+ val targetName: String,
+ val isPackage: Boolean,
+) : PsiReferenceBase(element, range, false) {
+
+ override fun resolve(): PsiElement? {
+ return if (isPackage) {
+ JavaPsiFacade.getInstance(element.project).findPackage(targetName)
+ } else {
+ findQualifiedClass(targetName, element)
+ }
+ }
+
+ override fun getVariants(): Array {
+ val facade = JavaPsiFacade.getInstance(element.project)
+ val scope = element.resolveScope
+ val parentName = targetName.substring(0, maxOf(targetName.lastIndexOf('.'), targetName.lastIndexOf('$'), 0))
+ val isInnerClass = targetName.lastIndexOf('$') > targetName.lastIndexOf('.')
+ if (isInnerClass) {
+ val outer = findQualifiedClass(parentName, element) ?: return ArrayUtil.EMPTY_OBJECT_ARRAY
+ return outer.innerClasses.mapNotNull { it.name }.map(LookupElementBuilder::create).toTypedArray()
+ }
+ val parentPackage = facade.findPackage(parentName) ?: return ArrayUtil.EMPTY_OBJECT_ARRAY
+ val packages = parentPackage.getSubPackages(scope).mapNotNull { it.name }
+ .map { LookupElementBuilder.create(it) }
+ val classes = if (isPackage) {
+ emptyList()
+ } else {
+ parentPackage.getClasses(scope).mapNotNull { it.name }.map { LookupElementBuilder.create(it) }
+ }
+ return (packages + classes).toTypedArray()
+ }
+
+ override fun handleElementRename(newElementName: String): PsiElement {
+ val identifier = element.node.getChildren(null).firstOrNull {
+ it.elementType == UnpickTypes.IDENTIFIER &&
+ TextRange.from(it.startOffsetInParent, it.textLength).contains(rangeInElement)
+ } ?: throw IncorrectOperationException()
+ val identifierRange = rangeInElement.shiftLeft(identifier.startOffsetInParent)
+ val newText = identifierRange.replace(identifier.text, newElementName)
+ identifier.psi.replace(UnpickElementFactory.createIdentifier(element.project, newText))
+ return element
+ }
+
+ override fun bindToElement(element: PsiElement): PsiElement {
+ val className = this.element as? UnpickClassName
+ if (element is PsiClass && className != null && !isPackage) {
+ val binaryName = ClassUtil.getBinaryClassName(element) ?: throw IncorrectOperationException()
+ return className.replace(UnpickElementFactory.createClassName(element.project, binaryName))
+ }
+ if (element is PsiPackage && isPackage) {
+ return handleElementRename(element.name ?: throw IncorrectOperationException())
+ }
+ throw IncorrectOperationException()
+ }
+
+ companion object {
+ fun qualifiedName(element: PsiElement): String {
+ return element.node.getChildren(null)
+ .filter { it.elementType == UnpickTypes.IDENTIFIER }
+ .joinToString(".") { it.text }
+ }
+
+ fun create(element: PsiElement, isPackage: Boolean): Array {
+ val identifiers = element.node.getChildren(null).filter { it.elementType == UnpickTypes.IDENTIFIER }
+ val result = mutableListOf()
+ val name = StringBuilder()
+ for ((index, identifier) in identifiers.withIndex()) {
+ val start = identifier.startOffsetInParent
+ if (index != 0) {
+ name.append('.')
+ }
+ if (isPackage || index != identifiers.lastIndex) {
+ name.append(identifier.text)
+ result += UnpickClassReference(
+ element,
+ TextRange(start, start + identifier.textLength),
+ name.toString(),
+ true,
+ )
+ } else {
+ // The last part is the class name, which may include inner classes
+ var partStart = 0
+ for ((partIndex, part) in identifier.text.split('$').withIndex()) {
+ if (partIndex != 0) {
+ name.append('$')
+ }
+ name.append(part)
+ result += UnpickClassReference(
+ element,
+ TextRange(start + partStart, start + partStart + part.length),
+ name.toString(),
+ false,
+ )
+ partStart += part.length + 1
+ }
+ }
+ }
+ return result.toTypedArray()
+ }
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/UnpickElement.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/UnpickElement.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/UnpickElement.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,25 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi
+
+import com.intellij.psi.PsiElement
+
+interface UnpickElement : PsiElement
Index: src/main/kotlin/platform/minecraft/unpick/psi/UnpickElementFactory.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/UnpickElementFactory.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/UnpickElementFactory.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,54 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi
+
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickFile
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickFileType
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickClassName
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTargetAnnotation
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.intellij.openapi.project.Project
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiFileFactory
+import com.intellij.psi.util.PsiTreeUtil
+
+object UnpickElementFactory {
+ private fun createFile(project: Project, text: String): UnpickFile {
+ return PsiFileFactory.getInstance(project)
+ .createFileFromText("dummy.unpick", UnpickFileType, text) as UnpickFile
+ }
+
+ fun createIdentifier(project: Project, name: String): PsiElement {
+ val annotation = PsiTreeUtil.findChildOfType(
+ createFile(project, "unpick v4\ntarget_annotation a.A $name"),
+ UnpickTargetAnnotation::class.java,
+ )!!
+ return annotation.groupRef!!.node.findChildByType(UnpickTypes.IDENTIFIER)!!.psi
+ }
+
+ fun createClassName(project: Project, name: String): UnpickClassName {
+ val annotation = PsiTreeUtil.findChildOfType(
+ createFile(project, "unpick v4\ntarget_annotation $name G"),
+ UnpickTargetAnnotation::class.java,
+ )!!
+ return annotation.className!!
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/UnpickElementType.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/UnpickElementType.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/UnpickElementType.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,27 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi
+
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickLanguage
+import com.intellij.psi.tree.IElementType
+import org.jetbrains.annotations.NonNls
+
+class UnpickElementType(@NonNls debugName: String) : IElementType(debugName, UnpickLanguage)
Index: src/main/kotlin/platform/minecraft/unpick/psi/UnpickParserUtil.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/UnpickParserUtil.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/UnpickParserUtil.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,43 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.intellij.lang.PsiBuilder
+import com.intellij.lang.parser.GeneratedParserUtilBase
+
+object UnpickParserUtil : GeneratedParserUtilBase() {
+ /**
+ * Matches a contextual keyword, which is lexed as an identifier, and remaps it to a keyword token.
+ */
+ @JvmStatic
+ fun keyword(builder: PsiBuilder, level: Int, text: String): Boolean {
+ if (builder.tokenType != UnpickTypes.IDENTIFIER && builder.tokenType != UnpickTypes.KEYWORD) {
+ return false
+ }
+ if (builder.tokenText != text) {
+ return false
+ }
+ builder.remapCurrentToken(UnpickTypes.KEYWORD)
+ builder.advanceLexer()
+ return true
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/UnpickTokenType.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/UnpickTokenType.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/UnpickTokenType.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,27 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi
+
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickLanguage
+import com.intellij.psi.tree.IElementType
+import org.jetbrains.annotations.NonNls
+
+class UnpickTokenType(@NonNls debugName: String) : IElementType(debugName, UnpickLanguage)
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickBinaryExpressionMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickBinaryExpressionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickBinaryExpressionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,36 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+import com.intellij.psi.PsiElement
+import com.intellij.psi.tree.IElementType
+
+interface UnpickBinaryExpressionMixin : UnpickElement {
+ fun getLeft(): UnpickExpression
+
+ fun getRight(): UnpickExpression?
+
+ val operatorToken: PsiElement
+
+ val operator: IElementType
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickClassNameMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickClassNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickClassNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,33 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+import com.intellij.psi.PsiClass
+
+interface UnpickClassNameMixin : UnpickElement {
+ /**
+ * The binary name of the class, without any whitespace.
+ */
+ val qualifiedName: String
+
+ fun resolveClass(): PsiClass?
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickDataTypeMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickDataTypeMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickDataTypeMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.DataType
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+
+interface UnpickDataTypeMixin : UnpickElement {
+ /**
+ * The data type named by this element, or `null` if it doesn't name a data type.
+ */
+ val dataType: DataType?
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickFieldExpressionMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickFieldExpressionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickFieldExpressionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,35 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+import com.intellij.psi.PsiElement
+
+interface UnpickFieldExpressionMixin : UnpickElement {
+ val isWildcard: Boolean
+
+ val wildcardElement: PsiElement?
+
+ /**
+ * Whether this field expression has the `:instance` suffix and so refers to a non-static field.
+ */
+ val isInstance: Boolean
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickFieldNameMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickFieldNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickFieldNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,32 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickClassName
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+import com.intellij.psi.PsiField
+import com.intellij.psi.PsiReference
+
+interface UnpickFieldNameMixin : UnpickElement, PsiReference {
+ val ownerClassName: UnpickClassName?
+
+ fun resolveField(): PsiField?
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupConstantMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupConstantMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupConstantMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,28 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+
+interface UnpickGroupConstantMixin : UnpickElement {
+ val groupDefinition: UnpickGroupDefinition?
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupDefinitionMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupDefinitionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupDefinitionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,45 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.GroupFormat
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupScope
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+import com.intellij.psi.NavigatablePsiElement
+import com.intellij.psi.PsiNameIdentifierOwner
+
+interface UnpickGroupDefinitionMixin : UnpickElement, PsiNameIdentifierOwner, NavigatablePsiElement {
+ val isDefaultGroup: Boolean
+ get() = name == null
+
+ val scopes: List
+
+ val isStrict: Boolean
+
+ val isFlags: Boolean
+
+ val format: GroupFormat?
+
+ /**
+ * The contents of the `#:` doc comments directly preceding this group definition, or `null` if there are none.
+ */
+ val docComment: String?
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupRefMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupRefMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickGroupRefMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,29 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+import com.intellij.psi.PsiPolyVariantReference
+
+interface UnpickGroupRefMixin : UnpickElement, PsiPolyVariantReference {
+ fun resolveDefinitions(): List
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickHeaderMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickHeaderMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickHeaderMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,37 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+
+interface UnpickHeaderMixin : UnpickElement {
+ /**
+ * The declared version number, which may not be a supported version, or `null` if it is missing or malformed.
+ */
+ val version: Int?
+
+ val isSupportedVersion: Boolean
+ get() = version.let { it == null || it in SUPPORTED_VERSIONS }
+
+ companion object {
+ val SUPPORTED_VERSIONS = 3..4
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickLiteralExpressionMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickLiteralExpressionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickLiteralExpressionMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,46 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.DataType
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickLiterals
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+
+interface UnpickLiteralExpressionMixin : UnpickElement {
+ /**
+ * Whether this literal is the direct operand of a unary minus.
+ */
+ val isNegated: Boolean
+
+ /**
+ * The type of this literal, or `null` if it is malformed.
+ */
+ val dataType: DataType?
+
+ val parseResult: UnpickLiterals.Result
+
+ /**
+ * The value of this literal, or `null` if it is malformed. Like the reference implementation, a negated literal
+ * evaluates to its positive value, which may have overflowed.
+ */
+ val value: Any?
+ get() = (parseResult as? UnpickLiterals.Result.Value)?.value
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickMethodNameMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickMethodNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickMethodNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,40 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickClassName
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+import com.intellij.psi.PsiMethod
+import com.intellij.psi.PsiPolyVariantReference
+
+interface UnpickMethodNameMixin : UnpickElement, PsiPolyVariantReference {
+ val isConstructor: Boolean
+ get() = text.replace(" ", "") == ""
+
+ val isStaticInitializer: Boolean
+ get() = text.replace(" ", "") == ""
+
+ val ownerClassName: UnpickClassName?
+
+ val descriptor: String?
+
+ fun resolveMethods(): List
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickPackageNameMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickPackageNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/UnpickPackageNameMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,27 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins
+
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElement
+
+interface UnpickPackageNameMixin : UnpickElement {
+ val qualifiedName: String
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickBinaryExpressionImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickBinaryExpressionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickBinaryExpressionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,38 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickParserDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickBinaryExpressionMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+import com.intellij.psi.PsiElement
+import com.intellij.psi.tree.IElementType
+
+abstract class UnpickBinaryExpressionImplMixin(node: ASTNode) :
+ ASTWrapperPsiElement(node),
+ UnpickBinaryExpressionMixin {
+ override val operatorToken: PsiElement
+ get() = node.findChildByType(UnpickParserDefinition.TokenSets.OPERATORS)!!.psi
+
+ override val operator: IElementType
+ get() = operatorToken.node.elementType
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickClassNameImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickClassNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickClassNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,44 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickClassReference
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickClassNameMixin
+import com.demonwav.mcdev.util.cached
+import com.demonwav.mcdev.util.findQualifiedClass
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+import com.intellij.psi.PsiClass
+import com.intellij.psi.PsiReference
+import com.intellij.psi.util.PsiModificationTracker
+
+abstract class UnpickClassNameImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickClassNameMixin {
+ override val qualifiedName: String
+ get() = UnpickClassReference.qualifiedName(this)
+
+ override fun resolveClass(): PsiClass? = cached(PsiModificationTracker.MODIFICATION_COUNT) {
+ findQualifiedClass(qualifiedName, this)
+ }
+
+ override fun getReferences(): Array = UnpickClassReference.create(this, isPackage = false)
+
+ override fun getReference(): PsiReference? = references.lastOrNull()
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickDataTypeImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickDataTypeImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickDataTypeImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.DataType
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickDataTypeMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+
+abstract class UnpickDataTypeImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickDataTypeMixin {
+ override val dataType: DataType?
+ get() = DataType.fromKeyword(text)
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickFieldExpressionImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickFieldExpressionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickFieldExpressionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,38 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickFieldExpressionMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+import com.intellij.psi.PsiElement
+
+abstract class UnpickFieldExpressionImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickFieldExpressionMixin {
+ override val isWildcard: Boolean
+ get() = wildcardElement != null
+
+ override val wildcardElement: PsiElement?
+ get() = node.findChildByType(UnpickTypes.STAR)?.psi
+
+ override val isInstance: Boolean
+ get() = node.getChildren(null).any { it.elementType == UnpickTypes.KEYWORD && it.text == "instance" }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickFieldNameImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickFieldNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickFieldNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,82 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickClassName
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElementFactory
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickFieldNameMixin
+import com.demonwav.mcdev.util.cached
+import com.demonwav.mcdev.util.equivalentTo
+import com.intellij.codeInsight.lookup.LookupElementBuilder
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+import com.intellij.openapi.util.TextRange
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiField
+import com.intellij.psi.PsiReference
+import com.intellij.psi.util.PsiModificationTracker
+import com.intellij.psi.util.PsiTreeUtil
+import com.intellij.util.ArrayUtil
+
+abstract class UnpickFieldNameImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickFieldNameMixin {
+
+ override val ownerClassName: UnpickClassName?
+ get() = PsiTreeUtil.getChildOfType(parent, UnpickClassName::class.java)
+
+ override fun resolveField(): PsiField? = cached(PsiModificationTracker.MODIFICATION_COUNT) {
+ ownerClassName?.resolveClass()?.findFieldByName(text, true)
+ }
+
+ override fun getElement(): PsiElement = this
+
+ override fun getReference(): PsiReference = this
+
+ override fun resolve(): PsiElement? = resolveField()
+
+ override fun getVariants(): Array {
+ val owner = ownerClassName?.resolveClass() ?: return ArrayUtil.EMPTY_OBJECT_ARRAY
+ return owner.allFields.map { field ->
+ LookupElementBuilder.create(field).withTypeText(field.type.presentableText)
+ }.toTypedArray()
+ }
+
+ override fun getRangeInElement(): TextRange = TextRange(0, textLength)
+
+ override fun getCanonicalText(): String = text
+
+ override fun handleElementRename(newElementName: String): PsiElement {
+ firstChild.replace(UnpickElementFactory.createIdentifier(project, newElementName))
+ return this
+ }
+
+ override fun bindToElement(element: PsiElement): PsiElement {
+ if (element is PsiField) {
+ return handleElementRename(element.name)
+ }
+ return this
+ }
+
+ override fun isReferenceTo(element: PsiElement): Boolean {
+ return element is PsiField && element equivalentTo resolve()
+ }
+
+ override fun isSoft(): Boolean = false
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupConstantImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupConstantImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupConstantImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickGroupConstantMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+
+abstract class UnpickGroupConstantImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickGroupConstantMixin {
+ override val groupDefinition: UnpickGroupDefinition?
+ get() = parent as? UnpickGroupDefinition
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupDefinitionImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupDefinitionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupDefinitionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,99 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.asset.PlatformAssets
+import com.demonwav.mcdev.platform.minecraft.unpick.GroupFormat
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickFlagsAttribute
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickFormatAttribute
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupScope
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickScopeAttribute
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickStrictAttribute
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElementFactory
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickGroupDefinitionMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.ide.projectView.PresentationData
+import com.intellij.lang.ASTNode
+import com.intellij.navigation.ItemPresentation
+import com.intellij.psi.PsiComment
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiWhiteSpace
+import com.intellij.psi.util.elementType
+import com.intellij.util.IncorrectOperationException
+
+abstract class UnpickGroupDefinitionImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickGroupDefinitionMixin {
+ private val self: UnpickGroupDefinition
+ get() = this as UnpickGroupDefinition
+
+ override fun getName(): String? = self.groupName?.text
+
+ override fun setName(name: String): PsiElement {
+ val identifier = self.groupName?.firstChild ?: throw IncorrectOperationException("Cannot rename default group")
+ identifier.replace(UnpickElementFactory.createIdentifier(project, name))
+ return this
+ }
+
+ override fun getNameIdentifier(): PsiElement? = self.groupName
+
+ override fun getTextOffset(): Int = self.groupName?.textOffset ?: super.getTextOffset()
+
+ override val scopes: List
+ get() = self.groupAttributeList.mapNotNull { (it as? UnpickScopeAttribute)?.groupScope }
+
+ override val isStrict: Boolean
+ get() = self.groupAttributeList.any { it is UnpickStrictAttribute }
+
+ override val isFlags: Boolean
+ get() = self.groupAttributeList.any { it is UnpickFlagsAttribute }
+
+ override val format: GroupFormat?
+ get() = self.groupAttributeList.firstNotNullOfOrNull { attribute ->
+ (attribute as? UnpickFormatAttribute)?.formatName?.text?.let(GroupFormat::fromKeyword)
+ }
+
+ override val docComment: String?
+ get() {
+ val lines = mutableListOf()
+ var sibling = prevSibling
+ while (sibling is PsiWhiteSpace || sibling is PsiComment) {
+ if (sibling is PsiComment) {
+ if (sibling.elementType != UnpickTypes.DOC_COMMENT) {
+ break
+ }
+ lines += sibling.text.removePrefix("#:").trimStart()
+ }
+ sibling = sibling.prevSibling
+ }
+ return if (lines.isEmpty()) null else lines.asReversed().joinToString("\n")
+ }
+
+ override fun getPresentation(): ItemPresentation {
+ val dataType = self.dataType?.text.orEmpty()
+ return PresentationData(
+ name?.let { "$dataType $it" } ?: dataType,
+ containingFile?.name,
+ PlatformAssets.MINECRAFT_ICON,
+ null,
+ )
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupRefImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupRefImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickGroupRefImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,85 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.asset.PlatformAssets
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickGroups
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElementFactory
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickGroupRefMixin
+import com.demonwav.mcdev.util.cached
+import com.demonwav.mcdev.util.equivalentTo
+import com.intellij.codeInsight.lookup.LookupElementBuilder
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+import com.intellij.openapi.util.TextRange
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiElementResolveResult
+import com.intellij.psi.PsiReference
+import com.intellij.psi.ResolveResult
+import com.intellij.psi.util.PsiModificationTracker
+
+abstract class UnpickGroupRefImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickGroupRefMixin {
+
+ override fun resolveDefinitions(): List = cached(PsiModificationTracker.MODIFICATION_COUNT) {
+ UnpickGroups.findDefinitions(this, text)
+ }
+
+ override fun getElement(): PsiElement = this
+
+ override fun getReference(): PsiReference = this
+
+ override fun multiResolve(incompleteCode: Boolean): Array =
+ PsiElementResolveResult.createResults(resolveDefinitions())
+
+ // Return the first definition rather than null when there are several, so that the group can be renamed from a
+ // reference. Rename then picks up the other definitions through UnpickRenameGroupProcessor.
+ override fun resolve(): PsiElement? = resolveDefinitions().firstOrNull()
+
+ override fun getVariants(): Array {
+ return UnpickGroups.findAllGroupNames(this).map {
+ LookupElementBuilder.create(it).withIcon(PlatformAssets.MINECRAFT_ICON)
+ }.toTypedArray()
+ }
+
+ override fun getRangeInElement(): TextRange = TextRange(0, textLength)
+
+ override fun getCanonicalText(): String = text
+
+ override fun handleElementRename(newElementName: String): PsiElement {
+ firstChild.replace(UnpickElementFactory.createIdentifier(project, newElementName))
+ return this
+ }
+
+ override fun bindToElement(element: PsiElement): PsiElement {
+ if (element is UnpickGroupDefinition) {
+ element.name?.let { return handleElementRename(it) }
+ }
+ return this
+ }
+
+ override fun isReferenceTo(element: PsiElement): Boolean {
+ return element is UnpickGroupDefinition && element.name == text &&
+ resolveDefinitions().any { it equivalentTo element }
+ }
+
+ override fun isSoft(): Boolean = false
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickHeaderImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickHeaderImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickHeaderImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,37 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickHeaderMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+
+abstract class UnpickHeaderImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickHeaderMixin {
+ override val version: Int?
+ get() {
+ val versionText = node.findChildByType(UnpickTypes.IDENTIFIER)?.text ?: return null
+ if (!versionText.startsWith('v')) {
+ return null
+ }
+ return versionText.substring(1).toIntOrNull()
+ }
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickLiteralExpressionImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickLiteralExpressionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickLiteralExpressionImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,41 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.DataType
+import com.demonwav.mcdev.platform.minecraft.unpick.UnpickLiterals
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickNegateExpression
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickLiteralExpressionMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+
+abstract class UnpickLiteralExpressionImplMixin(node: ASTNode) :
+ ASTWrapperPsiElement(node),
+ UnpickLiteralExpressionMixin {
+ override val isNegated: Boolean
+ get() = parent is UnpickNegateExpression
+
+ override val dataType: DataType?
+ get() = UnpickLiterals.dataTypeOf(node.firstChildNode.elementType)
+
+ override val parseResult: UnpickLiterals.Result
+ get() = UnpickLiterals.parse(node.firstChildNode.elementType, text, isNegated)
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickMethodNameImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickMethodNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickMethodNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,112 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickClassName
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickTypes
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickElementFactory
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickMethodNameMixin
+import com.demonwav.mcdev.util.MemberReference
+import com.demonwav.mcdev.util.cached
+import com.demonwav.mcdev.util.findMethods
+import com.demonwav.mcdev.util.internalName
+import com.intellij.codeInsight.completion.JavaLookupElementBuilder
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+import com.intellij.openapi.util.TextRange
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiElementResolveResult
+import com.intellij.psi.PsiMethod
+import com.intellij.psi.PsiReference
+import com.intellij.psi.PsiSubstitutor
+import com.intellij.psi.ResolveResult
+import com.intellij.psi.util.PsiModificationTracker
+import com.intellij.psi.util.PsiTreeUtil
+import com.intellij.util.ArrayUtil
+import com.intellij.util.IncorrectOperationException
+
+abstract class UnpickMethodNameImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickMethodNameMixin {
+
+ override val ownerClassName: UnpickClassName?
+ get() = PsiTreeUtil.getChildOfType(parent, UnpickClassName::class.java)
+
+ override val descriptor: String?
+ get() = parent.node.findChildByType(UnpickTypes.METHOD_DESCRIPTOR)?.text
+
+ private val internalName: String
+ get() = text.replace(" ", "").replace("\t", "")
+
+ override fun resolveMethods(): List = cached(PsiModificationTracker.MODIFICATION_COUNT) {
+ val owner = ownerClassName?.resolveClass() ?: return@cached emptyList()
+ owner.findMethods(MemberReference(internalName, descriptor)).toList()
+ }
+
+ override fun getElement(): PsiElement = this
+
+ override fun getReference(): PsiReference = this
+
+ override fun multiResolve(incompleteCode: Boolean): Array {
+ if (isStaticInitializer) {
+ // There's not always a PSI element for the static initializer, resolve to the class instead
+ val owner = ownerClassName?.resolveClass() ?: return ResolveResult.EMPTY_ARRAY
+ return arrayOf(PsiElementResolveResult(owner))
+ }
+ return PsiElementResolveResult.createResults(resolveMethods())
+ }
+
+ override fun resolve(): PsiElement? = multiResolve(false).singleOrNull()?.element
+
+ override fun getVariants(): Array {
+ val owner = ownerClassName?.resolveClass() ?: return ArrayUtil.EMPTY_OBJECT_ARRAY
+ return (owner.methods + owner.constructors).map { method ->
+ JavaLookupElementBuilder.forMethod(
+ method,
+ method.internalName,
+ PsiSubstitutor.EMPTY,
+ null,
+ )
+ }.toTypedArray()
+ }
+
+ override fun getRangeInElement(): TextRange = TextRange(0, textLength)
+
+ override fun getCanonicalText(): String = internalName
+
+ override fun handleElementRename(newElementName: String): PsiElement {
+ if (isConstructor || isStaticInitializer) {
+ return this
+ }
+ val identifier = node.findChildByType(UnpickTypes.IDENTIFIER) ?: throw IncorrectOperationException()
+ identifier.psi.replace(UnpickElementFactory.createIdentifier(project, newElementName))
+ return this
+ }
+
+ override fun bindToElement(element: PsiElement): PsiElement {
+ throw IncorrectOperationException()
+ }
+
+ override fun isReferenceTo(element: PsiElement): Boolean {
+ return element is PsiMethod && manager.areElementsEquivalent(element, resolve()) ||
+ multiResolve(false).any { manager.areElementsEquivalent(it.element, element) }
+ }
+
+ override fun isSoft(): Boolean = false
+}
Index: src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickPackageNameImplMixin.kt
===================================================================
--- src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickPackageNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/kotlin/platform/minecraft/unpick/psi/mixins/impl/UnpickPackageNameImplMixin.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,36 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.impl
+
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.UnpickClassReference
+import com.demonwav.mcdev.platform.minecraft.unpick.psi.mixins.UnpickPackageNameMixin
+import com.intellij.extapi.psi.ASTWrapperPsiElement
+import com.intellij.lang.ASTNode
+import com.intellij.psi.PsiReference
+
+abstract class UnpickPackageNameImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), UnpickPackageNameMixin {
+ override val qualifiedName: String
+ get() = UnpickClassReference.qualifiedName(this)
+
+ override fun getReferences(): Array = UnpickClassReference.create(this, isPackage = true)
+
+ override fun getReference(): PsiReference? = references.lastOrNull()
+}
Index: src/main/resources/META-INF/plugin.xml
===================================================================
--- src/main/resources/META-INF/plugin.xml (revision 108d68f45ff493303afa9be9187a60d6384c1f0e)
+++ src/main/resources/META-INF/plugin.xml (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -607,6 +607,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: src/main/resources/inspectionDescriptions/DuplicateUnpickConstant.html
===================================================================
--- src/main/resources/inspectionDescriptions/DuplicateUnpickConstant.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/DuplicateUnpickConstant.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports constants in an unpick group that evaluate to the same value as another constant in the same group and scope
+
+
+
+ If two constants in a group have the same value, it is ambiguous which one should replace a literal. Constants in the same group are compared across all unpick files, but only when the group definitions have the same @scope attributes.
+
+
+
Index: src/main/resources/inspectionDescriptions/InvalidUnpickConstantField.html
===================================================================
--- src/main/resources/inspectionDescriptions/InvalidUnpickConstantField.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/InvalidUnpickConstantField.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports field expressions in unpick constants that refer to unsuitable fields
+
+
+
+ The field referenced by a field expression must be final and initialized to a compile-time constant. Its staticness must match the :instance suffix, and its type must match the explicit type suffix if there is one. A wildcard field expression must match at least one field.
+
+
+
Index: src/main/resources/inspectionDescriptions/UnknownUnpickGroup.html
===================================================================
--- src/main/resources/inspectionDescriptions/UnknownUnpickGroup.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/UnknownUnpickGroup.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports references to groups that are not defined in any unpick file
+
+
+
+ Targets associate a group name with a method parameter, return value, field or annotation. Groups are looked up across all unpick files visible from the current file, and an undefined group means the target has no effect.
+
+
+
Index: src/main/resources/inspectionDescriptions/UnpickDivisionByZero.html
===================================================================
--- src/main/resources/inspectionDescriptions/UnpickDivisionByZero.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/UnpickDivisionByZero.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports integer division or remainder by zero in unpick constants
+
+
+
+ Like in Java, dividing an integral value by zero is an error. Floating point division by zero is allowed.
+
+
+
Index: src/main/resources/inspectionDescriptions/UnpickExpressionType.html
===================================================================
--- src/main/resources/inspectionDescriptions/UnpickExpressionType.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/UnpickExpressionType.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports unpick constants with type errors
+
+
+
+ Expressions in unpick files follow the same typing rules as Java. This reports operators applied to incompatible types, casts to or from String and Class, and constants whose type cannot be converted to the data type of their group by widening primitive conversion.
+
+
+
Index: src/main/resources/inspectionDescriptions/UnpickGroupTypeConflict.html
===================================================================
--- src/main/resources/inspectionDescriptions/UnpickGroupTypeConflict.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/UnpickGroupTypeConflict.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports groups that are defined with different data types in different places
+
+
+
+ A group may be defined in several places, with each definition adding constants to the group. All definitions of a group should use the same data type.
+
+
+
Index: src/main/resources/inspectionDescriptions/UnpickTargetMismatch.html
===================================================================
--- src/main/resources/inspectionDescriptions/UnpickTargetMismatch.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/UnpickTargetMismatch.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports unpick targets that do not match the method, field or annotation they target
+
+
+
+ This reports parameter indices that are out of bounds, return items on void methods, targets whose type is not compatible with the data type of the group, target_field descriptors that do not match the field, and target_annotation classes that are not annotation types.
+
+
+
Index: src/main/resources/inspectionDescriptions/UnresolvedUnpickReference.html
===================================================================
--- src/main/resources/inspectionDescriptions/UnresolvedUnpickReference.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/main/resources/inspectionDescriptions/UnresolvedUnpickReference.html (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Reports class, package, method and field names in unpick files that cannot be resolved
+
+
+
+ Unpick definitions refer to classes by their binary name, such as net.minecraft.world.level.block.Block$UpdateFlags, and to methods by their name and descriptor. If these do not exist in the project or its libraries, the unpick definition can never apply.
+
+
+
Index: src/main/resources/messages/MinecraftDevelopmentBundle.properties
===================================================================
--- src/main/resources/messages/MinecraftDevelopmentBundle.properties (revision 108d68f45ff493303afa9be9187a60d6384c1f0e)
+++ src/main/resources/messages/MinecraftDevelopmentBundle.properties (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -396,6 +396,9 @@
inspection.duplicate_interface.message=Interface is already implemented
inspection.duplicate_interface_prefix.name=Duplicate @Interface prefix in @Implements
inspection.duplicate_interface_prefix.message=Duplicate prefix ''{0}''
+inspection.duplicate_unpick_constant.message=Constant evaluates to {0}, which is also the value of ''{1}''
+inspection.duplicate_unpick_constant.name=Duplicate unpick constant
+inspection.duplicate_unpick_constant.wildcard_message=Wildcard field ''{0}'' evaluates to {1}, which is also the value of ''{2}''
inspection.empty_implements.name=Empty @Implements
inspection.empty_implements.message=@Implements is redundant
inspection.entity_data_param.fix=Replace other entity class with this entity class
@@ -460,6 +463,7 @@
inspection.invalid_mixin_registration.not_mixin=Specified class is not a @Mixin class
inspection.invalid_mixin_target.name=Invalid @Mixin Target
inspection.invalid_mixin_target.message=@Mixin is missing a valid target class
+inspection.invalid_unpick_constant_field.name=Invalid unpick constant field
inspection.invoke_assign_can_replaced_with_expression.name=INVOKE_ASSIGN can be replaced with expression
inspection.invoke_assign_replace_with_expression.fix=Replace with expression
inspection.invoke_assign_replace_with_expression.message=INVOKE_ASSIGN could be replaced with expression
@@ -664,12 +668,31 @@
inspection.switch_on_enum_mixin.message=Switch used on enum mixin
inspection.unknown_ct_namespace.name=Unknown CT namespace
inspection.unknown_ct_namespace.message=Unrecognized namespace
+inspection.unknown_unpick_group.message=Cannot find a definition of group ''{0}''
+inspection.unknown_unpick_group.name=Unknown unpick group
inspection.unnecessary_qualified_member_reference.name=Unnecessary qualified member reference
inspection.unnecessary_qualified_member_reference.fix=Remove qualifier
inspection.unnecessary_qualified_member_reference.message=Unnecessary qualified reference to ''{0}'' in target class
inspection.unnecessary_unsafe.name=Unnecessary unsafe = true
inspection.unnecessary_unsafe.message=Unnecessary unsafe = true
inspection.unnecessary_unsafe.option.always_on_fabric=Always unnecessary when Fabric Mixin is present
+inspection.unpick_division_by_zero.name=Unpick division by zero
+inspection.unpick_expression_type.name=Unpick expression type mismatch
+inspection.unpick_group_type_conflict.message=Group ''{0}'' is also defined with data type {1}
+inspection.unpick_group_type_conflict.name=Conflicting unpick group data types
+inspection.unpick_target_mismatch.field_descriptor=Field ''{0}'' has descriptor ''{1}''
+inspection.unpick_target_mismatch.field_incompatible=Field of type ''{0}'' is not compatible with group ''{1}'' of type ''{2}''
+inspection.unpick_target_mismatch.name=Unpick target mismatch
+inspection.unpick_target_mismatch.not_annotation=''{0}'' is not an annotation type
+inspection.unpick_target_mismatch.param_incompatible=Parameter {0} of type ''{1}'' is not compatible with group ''{2}'' of type ''{3}''
+inspection.unpick_target_mismatch.param_out_of_bounds=Parameter index {0} is out of bounds for a method with {1,choice,0#no parameters|1#1 parameter|1<{1} parameters}
+inspection.unpick_target_mismatch.return_incompatible=Return type ''{0}'' is not compatible with group ''{1}'' of type ''{2}''
+inspection.unpick_target_mismatch.void_return=Method returns void
+inspection.unpick_unresolved_reference.class=Cannot resolve class ''{0}''
+inspection.unpick_unresolved_reference.field=Cannot resolve field ''{0}'' in class ''{1}''
+inspection.unpick_unresolved_reference.method=Cannot resolve method ''{0}'' with descriptor ''{1}'' in class ''{2}''
+inspection.unpick_unresolved_reference.name=Unresolved unpick reference
+inspection.unpick_unresolved_reference.package=Cannot resolve package ''{0}''
inspection.unqualified_member_reference.name=Unqualified member reference
inspection.unqualified_member_reference.message=Unqualified member reference in @At target
inspection.unqualified_member_reference.missing_descriptor=Method/field descriptor is required for member reference in @At target
@@ -907,6 +930,73 @@
minecraft.mappings.blank_path=No mapping data available\: file path is blank
minecraft.mappings.not_found=No mapping data available at {0}
minecraft.mappings.not_loaded=Mappings not loaded
+minecraft.unpick.annotator.attribute_after_constant=Attributes must come before all constants in a group
+minecraft.unpick.annotator.duplicate_flags=Duplicate @flags attribute
+minecraft.unpick.annotator.duplicate_format=Duplicate @format attribute
+minecraft.unpick.annotator.duplicate_param=Parameter {0} is targeted more than once
+minecraft.unpick.annotator.duplicate_return=The return value is targeted more than once
+minecraft.unpick.annotator.duplicate_strict=Duplicate @strict attribute
+minecraft.unpick.annotator.expected_attribute=Expected an attribute name
+minecraft.unpick.annotator.flags_default_group=The @flags attribute is not applicable to the default group
+minecraft.unpick.annotator.flags_not_applicable=The @flags attribute is only applicable to int and long groups
+minecraft.unpick.annotator.format_not_applicable=Format ''{0}'' is not applicable to data type ''{1}''
+minecraft.unpick.annotator.invalid_group_data_type=Groups cannot have data type ''{0}''
+minecraft.unpick.annotator.invalid_special_method=Expected 'init' or 'clinit'
+minecraft.unpick.annotator.malformed_header=The first line must be exactly ''{0}''
+minecraft.unpick.annotator.missing_header=Missing version marker, expected 'unpick v4' on the first line
+minecraft.unpick.annotator.missing_version=Missing version, expected 'v3' or 'v4'
+minecraft.unpick.annotator.multiple_wildcards=Only one wildcard field expression is allowed per constant
+minecraft.unpick.annotator.target_annotation_requires_v4=Target annotations require unpick v4
+minecraft.unpick.annotator.unknown_attribute=Unknown attribute ''{0}''
+minecraft.unpick.annotator.unknown_data_type=Unknown data type ''{0}''
+minecraft.unpick.annotator.unknown_format=Unknown format ''{0}''
+minecraft.unpick.annotator.unsupported_version=Unpick version ''{0}'' is not supported, only v3 and v4 files are checked
+minecraft.unpick.color_settings.attribute=Attribute
+minecraft.unpick.color_settings.bad_character=Bad character
+minecraft.unpick.color_settings.class_name=Class name
+minecraft.unpick.color_settings.comment=Comment
+minecraft.unpick.color_settings.descriptor=Descriptor
+minecraft.unpick.color_settings.display_name=Unpick
+minecraft.unpick.color_settings.doc_comment=Doc comment
+minecraft.unpick.color_settings.dot=Dot
+minecraft.unpick.color_settings.field_name=Field name
+minecraft.unpick.color_settings.group_name=Group name
+minecraft.unpick.color_settings.keyword=Keyword
+minecraft.unpick.color_settings.method_name=Method name
+minecraft.unpick.color_settings.number=Number
+minecraft.unpick.color_settings.operator=Operator
+minecraft.unpick.color_settings.parentheses=Parentheses
+minecraft.unpick.color_settings.string=String
+minecraft.unpick.color_settings.unsupported=Unsupported version content
+minecraft.unpick.descriptor.empty_class_name=Empty class name in descriptor
+minecraft.unpick.descriptor.expected_method=Expected a method descriptor starting with '('
+minecraft.unpick.descriptor.illegal_character=Illegal character in descriptor: ''{0}''
+minecraft.unpick.descriptor.trailing_characters=Unexpected characters after the end of the descriptor
+minecraft.unpick.descriptor.unexpected_end=Unexpected end of descriptor
+minecraft.unpick.eval.bad_binary_operands=Operator ''{0}'' cannot be applied to ''{1}'' and ''{2}''
+minecraft.unpick.eval.bad_cast=Cannot cast ''{0}'' to ''{1}''
+minecraft.unpick.eval.bad_unary_operand=Operator ''{0}'' cannot be applied to ''{1}''
+minecraft.unpick.eval.division_by_zero=Division by zero
+minecraft.unpick.eval.field_is_static=Field ''{0}'' is static, remove the '':instance'' suffix
+minecraft.unpick.eval.field_not_constant=Field ''{0}'' is not initialized to a compile-time constant
+minecraft.unpick.eval.field_not_final=Field ''{0}'' is not final
+minecraft.unpick.eval.field_not_static=Field ''{0}'' is not static, add the '':instance'' suffix
+minecraft.unpick.eval.field_type_mismatch=Field ''{0}'' has type ''{1}'', not ''{2}''
+minecraft.unpick.eval.field_unsupported_type=Field ''{0}'' has type ''{1}'', which cannot be used as a constant
+minecraft.unpick.eval.incompatible_with_group=Constant of type ''{0}'' is not compatible with group type ''{1}''
+minecraft.unpick.eval.wildcard_no_match=No fields in ''{0}'' match this wildcard
+minecraft.unpick.file_type.description=Unpick definitions
+minecraft.unpick.find_usages.group=group
+minecraft.unpick.literal.char_too_long=Too many characters in character literal
+minecraft.unpick.literal.double_out_of_bounds=Double out of bounds
+minecraft.unpick.literal.empty_char=Empty character literal
+minecraft.unpick.literal.float_out_of_bounds=Float out of bounds
+minecraft.unpick.literal.illegal_escape=Illegal escape sequence
+minecraft.unpick.literal.integer_out_of_bounds=Integer out of bounds
+minecraft.unpick.literal.long_out_of_bounds=Long out of bounds
+minecraft.unpick.literal.malformed_number=Malformed number
+minecraft.unpick.literal.unterminated_char=Unterminated character literal
+minecraft.unpick.literal.unterminated_string=Unterminated string literal
minecraft.unscrambler.srg=Remap SRG names
minecraft.unscrambler.mappings=Mappings\:
minecraft.unscrambler.tiny=Remap Tiny names
Index: src/test/kotlin/framework/ProjectBuilder.kt
===================================================================
--- src/test/kotlin/framework/ProjectBuilder.kt (revision 108d68f45ff493303afa9be9187a60d6384c1f0e)
+++ src/test/kotlin/framework/ProjectBuilder.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -3,7 +3,7 @@
*
* https://mcdev.io/
*
- * Copyright (C) 2025 minecraft-dev
+ * Copyright (C) 2026 minecraft-dev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
@@ -63,6 +63,12 @@
configure: Boolean = true,
allowAst: Boolean = false,
) = file(path, code, ".nbtt", configure, allowAst)
+ fun unpick(
+ path: String,
+ @Language("Unpick") code: String,
+ configure: Boolean = true,
+ allowAst: Boolean = false,
+ ) = file(path, code, ".unpick", configure, allowAst)
fun json(
path: String,
@Language("JSON") code: String,
Index: src/test/kotlin/platform/minecraft/unpick/UnpickAnnotatorTest.kt
===================================================================
--- src/test/kotlin/platform/minecraft/unpick/UnpickAnnotatorTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/kotlin/platform/minecraft/unpick/UnpickAnnotatorTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,103 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.framework.EdtInterceptor
+import com.demonwav.mcdev.framework.ProjectBuilderTest
+import org.intellij.lang.annotations.Language
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(EdtInterceptor::class)
+@DisplayName("Unpick Annotator Tests")
+class UnpickAnnotatorTest : ProjectBuilderTest() {
+
+ private fun doTest(@Language("Unpick") code: String) {
+ buildProject {
+ unpick("test.unpick", code)
+ }
+ fixture.checkHighlighting(true, false, false)
+ }
+
+ @Test
+ @DisplayName("Unsupported Version Is Only A Warning")
+ fun unsupportedVersion() = doTest(
+ """
+ unpick v2
+ v1 net/minecraft/Foo BAR this is not checked
+ """,
+ )
+
+ @Test
+ @DisplayName("Group Data Types And Formats")
+ fun groupDataTypes() = doTest(
+ """
+ unpick v4
+ group byte
+ group integer
+ group float f
+ @format binary
+ group String s
+ @format hex
+ @foo
+ """,
+ )
+
+ @Test
+ @DisplayName("Attributes After Constants")
+ fun attributesAfterConstants() = doTest(
+ """
+ unpick v4
+ group int g
+ @strict
+ 1
+ @flags
+ """,
+ )
+
+ @Test
+ @DisplayName("Literals")
+ fun literals() = doTest(
+ """
+ unpick v4
+ group int
+ -2147483648
+ 2147483648
+ 0xFFFFFFFF
+ '\q'
+ 12abc
+ group long
+ -9223372036854775808L
+ 9223372036854775808L
+ """,
+ )
+
+ @Test
+ @DisplayName("Multiple Wildcards")
+ fun multipleWildcards() = doTest(
+ """
+ unpick v4
+ group int
+ foo.Bar.* | foo.Baz.*
+ """,
+ )
+}
Index: src/test/kotlin/platform/minecraft/unpick/UnpickExpressionEvaluatorTest.kt
===================================================================
--- src/test/kotlin/platform/minecraft/unpick/UnpickExpressionEvaluatorTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/kotlin/platform/minecraft/unpick/UnpickExpressionEvaluatorTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,143 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.framework.BaseMinecraftTest
+import com.demonwav.mcdev.framework.EdtInterceptor
+import com.demonwav.mcdev.platform.minecraft.unpick.eval.UnpickExpressionEvaluator
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupConstant
+import com.intellij.psi.PsiType
+import com.intellij.psi.PsiTypes
+import com.intellij.psi.util.PsiTreeUtil
+import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(EdtInterceptor::class)
+@DisplayName("Unpick Expression Evaluator Tests")
+class UnpickExpressionEvaluatorTest : BaseMinecraftTest() {
+
+ @BeforeEach
+ fun setupProject() {
+ buildProject {
+ java(
+ "com/example/Wild.java",
+ """
+ package com.example;
+
+ public class Wild {
+ public static final int A = 1;
+ public static final int B = 2;
+ public static final long C = 3;
+ public final int D = 4;
+ public static final String S = "s";
+ public static final byte SMALL = 5;
+ public static final Class> INT_TYPE = Integer.TYPE;
+ public static final Class> STRING_CLASS = String.class;
+ public static final String NULL_STRING = null;
+ }
+ """,
+ configure = false,
+ allowAst = true,
+ )
+ }
+ }
+
+ private fun evaluate(type: String, expression: String): List {
+ val file = fixture.configureByText("test.unpick", "unpick v4\ngroup $type\n $expression\n")
+ val constant = PsiTreeUtil.findChildOfType(file, UnpickGroupConstant::class.java)!!
+ val result = UnpickExpressionEvaluator.evaluate(constant)
+ Assertions.assertEquals(emptyList(), result.problems.map { it.message }, expression)
+ return result.values.map { it.value.value }
+ }
+
+ private fun assertValue(expected: Any?, expression: String, type: String = "int") {
+ Assertions.assertEquals(listOf(expected), evaluate(type, expression), expression)
+ }
+
+ @Test
+ @DisplayName("Integer Arithmetic")
+ fun integerArithmetic() {
+ assertValue(7, "1 + 2 * 3")
+ assertValue(3, "7 / 2")
+ assertValue(-1, "-7 % 3")
+ assertValue(Int.MIN_VALUE, "-2147483648")
+ assertValue(Int.MIN_VALUE, "2147483647 + 1")
+ assertValue(-1, "0xFFFFFFFF")
+ assertValue(-1, "~0")
+ assertValue(6, "0b101 ^ 0b011")
+ assertValue(5, "0b101 & 7 | 0")
+ }
+
+ @Test
+ @DisplayName("Shifts")
+ fun shifts() {
+ assertValue(2, "1 << 33")
+ assertValue(8589934592L, "1L << 33", "long")
+ assertValue(15, "-1 >>> 28")
+ assertValue(-1, "-1 >> 28")
+ }
+
+ @Test
+ @DisplayName("Promotion And Casts")
+ fun promotionAndCasts() {
+ assertValue(98, "'a' + 1")
+ assertValue(3.5, "7.0 / 2", "double")
+ assertValue(2.0f, "1.0f + 1", "float")
+ assertValue(44.toByte(), "(byte) 300")
+ assertValue(3, "(int) 3.9")
+ assertValue(5.toByte(), "com.example.Wild.SMALL")
+ assertValue(6, "com.example.Wild.SMALL + 1")
+ }
+
+ @Test
+ @DisplayName("String Concatenation")
+ fun stringConcatenation() {
+ assertValue("a12", "\"a\" + 1 + 2", "String")
+ assertValue("3a", "1 + 2 + \"a\"", "String")
+ assertValue("A", "(char) 65 + \"\"", "String")
+ assertValue("x1.0", "\"x\" + 1.0f", "String")
+ assertValue("ss", "com.example.Wild.S + com.example.Wild.S", "String")
+ assertValue(null, "com.example.Wild.NULL_STRING", "String")
+ }
+
+ @Test
+ @DisplayName("Class Constants")
+ fun classConstants() {
+ assertValue(PsiTypes.intType(), "com.example.Wild.INT_TYPE", "Class")
+ Assertions.assertEquals(
+ "java.lang.String",
+ (evaluate("Class", "com.example.Wild.STRING_CLASS").single() as PsiType).canonicalText,
+ )
+ }
+
+ @Test
+ @DisplayName("Wildcards")
+ fun wildcards() {
+ Assertions.assertEquals(listOf(1, 2, 5.toByte()), evaluate("int", "com.example.Wild.*"))
+ Assertions.assertEquals(listOf(1, 2, 3L, 5.toByte()), evaluate("long", "com.example.Wild.*"))
+ Assertions.assertEquals(listOf(3L), evaluate("long", "com.example.Wild.*:long"))
+ Assertions.assertEquals(listOf(4), evaluate("int", "com.example.Wild.*:instance"))
+ Assertions.assertEquals(listOf(11, 12, 15), evaluate("int", "com.example.Wild.* + 10"))
+ }
+}
Index: src/test/kotlin/platform/minecraft/unpick/UnpickGroupNavigationTest.kt
===================================================================
--- src/test/kotlin/platform/minecraft/unpick/UnpickGroupNavigationTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/kotlin/platform/minecraft/unpick/UnpickGroupNavigationTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,147 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.framework.EdtInterceptor
+import com.demonwav.mcdev.framework.ProjectBuilderTest
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupDefinition
+import com.demonwav.mcdev.platform.minecraft.unpick.gen.psi.UnpickGroupRef
+import com.intellij.psi.PsiManager
+import com.intellij.psi.util.PsiTreeUtil
+import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(EdtInterceptor::class)
+@DisplayName("Unpick Group Navigation Tests")
+class UnpickGroupNavigationTest : ProjectBuilderTest() {
+
+ @BeforeEach
+ fun setupProject() {
+ buildProject {
+ unpick(
+ "colors.unpick",
+ """
+ unpick v4
+
+ #: A color in ARGB format.
+ #: @see Colors
+ group int Color
+ @format hex
+ 1
+ """,
+ configure = false,
+ )
+ unpick(
+ "more_colors.unpick",
+ """
+ unpick v4
+ group int Color
+ 2
+ """,
+ configure = false,
+ )
+ unpick(
+ "targets.unpick",
+ """
+ unpick v4
+ target_method foo.Bar baz (I)V
+ param 0 Color
+ target_annotation foo.ColorInt Color
+ """,
+ )
+ }
+ }
+
+ private fun definitions(): List {
+ val ref = PsiTreeUtil.getParentOfType(
+ fixture.file.findElementAt(fixture.caretOffset),
+ UnpickGroupRef::class.java,
+ )!!
+ return ref.multiResolve(false).map { it.element as UnpickGroupDefinition }
+ }
+
+ @Test
+ @DisplayName("Resolve Across Files")
+ fun resolveAcrossFiles() {
+ Assertions.assertEquals(
+ setOf("colors.unpick", "more_colors.unpick"),
+ definitions().mapTo(HashSet()) { it.containingFile.name },
+ )
+ }
+
+ @Test
+ @DisplayName("Find Usages")
+ fun findUsages() {
+ val usages = fixture.findUsages(definitions().first())
+ Assertions.assertEquals(2, usages.size)
+ }
+
+ @Test
+ @DisplayName("Rename Group")
+ fun renameGroup() {
+ fixture.renameElementAtCaret("Colour")
+
+ val psiManager = PsiManager.getInstance(project)
+ val texts = listOf("colors.unpick", "more_colors.unpick", "targets.unpick").map { name ->
+ val file = fixture.tempDirFixture.getFile(name)!!
+ psiManager.findFile(file)!!.text
+ }
+ Assertions.assertTrue(texts.none { it.contains("Color ") || it.contains("Color\n") }, texts.toString())
+ Assertions.assertEquals(2, texts[2].split("Colour").size - 1, texts[2])
+ Assertions.assertTrue(texts[0].contains("group int Colour"), texts[0])
+ Assertions.assertTrue(texts[1].contains("group int Colour"), texts[1])
+ }
+
+ @Test
+ @DisplayName("Documentation")
+ fun documentation() {
+ val doc = UnpickDocumentationProvider().generateDoc(definitions().first(), null)!!
+ Assertions.assertTrue(doc.contains("group int Color"), doc)
+ Assertions.assertTrue(doc.contains("A color in ARGB format.
@see Colors"), doc)
+ }
+
+ @Test
+ @DisplayName("Group Name Completion")
+ fun groupNameCompletion() {
+ fixture.configureByText("complete.unpick", "unpick v4\ntarget_annotation foo.Bar Co\n")
+ val lookups = fixture.completeBasic()?.map { it.lookupString }
+ // A single match is inserted directly
+ if (lookups == null) {
+ Assertions.assertTrue(fixture.editor.document.text.contains("foo.Bar Color"))
+ } else {
+ Assertions.assertTrue("Color" in lookups, lookups.toString())
+ }
+ }
+
+ @Test
+ @DisplayName("Keyword Completion")
+ fun keywordCompletion() {
+ fixture.configureByText("complete.unpick", "unpick v4\ngroup \n")
+ val lookups = fixture.completeBasic()!!.map { it.lookupString }
+ Assertions.assertEquals(
+ listOf("Class", "double", "float", "int", "long", "String"),
+ lookups.sortedBy { it.lowercase() },
+ )
+ }
+}
Index: src/test/kotlin/platform/minecraft/unpick/UnpickInspectionsTest.kt
===================================================================
--- src/test/kotlin/platform/minecraft/unpick/UnpickInspectionsTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/kotlin/platform/minecraft/unpick/UnpickInspectionsTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,271 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.framework.BaseMinecraftTest
+import com.demonwav.mcdev.framework.EdtInterceptor
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.DuplicateUnpickConstantInspection
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.InvalidUnpickConstantFieldInspection
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.UnknownUnpickGroupInspection
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.UnpickDivisionByZeroInspection
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.UnpickExpressionTypeInspection
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.UnpickGroupTypeConflictInspection
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.UnpickTargetMismatchInspection
+import com.demonwav.mcdev.platform.minecraft.unpick.inspections.UnresolvedUnpickReferenceInspection
+import com.intellij.codeInspection.LocalInspectionTool
+import kotlin.reflect.KClass
+import org.intellij.lang.annotations.Language
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(EdtInterceptor::class)
+@DisplayName("Unpick Inspections Tests")
+class UnpickInspectionsTest : BaseMinecraftTest() {
+
+ @BeforeEach
+ fun setupProject() {
+ buildProject {
+ java(
+ "com/example/Constants.java",
+ """
+ package com.example;
+
+ public class Constants {
+ public static final int ONE = 1;
+ public static final int TWO = 2;
+ public static final int ALSO_ONE = 1;
+ public static final long BIG = 10L;
+ public static final String NAME = "name";
+ public static int notFinal = 3;
+ public static final int NOT_CONSTANT = Integer.parseInt("4");
+ public final int instanceField = 5;
+ public static final boolean FLAG = true;
+
+ public Constants(int x) {
+ }
+
+ public static int method(int a, String b) {
+ return a;
+ }
+
+ public static void voidMethod(Object o) {
+ }
+
+ public static class Inner {
+ public static final int VALUE = 7;
+ public static final char CHAR = 'c';
+ }
+ }
+ """,
+ configure = false,
+ allowAst = true,
+ )
+ java(
+ "com/example/Flags.java",
+ """
+ package com.example;
+
+ public @interface Flags {
+ }
+ """,
+ configure = false,
+ allowAst = true,
+ )
+ }
+ }
+
+ private fun doTest(inspection: KClass, @Language("Unpick") code: String) {
+ fixture.enableInspections(inspection)
+ buildProject {
+ unpick("test.unpick", code)
+ }
+ fixture.checkHighlighting(true, false, true)
+ }
+
+ @Test
+ @DisplayName("Unresolved References")
+ fun unresolvedReferences() = doTest(
+ UnresolvedUnpickReferenceInspection::class,
+ """
+ unpick v4
+ target_method com.example.Constants method (ILjava/lang/String;)I
+ target_method com.example.Constants (I)V
+ target_method com.example.Missing foo ()V
+ target_method com.example.Constants method (I)I
+ target_field com.example.Constants${'$'}Inner VALUE I g
+ target_field com.example.Constants${'$'}Missing VALUE I g
+ target_field com.example.Constants MISSING I g
+ target_annotation com.nope.Foo g
+ group int g
+ @scope package com.example
+ @scope package com.example.nope
+ @scope method com.example.Constants method (ILjava/lang/String;)I
+ com.example.Constants.ONE
+ com.example.Constants.MISSING
+ com.example.Constants.*
+ """,
+ )
+
+ @Test
+ @DisplayName("Unknown Groups")
+ fun unknownGroups() = doTest(
+ UnknownUnpickGroupInspection::class,
+ """
+ unpick v4
+ group int Known
+ 1
+ target_annotation com.example.Flags Known
+ target_annotation com.example.Flags Unknown
+ """,
+ )
+
+ @Test
+ @DisplayName("Group Type Conflicts")
+ fun groupTypeConflicts() = doTest(
+ UnpickGroupTypeConflictInspection::class,
+ """
+ unpick v4
+ group int G
+ 1
+ group long G
+ 2
+ group int H
+ 1
+ group int H
+ 2
+ """,
+ )
+
+ @Test
+ @DisplayName("Invalid Constant Fields")
+ fun invalidConstantFields() = doTest(
+ InvalidUnpickConstantFieldInspection::class,
+ """
+ unpick v4
+ group int
+ com.example.Constants.ONE
+ com.example.Constants.notFinal
+ com.example.Constants.NOT_CONSTANT
+ com.example.Constants.instanceField
+ com.example.Constants.instanceField:instance
+ com.example.Constants.ONE:instance
+ com.example.Constants.ONE:long
+ com.example.Constants.FLAG
+ group String
+ com.example.Constants.*:instance
+ """,
+ )
+
+ @Test
+ @DisplayName("Expression Types")
+ fun expressionTypes() = doTest(
+ UnpickExpressionTypeInspection::class,
+ """
+ unpick v4
+ group int
+ com.example.Constants.ONE + 1
+ 'a'
+ com.example.Constants.BIG
+ "str"
+ (int) "str"
+ 1.0f << 1
+ ~1.0
+ group long
+ com.example.Constants.BIG
+ com.example.Constants.ONE
+ group double
+ 1.5f * 2
+ group String
+ "a" + 1
+ com.example.Constants.NAME
+ "a" - 1
+ """,
+ )
+
+ @Test
+ @DisplayName("Division By Zero")
+ fun divisionByZero() = doTest(
+ UnpickDivisionByZeroInspection::class,
+ """
+ unpick v4
+ group int
+ 1 / 0
+ 1 % (com.example.Constants.ONE - 1)
+ group double
+ 1.0 / 0
+ """,
+ )
+
+ @Test
+ @DisplayName("Duplicate Constants")
+ fun duplicateConstants() = doTest(
+ DuplicateUnpickConstantInspection::class,
+ """
+ unpick v4
+ group int G
+ com.example.Constants.ONE
+ com.example.Constants.ALSO_ONE
+ com.example.Constants.TWO
+ group int G
+ @scope class com.example.Constants
+ com.example.Constants.TWO
+ group long
+ 1
+ 1.0
+ group long
+ 2
+ 1 + 1
+ """,
+ )
+
+ @Test
+ @DisplayName("Target Mismatches")
+ fun targetMismatches() = doTest(
+ UnpickTargetMismatchInspection::class,
+ """
+ unpick v4
+ group int I
+ 1
+ group String S
+ ""
+ group long L
+ 1
+ target_method com.example.Constants method (ILjava/lang/String;)I
+ param 0 I
+ param 1 S
+ param 2 I
+ return L
+ target_method com.example.Constants method (ILjava/lang/String;)I
+ param 1 I
+ return S
+ target_method com.example.Constants voidMethod (Ljava/lang/Object;)V
+ param 0 I
+ return I
+ target_field com.example.Constants${'$'}Inner CHAR C L
+ target_field com.example.Constants${'$'}Inner VALUE J L
+ target_field com.example.Constants NAME Ljava/lang/String; L
+ target_annotation com.example.Flags I
+ target_annotation com.example.Constants I
+ """,
+ )
+}
Index: src/test/kotlin/platform/minecraft/unpick/UnpickLexerTest.kt
===================================================================
--- src/test/kotlin/platform/minecraft/unpick/UnpickLexerTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/kotlin/platform/minecraft/unpick/UnpickLexerTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,45 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.framework.testLexer
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.api.Test
+
+@DisplayName("Unpick Lexing Tests")
+class UnpickLexerTest {
+
+ @Test
+ @DisplayName("Spec Example Lexing Test")
+ fun specTest() = testLexer("lexer/fixtures/spec.unpick", UnpickLexerAdapter())
+
+ @Test
+ @DisplayName("Member Signatures Lexing Test")
+ fun memberSignaturesTest() = testLexer("lexer/fixtures/member_signatures.unpick", UnpickLexerAdapter())
+
+ @Test
+ @DisplayName("Whitespace And Literals Lexing Test")
+ fun whitespaceTest() = testLexer("lexer/fixtures/whitespace.unpick", UnpickLexerAdapter())
+
+ @Test
+ @DisplayName("Unsupported Version Lexing Test")
+ fun unsupportedTest() = testLexer("lexer/fixtures/unsupported.unpick", UnpickLexerAdapter())
+}
Index: src/test/kotlin/platform/minecraft/unpick/UnpickParsingTest.kt
===================================================================
--- src/test/kotlin/platform/minecraft/unpick/UnpickParsingTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/kotlin/platform/minecraft/unpick/UnpickParsingTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,66 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.framework.EdtInterceptor
+import com.demonwav.mcdev.framework.ProjectBuilder
+import com.demonwav.mcdev.framework.ProjectBuilderTest
+import com.demonwav.mcdev.framework.testParser
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(EdtInterceptor::class)
+@DisplayName("Unpick Parsing Tests")
+class UnpickParsingTest : ProjectBuilderTest() {
+
+ @Test
+ @DisplayName("Spec Example Parsing Test")
+ fun specTest() = testParser("parser/fixtures/spec.unpick", ProjectBuilder::unpick)
+
+ @Test
+ @DisplayName("Expression Parsing Test")
+ fun expressionTest() = testParser("parser/fixtures/expression.unpick", ProjectBuilder::unpick)
+
+ @Test
+ @DisplayName("Group Definition Parsing Test")
+ fun groupDefinitionTest() = testParser("parser/fixtures/group_definition.unpick", ProjectBuilder::unpick)
+
+ @Test
+ @DisplayName("Target Method Parsing Test")
+ fun targetMethodTest() = testParser("parser/fixtures/target_method.unpick", ProjectBuilder::unpick)
+
+ @Test
+ @DisplayName("Minimal Spaces Parsing Test")
+ fun minimalSpacesTest() = testParser("parser/fixtures/minimal_spaces.unpick", ProjectBuilder::unpick)
+
+ @Test
+ @DisplayName("Doc Comments Parsing Test")
+ fun docsTest() = testParser("parser/fixtures/docs.unpick", ProjectBuilder::unpick)
+
+ @Test
+ @DisplayName("Error Recovery Parsing Test")
+ fun recoveryTest() = testParser("parser/fixtures/recovery.unpick", ProjectBuilder::unpick)
+
+ @Test
+ @DisplayName("Unsupported Version Parsing Test")
+ fun unsupportedTest() = testParser("parser/fixtures/unsupported.unpick", ProjectBuilder::unpick)
+}
Index: src/test/kotlin/platform/minecraft/unpick/UnpickReferenceFixturesTest.kt
===================================================================
--- src/test/kotlin/platform/minecraft/unpick/UnpickReferenceFixturesTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/kotlin/platform/minecraft/unpick/UnpickReferenceFixturesTest.kt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,126 @@
+/*
+ * Minecraft Development for IntelliJ
+ *
+ * https://mcdev.io/
+ *
+ * Copyright (C) 2026 minecraft-dev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 3.0 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.demonwav.mcdev.platform.minecraft.unpick
+
+import com.demonwav.mcdev.framework.BASE_DATA_PATH
+import com.demonwav.mcdev.framework.EdtInterceptor
+import com.demonwav.mcdev.framework.ProjectBuilderTest
+import com.intellij.lang.annotation.HighlightSeverity
+import java.io.File
+import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+/**
+ * Checks that the test files of the reference implementation (https://github.com/Vineflower/unpick-parser) are
+ * accepted or rejected in the same way by the parser and annotator.
+ */
+@ExtendWith(EdtInterceptor::class)
+@DisplayName("Unpick Reference Fixtures Tests")
+class UnpickReferenceFixturesTest : ProjectBuilderTest() {
+
+ private val fixturesDir = File("$BASE_DATA_PATH/platform/minecraft/unpick/reference")
+
+ private fun fixtures(kind: String) = fixturesDir.resolve(kind).listFiles { file -> file.extension == "unpick" }!!
+ .sortedBy { it.name }
+ .also { Assertions.assertTrue(it.isNotEmpty(), "No $kind fixtures found") }
+
+ private fun errorsIn(file: File): List {
+ fixture.configureByText(file.name, file.readText())
+ return fixture.doHighlighting(HighlightSeverity.ERROR).map { it.description }
+ }
+
+ @Test
+ @DisplayName("Valid Reference Fixtures")
+ fun validFixtures() {
+ val failures = fixtures("valid").mapNotNull { file ->
+ errorsIn(file).takeIf { it.isNotEmpty() }?.let { "${file.name}: $it" }
+ }
+ Assertions.assertEquals(emptyList(), failures)
+ }
+
+ @Test
+ @DisplayName("Invalid Reference Fixtures")
+ fun invalidFixtures() {
+ val failures = fixtures("invalid").mapNotNull { file ->
+ val errors = errorsIn(file)
+ val expected = EXPECTED_MESSAGES[file.name]
+ when {
+ errors.isEmpty() -> "${file.name}: no errors"
+ expected != null && errors.none { it == expected } -> "${file.name}: expected '$expected' in $errors"
+ else -> null
+ }
+ }
+ Assertions.assertEquals(emptyList(), failures)
+ }
+
+ private companion object {
+ val EXPECTED_MESSAGES = mapOf(
+ "other_missing_header.unpick" to "Missing version marker, expected 'unpick v4' on the first line",
+ "whitespace_before_first_line.unpick" to
+ "Missing version marker, expected 'unpick v4' on the first line",
+ "whitespace_comment_on_first_line.unpick" to "The first line must be exactly 'unpick v3'",
+ "syntax_target_annotation_unpick_v3.unpick" to "Target annotations require unpick v4",
+ "syntax_group_definition_flag_default_group.unpick" to
+ "The @flags attribute is not applicable to the default group",
+ "syntax_group_definition_flag_invalid_data_type.unpick" to
+ "The @flags attribute is only applicable to int and long groups",
+ "syntax_group_definition_invalid_format.unpick" to "Unknown format 'foo'",
+ "syntax_group_definition_multiple_flags.unpick" to "Duplicate @flags attribute",
+ "syntax_group_definition_multiple_formats.unpick" to "Duplicate @format attribute",
+ "syntax_group_definition_multiple_strict.unpick" to "Duplicate @strict attribute",
+ "syntax_method_name_angled_brackets_incorrect.unpick" to "Expected 'init' or 'clinit'",
+ "syntax_target_method_duplicate_param.unpick" to "Parameter 0 is targeted more than once",
+ "syntax_target_method_duplicate_return.unpick" to "The return value is targeted more than once",
+ "tokens_char_empty.unpick" to "Empty character literal",
+ "tokens_char_multiple_chars.unpick" to "Too many characters in character literal",
+ "tokens_char_unclosed.unpick" to "Unterminated character literal",
+ "tokens_string_unclosed.unpick" to "Unterminated string literal",
+ "tokens_double_missing_exp_value.unpick" to "Malformed number",
+ "tokens_double_missing_exp_value_after_sign.unpick" to "Malformed number",
+ "tokens_double_missing_frac_part.unpick" to "Malformed number",
+ "tokens_double_out_of_bounds.unpick" to "Double out of bounds",
+ "tokens_float_out_of_bounds.unpick" to "Float out of bounds",
+ "tokens_integer_missing_value_binary.unpick" to "Malformed number",
+ "tokens_integer_missing_value_hex.unpick" to "Malformed number",
+ "tokens_integer_out_of_bounds_negative_binary.unpick" to "Integer out of bounds",
+ "tokens_integer_out_of_bounds_negative_decimal.unpick" to "Integer out of bounds",
+ "tokens_integer_out_of_bounds_negative_hex.unpick" to "Integer out of bounds",
+ "tokens_integer_out_of_bounds_negative_octal.unpick" to "Integer out of bounds",
+ "tokens_integer_out_of_bounds_positive_binary.unpick" to "Integer out of bounds",
+ "tokens_integer_out_of_bounds_positive_decimal.unpick" to "Integer out of bounds",
+ "tokens_integer_out_of_bounds_positive_hex.unpick" to "Integer out of bounds",
+ "tokens_integer_out_of_bounds_positive_octal.unpick" to "Integer out of bounds",
+ "tokens_field_descriptor_empty_object.unpick" to "Unexpected end of descriptor",
+ "tokens_field_descriptor_invalid_char.unpick" to "Illegal character in descriptor: 'X'",
+ "tokens_field_descriptor_object_illegal_bracket.unpick" to "Illegal character in descriptor: '['",
+ "tokens_field_descriptor_object_illegal_period.unpick" to "Illegal character in descriptor: '.'",
+ "tokens_field_descriptor_unterminated_object.unpick" to "Unexpected end of descriptor",
+ "tokens_field_descriptor_untyped_array.unpick" to "Unexpected end of descriptor",
+ "tokens_field_descriptor_void.unpick" to "Illegal character in descriptor: 'V'",
+ "tokens_method_descriptor_field_descriptor.unpick" to "Expected a method descriptor starting with '('",
+ "tokens_method_descriptor_no_return_type.unpick" to "Unexpected end of descriptor",
+ "tokens_method_descriptor_unclosed_paren.unpick" to "Unexpected end of descriptor",
+ "tokens_method_descriptor_void_parameter.unpick" to "Illegal character in descriptor: 'V'",
+ )
+ }
+}
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/member_signatures.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/member_signatures.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/member_signatures.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,119 @@
+unpick ('unpick')
+WHITE_SPACE (' ')
+IDENTIFIER ('v4')
+NEWLINE ('\n')
+target_method ('target_method')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+. ('.')
+IDENTIFIER ('Bar')
+WHITE_SPACE (' ')
+IDENTIFIER ('baz')
+WHITE_SPACE (' ')
+METHOD_DESCRIPTOR ('(ILjava/lang/String;)V')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('param')
+WHITE_SPACE (' ')
+INTEGER ('0')
+WHITE_SPACE (' ')
+IDENTIFIER ('a')
+NEWLINE ('\n')
+target_method ('target_method')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+WHITE_SPACE (' ')
+. ('.')
+WHITE_SPACE (' ')
+IDENTIFIER ('Bar')
+WHITE_SPACE (' ')
+< ('<')
+WHITE_SPACE (' ')
+IDENTIFIER ('init')
+WHITE_SPACE (' ')
+> ('>')
+WHITE_SPACE (' ')
+METHOD_DESCRIPTOR ('()V')
+NEWLINE ('\n')
+target_method ('target_method')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+. ('.')
+IDENTIFIER ('Bar')
+WHITE_SPACE (' ')
+IDENTIFIER ('baz')
+METHOD_DESCRIPTOR ('()V')
+NEWLINE ('\n')
+target_field ('target_field')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+. ('.')
+IDENTIFIER ('Bar$Baz')
+WHITE_SPACE (' ')
+IDENTIFIER ('quux')
+WHITE_SPACE (' ')
+FIELD_DESCRIPTOR ('[Ljava/lang/String;')
+IDENTIFIER ('g')
+NEWLINE ('\n')
+target_field ('target_field')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+. ('.')
+IDENTIFIER ('Bar')
+WHITE_SPACE (' ')
+IDENTIFIER ('baz')
+WHITE_SPACE (' ')
+FIELD_DESCRIPTOR ('Ljava.lang.String;')
+WHITE_SPACE (' ')
+IDENTIFIER ('g')
+WHITE_SPACE (' ')
+COMMENT ('# comment')
+NEWLINE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('int')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+IDENTIFIER ('scope')
+WHITE_SPACE (' ')
+IDENTIFIER ('method')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+. ('.')
+IDENTIFIER ('Bar')
+WHITE_SPACE (' ')
+IDENTIFIER ('baz')
+WHITE_SPACE (' ')
+METHOD_DESCRIPTOR ('(I)V')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+WHITE_SPACE (' ')
+IDENTIFIER ('scope')
+WHITE_SPACE (' ')
+IDENTIFIER ('method')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+. ('.')
+IDENTIFIER ('Bar')
+WHITE_SPACE (' ')
+< ('<')
+IDENTIFIER ('clinit')
+> ('>')
+WHITE_SPACE (' ')
+METHOD_DESCRIPTOR ('()V')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+IDENTIFIER ('scope')
+WHITE_SPACE (' ')
+IDENTIFIER ('class')
+WHITE_SPACE (' ')
+IDENTIFIER ('foo')
+. ('.')
+IDENTIFIER ('Bar')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+IDENTIFIER ('scoped')
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/member_signatures.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/member_signatures.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/member_signatures.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,12 @@
+unpick v4
+target_method foo.Bar baz (ILjava/lang/String;)V
+ param 0 a
+target_method foo . Bar < init > ()V
+target_method foo.Bar baz()V
+target_field foo.Bar$Baz quux [Ljava/lang/String;g
+target_field foo.Bar baz Ljava.lang.String; g # comment
+group int
+ @scope method foo.Bar baz (I)V
+ @ scope method foo.Bar ()V
+ @scope class foo.Bar
+ @scoped
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/spec.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/spec.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/spec.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,288 @@
+unpick ('unpick')
+WHITE_SPACE (' ')
+IDENTIFIER ('v4')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# apply to floats in the default group globally')
+WHITE_SPACE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('float')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+IDENTIFIER ('strict')
+WHITE_SPACE (' ')
+COMMENT ('# don't apply to double literals')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('util')
+. ('.')
+IDENTIFIER ('Mth')
+. ('.')
+IDENTIFIER ('PI')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('util')
+. ('.')
+IDENTIFIER ('Mth')
+. ('.')
+IDENTIFIER ('PI')
+WHITE_SPACE (' ')
+/ ('/')
+WHITE_SPACE (' ')
+INTEGER ('3')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# apply to strings in the default group globally')
+WHITE_SPACE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('String')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('SharedConstants')
+. ('.')
+IDENTIFIER ('VERSION_STRING')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# an example of a wildcard field')
+WHITE_SPACE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('int')
+WHITE_SPACE (' ')
+IDENTIFIER ('LevelEvents')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('world')
+. ('.')
+IDENTIFIER ('level')
+. ('.')
+IDENTIFIER ('block')
+. ('.')
+IDENTIFIER ('LevelEvent')
+. ('.')
+* ('*')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# apply to ints in the default group within the scope of ClientboundCustomPayloadPacket')
+WHITE_SPACE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('int')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+IDENTIFIER ('scope')
+WHITE_SPACE (' ')
+IDENTIFIER ('class')
+WHITE_SPACE (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('network')
+. ('.')
+IDENTIFIER ('protocol')
+. ('.')
+IDENTIFIER ('common')
+. ('.')
+IDENTIFIER ('ClientboundCustomPayloadPacket')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('network')
+. ('.')
+IDENTIFIER ('protocol')
+. ('.')
+IDENTIFIER ('common')
+. ('.')
+IDENTIFIER ('ClientboundCustomPayloadPacket')
+. ('.')
+IDENTIFIER ('MAX_PAYLOAD_SIZE')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# apply to ints with the group "ARGBColor"')
+WHITE_SPACE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('int')
+WHITE_SPACE (' ')
+IDENTIFIER ('ARGBColor')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+IDENTIFIER ('format')
+WHITE_SPACE (' ')
+IDENTIFIER ('hex')
+WHITE_SPACE (' ')
+COMMENT ('# format unrecongized constants as hex')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('util')
+. ('.')
+IDENTIFIER ('CommonColors')
+. ('.')
+IDENTIFIER ('WHITE')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('util')
+. ('.')
+IDENTIFIER ('CommonColors')
+. ('.')
+IDENTIFIER ('BLACK')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# apply the group "ARGBColor" to ints flowing into the 5th parameter of of GuiGraphics.fill')
+WHITE_SPACE ('\n')
+target_method ('target_method')
+WHITE_SPACE (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('client')
+. ('.')
+IDENTIFIER ('gui')
+. ('.')
+IDENTIFIER ('GuiGraphics')
+WHITE_SPACE (' ')
+IDENTIFIER ('fill')
+WHITE_SPACE (' ')
+METHOD_DESCRIPTOR ('(IIIII)V')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('param')
+WHITE_SPACE (' ')
+INTEGER ('4')
+WHITE_SPACE (' ')
+IDENTIFIER ('ARGBColor')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# apply the group "ARGBColor" to ints flowing from the return of ARGB.color')
+WHITE_SPACE ('\n')
+target_method ('target_method')
+WHITE_SPACE (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('util')
+. ('.')
+IDENTIFIER ('ARGB')
+WHITE_SPACE (' ')
+IDENTIFIER ('color')
+WHITE_SPACE (' ')
+METHOD_DESCRIPTOR ('(IIII)I')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('return')
+WHITE_SPACE (' ')
+IDENTIFIER ('ARGBColor')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+target_field ('target_field')
+WHITE_SPACE (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('core')
+. ('.')
+IDENTIFIER ('particles')
+. ('.')
+IDENTIFIER ('ColorParticleOption')
+WHITE_SPACE (' ')
+IDENTIFIER ('color')
+WHITE_SPACE (' ')
+FIELD_DESCRIPTOR ('I')
+WHITE_SPACE (' ')
+IDENTIFIER ('ARGBColor')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+COMMENT ('# apply to ints with the group "SetBlockFlag"')
+WHITE_SPACE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('int')
+WHITE_SPACE (' ')
+IDENTIFIER ('SetBlockFlag')
+NEWLINE ('\n')
+INDENT (' ')
+@ ('@')
+IDENTIFIER ('flags')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('world')
+. ('.')
+IDENTIFIER ('level')
+. ('.')
+IDENTIFIER ('block')
+. ('.')
+IDENTIFIER ('Block')
+. ('.')
+IDENTIFIER ('UPDATE_ALL')
+NEWLINE ('\n')
+INDENT (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('world')
+. ('.')
+IDENTIFIER ('level')
+. ('.')
+IDENTIFIER ('block')
+. ('.')
+IDENTIFIER ('Block')
+. ('.')
+IDENTIFIER ('UPDATE_NEIGHBORS')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+target_annotation ('target_annotation')
+WHITE_SPACE (' ')
+IDENTIFIER ('net')
+. ('.')
+IDENTIFIER ('minecraft')
+. ('.')
+IDENTIFIER ('world')
+. ('.')
+IDENTIFIER ('level')
+. ('.')
+IDENTIFIER ('block')
+. ('.')
+IDENTIFIER ('Block$UpdateFlags')
+WHITE_SPACE (' ')
+IDENTIFIER ('SetBlockFlag')
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/spec.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/spec.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/spec.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,44 @@
+unpick v4
+
+# apply to floats in the default group globally
+group float
+ @strict # don't apply to double literals
+ net.minecraft.util.Mth.PI
+ net.minecraft.util.Mth.PI / 3
+
+# apply to strings in the default group globally
+group String
+ net.minecraft.SharedConstants.VERSION_STRING
+
+# an example of a wildcard field
+group int LevelEvents
+ net.minecraft.world.level.block.LevelEvent.*
+
+# apply to ints in the default group within the scope of ClientboundCustomPayloadPacket
+group int
+ @scope class net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket
+ net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket.MAX_PAYLOAD_SIZE
+
+# apply to ints with the group "ARGBColor"
+group int ARGBColor
+ @format hex # format unrecongized constants as hex
+ net.minecraft.util.CommonColors.WHITE
+ net.minecraft.util.CommonColors.BLACK
+
+# apply the group "ARGBColor" to ints flowing into the 5th parameter of of GuiGraphics.fill
+target_method net.minecraft.client.gui.GuiGraphics fill (IIIII)V
+ param 4 ARGBColor
+
+# apply the group "ARGBColor" to ints flowing from the return of ARGB.color
+target_method net.minecraft.util.ARGB color (IIII)I
+ return ARGBColor
+
+target_field net.minecraft.core.particles.ColorParticleOption color I ARGBColor
+
+# apply to ints with the group "SetBlockFlag"
+group int SetBlockFlag
+ @flags
+ net.minecraft.world.level.block.Block.UPDATE_ALL
+ net.minecraft.world.level.block.Block.UPDATE_NEIGHBORS
+
+target_annotation net.minecraft.world.level.block.Block$UpdateFlags SetBlockFlag
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/unsupported.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/unsupported.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/unsupported.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,5 @@
+unpick ('unpick')
+WHITE_SPACE (' ')
+IDENTIFIER ('v2')
+NEWLINE ('\n')
+UNSUPPORTED_BODY ('\nSomething in an old format\n with indentation')
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/unsupported.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/unsupported.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/unsupported.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,4 @@
+unpick v2
+
+Something in an old format
+ with indentation
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/whitespace.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/whitespace.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/whitespace.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,45 @@
+unpick ('unpick')
+WHITE_SPACE (' ')
+IDENTIFIER ('v4')
+NEWLINE ('\n')
+WHITE_SPACE ('\n')
+DOC_COMMENT ('#: Some docs')
+WHITE_SPACE ('\n')
+DOC_COMMENT ('#: more docs')
+WHITE_SPACE ('\n')
+group ('group')
+WHITE_SPACE (' ')
+IDENTIFIER ('int')
+WHITE_SPACE (' ')
+IDENTIFIER ('g')
+WHITE_SPACE (' ')
+COMMENT ('# trailing comment')
+NEWLINE ('\n')
+WHITE_SPACE (' ')
+COMMENT ('# indented comment')
+WHITE_SPACE ('\n')
+WHITE_SPACE ('\n')
+INDENT (' ')
+DOUBLE ('1.5')
++ ('+')
+INTEGER ('3')
+WHITE_SPACE (' ')
+<< ('<<')
+WHITE_SPACE (' ')
+INTEGER ('0x1F')
+NEWLINE ('\n')
+INDENT (' ')
+CHAR (''a'')
+WHITE_SPACE (' ')
+STRING ('"str\"ing"')
+WHITE_SPACE (' ')
+CHAR (''unterminated')
+NEWLINE ('\n')
+INDENT (' ')
+MALFORMED_NUMBER ('0x')
+WHITE_SPACE (' ')
+MALFORMED_NUMBER ('1.0e+')
+WHITE_SPACE (' ')
+MALFORMED_NUMBER ('09')
+WHITE_SPACE (' ')
+MALFORMED_NUMBER ('12abc')
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/whitespace.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/whitespace.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/lexer/fixtures/whitespace.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,10 @@
+unpick v4
+
+#: Some docs
+#: more docs
+group int g # trailing comment
+ # indented comment
+
+ 1.5+3 << 0x1F
+ 'a' "str\"ing" 'unterminated
+ 0x 1.0e+ 09 12abc
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/docs.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/docs.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/docs.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,78 @@
+Unpick File(0,197)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v3')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ PsiWhiteSpace('\n')(10,11)
+ PsiComment(DOC_COMMENT)('#:foo')(11,16)
+ PsiWhiteSpace('\n')(16,17)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(17,26)
+ PsiElement(group)('group')(17,22)
+ PsiWhiteSpace(' ')(22,23)
+ UnpickDataTypeImpl(DATA_TYPE)(23,26)
+ PsiElement(IDENTIFIER)('int')(23,26)
+ PsiElement(NEWLINE)('\n')(26,27)
+ PsiWhiteSpace('\n')(27,28)
+ PsiComment(DOC_COMMENT)('#: bar')(28,34)
+ PsiWhiteSpace('\n')(34,35)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(35,44)
+ PsiElement(group)('group')(35,40)
+ PsiWhiteSpace(' ')(40,41)
+ UnpickDataTypeImpl(DATA_TYPE)(41,44)
+ PsiElement(IDENTIFIER)('int')(41,44)
+ PsiElement(NEWLINE)('\n')(44,45)
+ PsiWhiteSpace('\n')(45,46)
+ PsiComment(DOC_COMMENT)('#: boo')(46,52)
+ PsiWhiteSpace('\n')(52,53)
+ PsiComment(DOC_COMMENT)('#: and')(53,59)
+ PsiWhiteSpace('\n')(59,60)
+ PsiComment(DOC_COMMENT)('#: foo')(60,66)
+ PsiWhiteSpace('\n')(66,67)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(67,76)
+ PsiElement(group)('group')(67,72)
+ PsiWhiteSpace(' ')(72,73)
+ UnpickDataTypeImpl(DATA_TYPE)(73,76)
+ PsiElement(IDENTIFIER)('int')(73,76)
+ PsiElement(NEWLINE)('\n')(76,77)
+ PsiWhiteSpace('\n')(77,78)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(78,87)
+ PsiElement(group)('group')(78,83)
+ PsiWhiteSpace(' ')(83,84)
+ UnpickDataTypeImpl(DATA_TYPE)(84,87)
+ PsiElement(IDENTIFIER)('int')(84,87)
+ PsiElement(NEWLINE)('\n')(87,88)
+ PsiWhiteSpace('\n')(88,89)
+ PsiComment(DOC_COMMENT)('#:')(89,91)
+ PsiWhiteSpace('\n')(91,92)
+ PsiComment(DOC_COMMENT)('#: some')(92,99)
+ PsiWhiteSpace('\n')(99,100)
+ PsiComment(DOC_COMMENT)('#:')(100,102)
+ PsiWhiteSpace('\n')(102,103)
+ PsiComment(DOC_COMMENT)('#: blank')(103,111)
+ PsiWhiteSpace('\n')(111,112)
+ PsiComment(DOC_COMMENT)('#:')(112,114)
+ PsiWhiteSpace('\n')(114,115)
+ PsiComment(DOC_COMMENT)('#:')(115,117)
+ PsiWhiteSpace('\n')(117,118)
+ PsiComment(DOC_COMMENT)('#: lines')(118,126)
+ PsiWhiteSpace('\n')(126,127)
+ PsiComment(DOC_COMMENT)('#:')(127,129)
+ PsiWhiteSpace('\n')(129,130)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(130,139)
+ PsiElement(group)('group')(130,135)
+ PsiWhiteSpace(' ')(135,136)
+ UnpickDataTypeImpl(DATA_TYPE)(136,139)
+ PsiElement(IDENTIFIER)('int')(136,139)
+ PsiElement(NEWLINE)('\n')(139,140)
+ PsiWhiteSpace('\n')(140,141)
+ PsiComment(COMMENT)('# : not a doc comment')(141,162)
+ PsiWhiteSpace('\n')(162,163)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(163,172)
+ PsiElement(group)('group')(163,168)
+ PsiWhiteSpace(' ')(168,169)
+ UnpickDataTypeImpl(DATA_TYPE)(169,172)
+ PsiElement(IDENTIFIER)('int')(169,172)
+ PsiElement(NEWLINE)('\n')(172,173)
+ PsiWhiteSpace('\n')(173,174)
+ PsiComment(DOC_COMMENT)('#: trailing doc comment')(174,197)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/docs.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/docs.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/docs.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,29 @@
+unpick v3
+
+#:foo
+group int
+
+#: bar
+group int
+
+#: boo
+#: and
+#: foo
+group int
+
+group int
+
+#:
+#: some
+#:
+#: blank
+#:
+#:
+#: lines
+#:
+group int
+
+# : not a doc comment
+group int
+
+#: trailing doc comment
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/expression.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/expression.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/expression.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,329 @@
+Unpick File(0,388)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v3')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(10,388)
+ PsiElement(group)('group')(10,15)
+ PsiWhiteSpace(' ')(15,16)
+ UnpickDataTypeImpl(DATA_TYPE)(16,19)
+ PsiElement(IDENTIFIER)('int')(16,19)
+ PsiElement(NEWLINE)('\n')(19,20)
+ PsiElement(INDENT)(' ')(20,24)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(24,33)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(24,33)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(24,29)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(24,25)
+ PsiElement(INTEGER)('1')(24,25)
+ PsiWhiteSpace(' ')(25,26)
+ PsiElement(-)('-')(26,27)
+ PsiWhiteSpace(' ')(27,28)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(28,29)
+ PsiElement(INTEGER)('2')(28,29)
+ PsiWhiteSpace(' ')(29,30)
+ PsiElement(+)('+')(30,31)
+ PsiWhiteSpace(' ')(31,32)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(32,33)
+ PsiElement(INTEGER)('3')(32,33)
+ PsiElement(NEWLINE)('\n')(33,34)
+ PsiElement(INDENT)(' ')(34,38)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(38,89)
+ UnpickOrExpressionImpl(OR_EXPRESSION)(38,89)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(38,39)
+ PsiElement(INTEGER)('0')(38,39)
+ PsiWhiteSpace(' ')(39,40)
+ PsiElement(|)('|')(40,41)
+ PsiWhiteSpace(' ')(41,42)
+ UnpickXorExpressionImpl(XOR_EXPRESSION)(42,89)
+ UnpickShiftExpressionImpl(SHIFT_EXPRESSION)(42,71)
+ UnpickShiftExpressionImpl(SHIFT_EXPRESSION)(42,66)
+ UnpickShiftExpressionImpl(SHIFT_EXPRESSION)(42,60)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(42,43)
+ PsiElement(INTEGER)('1')(42,43)
+ PsiWhiteSpace(' ')(43,44)
+ PsiElement(<<)('<<')(44,46)
+ PsiWhiteSpace(' ')(46,47)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(47,60)
+ UnpickMultiplicativeExpressionImpl(MULTIPLICATIVE_EXPRESSION)(47,56)
+ UnpickMultiplicativeExpressionImpl(MULTIPLICATIVE_EXPRESSION)(47,52)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(47,48)
+ PsiElement(INTEGER)('2')(47,48)
+ PsiWhiteSpace(' ')(48,49)
+ PsiElement(/)('/')(49,50)
+ PsiWhiteSpace(' ')(50,51)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(51,52)
+ PsiElement(INTEGER)('3')(51,52)
+ PsiWhiteSpace(' ')(52,53)
+ PsiElement(%)('%')(53,54)
+ PsiWhiteSpace(' ')(54,55)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(55,56)
+ PsiElement(INTEGER)('4')(55,56)
+ PsiWhiteSpace(' ')(56,57)
+ PsiElement(+)('+')(57,58)
+ PsiWhiteSpace(' ')(58,59)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(59,60)
+ PsiElement(INTEGER)('5')(59,60)
+ PsiWhiteSpace(' ')(60,61)
+ PsiElement(>>>)('>>>')(61,64)
+ PsiWhiteSpace(' ')(64,65)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(65,66)
+ PsiElement(INTEGER)('6')(65,66)
+ PsiWhiteSpace(' ')(66,67)
+ PsiElement(>>)('>>')(67,69)
+ PsiWhiteSpace(' ')(69,70)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(70,71)
+ PsiElement(INTEGER)('7')(70,71)
+ PsiWhiteSpace(' ')(71,72)
+ PsiElement(^)('^')(72,73)
+ PsiWhiteSpace(' ')(73,74)
+ UnpickAndExpressionImpl(AND_EXPRESSION)(74,89)
+ UnpickMultiplicativeExpressionImpl(MULTIPLICATIVE_EXPRESSION)(74,79)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(74,75)
+ PsiElement(INTEGER)('8')(74,75)
+ PsiWhiteSpace(' ')(75,76)
+ PsiElement(*)('*')(76,77)
+ PsiWhiteSpace(' ')(77,78)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(78,79)
+ PsiElement(INTEGER)('9')(78,79)
+ PsiWhiteSpace(' ')(79,80)
+ PsiElement(&)('&')(80,81)
+ PsiWhiteSpace(' ')(81,82)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(82,89)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(82,84)
+ PsiElement(INTEGER)('10')(82,84)
+ PsiWhiteSpace(' ')(84,85)
+ PsiElement(-)('-')(85,86)
+ PsiWhiteSpace(' ')(86,87)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(87,89)
+ PsiElement(INTEGER)('11')(87,89)
+ PsiElement(NEWLINE)('\n')(89,90)
+ PsiElement(INDENT)(' ')(90,94)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(94,96)
+ UnpickNegateExpressionImpl(NEGATE_EXPRESSION)(94,96)
+ PsiElement(-)('-')(94,95)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(95,96)
+ PsiElement(INTEGER)('0')(95,96)
+ PsiElement(NEWLINE)('\n')(96,97)
+ PsiElement(INDENT)(' ')(97,101)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(101,103)
+ UnpickBitNotExpressionImpl(BIT_NOT_EXPRESSION)(101,103)
+ PsiElement(~)('~')(101,102)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(102,103)
+ PsiElement(INTEGER)('0')(102,103)
+ PsiElement(NEWLINE)('\n')(103,104)
+ PsiElement(INDENT)(' ')(104,108)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(108,114)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(108,114)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(108,109)
+ PsiElement(INTEGER)('1')(108,109)
+ PsiWhiteSpace(' ')(109,110)
+ PsiElement(+)('+')(110,111)
+ PsiWhiteSpace(' ')(111,112)
+ UnpickNegateExpressionImpl(NEGATE_EXPRESSION)(112,114)
+ PsiElement(-)('-')(112,113)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(113,114)
+ PsiElement(INTEGER)('2')(113,114)
+ PsiElement(NEWLINE)('\n')(114,115)
+ PsiElement(INDENT)(' ')(115,119)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(119,126)
+ UnpickCastExpressionImpl(CAST_EXPRESSION)(119,126)
+ PsiElement(()('(')(119,120)
+ UnpickDataTypeImpl(DATA_TYPE)(120,123)
+ PsiElement(IDENTIFIER)('int')(120,123)
+ PsiElement())(')')(123,124)
+ PsiWhiteSpace(' ')(124,125)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(125,126)
+ PsiElement(INTEGER)('1')(125,126)
+ PsiElement(NEWLINE)('\n')(126,127)
+ PsiElement(INDENT)(' ')(127,131)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(131,134)
+ UnpickParenExpressionImpl(PAREN_EXPRESSION)(131,134)
+ PsiElement(()('(')(131,132)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(132,133)
+ PsiElement(INTEGER)('1')(132,133)
+ PsiElement())(')')(133,134)
+ PsiElement(NEWLINE)('\n')(134,135)
+ PsiElement(INDENT)(' ')(135,139)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(139,146)
+ UnpickParenExpressionImpl(PAREN_EXPRESSION)(139,146)
+ PsiElement(()('(')(139,140)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(140,145)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(140,141)
+ PsiElement(INTEGER)('1')(140,141)
+ PsiWhiteSpace(' ')(141,142)
+ PsiElement(+)('+')(142,143)
+ PsiWhiteSpace(' ')(143,144)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(144,145)
+ PsiElement(INTEGER)('2')(144,145)
+ PsiElement())(')')(145,146)
+ PsiElement(NEWLINE)('\n')(146,147)
+ PsiElement(INDENT)(' ')(147,151)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(151,166)
+ UnpickMultiplicativeExpressionImpl(MULTIPLICATIVE_EXPRESSION)(151,166)
+ UnpickMultiplicativeExpressionImpl(MULTIPLICATIVE_EXPRESSION)(151,162)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(151,152)
+ PsiElement(INTEGER)('1')(151,152)
+ PsiWhiteSpace(' ')(152,153)
+ PsiElement(*)('*')(153,154)
+ PsiWhiteSpace(' ')(154,155)
+ UnpickParenExpressionImpl(PAREN_EXPRESSION)(155,162)
+ PsiElement(()('(')(155,156)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(156,161)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(156,157)
+ PsiElement(INTEGER)('2')(156,157)
+ PsiWhiteSpace(' ')(157,158)
+ PsiElement(+)('+')(158,159)
+ PsiWhiteSpace(' ')(159,160)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(160,161)
+ PsiElement(INTEGER)('3')(160,161)
+ PsiElement())(')')(161,162)
+ PsiWhiteSpace(' ')(162,163)
+ PsiElement(/)('/')(163,164)
+ PsiWhiteSpace(' ')(164,165)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(165,166)
+ PsiElement(INTEGER)('4')(165,166)
+ PsiElement(NEWLINE)('\n')(166,167)
+ PsiElement(INDENT)(' ')(167,171)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(171,182)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(171,182)
+ UnpickCastExpressionImpl(CAST_EXPRESSION)(171,178)
+ PsiElement(()('(')(171,172)
+ UnpickDataTypeImpl(DATA_TYPE)(172,175)
+ PsiElement(IDENTIFIER)('int')(172,175)
+ PsiElement())(')')(175,176)
+ PsiWhiteSpace(' ')(176,177)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(177,178)
+ PsiElement(INTEGER)('1')(177,178)
+ PsiWhiteSpace(' ')(178,179)
+ PsiElement(+)('+')(179,180)
+ PsiWhiteSpace(' ')(180,181)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(181,182)
+ PsiElement(INTEGER)('2')(181,182)
+ PsiElement(NEWLINE)('\n')(182,183)
+ PsiElement(INDENT)(' ')(183,187)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(187,198)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(187,198)
+ UnpickClassNameImpl(CLASS_NAME)(187,194)
+ PsiElement(IDENTIFIER)('foo')(187,190)
+ PsiElement(.)('.')(190,191)
+ PsiElement(IDENTIFIER)('Bar')(191,194)
+ PsiElement(.)('.')(194,195)
+ UnpickFieldNameImpl(FIELD_NAME)(195,198)
+ PsiElement(IDENTIFIER)('baz')(195,198)
+ PsiElement(NEWLINE)('\n')(198,199)
+ PsiElement(INDENT)(' ')(199,203)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(203,223)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(203,223)
+ UnpickClassNameImpl(CLASS_NAME)(203,210)
+ PsiElement(IDENTIFIER)('foo')(203,206)
+ PsiElement(.)('.')(206,207)
+ PsiElement(IDENTIFIER)('Bar')(207,210)
+ PsiElement(.)('.')(210,211)
+ UnpickFieldNameImpl(FIELD_NAME)(211,214)
+ PsiElement(IDENTIFIER)('baz')(211,214)
+ PsiElement(:)(':')(214,215)
+ PsiElement(KEYWORD)('instance')(215,223)
+ PsiElement(NEWLINE)('\n')(223,224)
+ PsiElement(INDENT)(' ')(224,228)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(228,244)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(228,244)
+ UnpickClassNameImpl(CLASS_NAME)(228,235)
+ PsiElement(IDENTIFIER)('foo')(228,231)
+ PsiElement(.)('.')(231,232)
+ PsiElement(IDENTIFIER)('Bar')(232,235)
+ PsiElement(.)('.')(235,236)
+ UnpickFieldNameImpl(FIELD_NAME)(236,239)
+ PsiElement(IDENTIFIER)('baz')(236,239)
+ PsiElement(:)(':')(239,240)
+ UnpickDataTypeImpl(DATA_TYPE)(240,244)
+ PsiElement(IDENTIFIER)('byte')(240,244)
+ PsiElement(NEWLINE)('\n')(244,245)
+ PsiElement(INDENT)(' ')(245,249)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(249,274)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(249,274)
+ UnpickClassNameImpl(CLASS_NAME)(249,256)
+ PsiElement(IDENTIFIER)('foo')(249,252)
+ PsiElement(.)('.')(252,253)
+ PsiElement(IDENTIFIER)('Bar')(253,256)
+ PsiElement(.)('.')(256,257)
+ UnpickFieldNameImpl(FIELD_NAME)(257,260)
+ PsiElement(IDENTIFIER)('baz')(257,260)
+ PsiElement(:)(':')(260,261)
+ PsiElement(KEYWORD)('instance')(261,269)
+ PsiElement(:)(':')(269,270)
+ UnpickDataTypeImpl(DATA_TYPE)(270,274)
+ PsiElement(IDENTIFIER)('byte')(270,274)
+ PsiElement(NEWLINE)('\n')(274,275)
+ PsiElement(INDENT)(' ')(275,279)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(279,292)
+ UnpickParenExpressionImpl(PAREN_EXPRESSION)(279,292)
+ PsiElement(()('(')(279,280)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(280,291)
+ UnpickClassNameImpl(CLASS_NAME)(280,287)
+ PsiElement(IDENTIFIER)('foo')(280,283)
+ PsiElement(.)('.')(283,284)
+ PsiElement(IDENTIFIER)('Bar')(284,287)
+ PsiElement(.)('.')(287,288)
+ UnpickFieldNameImpl(FIELD_NAME)(288,291)
+ PsiElement(IDENTIFIER)('baz')(288,291)
+ PsiElement())(')')(291,292)
+ PsiElement(NEWLINE)('\n')(292,293)
+ PsiElement(INDENT)(' ')(293,297)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(297,304)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(297,304)
+ UnpickClassNameImpl(CLASS_NAME)(297,300)
+ PsiElement(IDENTIFIER)('Foo')(297,300)
+ PsiElement(.)('.')(300,301)
+ UnpickFieldNameImpl(FIELD_NAME)(301,304)
+ PsiElement(IDENTIFIER)('bar')(301,304)
+ PsiElement(NEWLINE)('\n')(304,305)
+ PsiElement(INDENT)(' ')(305,309)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(309,318)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(309,318)
+ UnpickClassNameImpl(CLASS_NAME)(309,316)
+ PsiElement(IDENTIFIER)('foo')(309,312)
+ PsiElement(.)('.')(312,313)
+ PsiElement(IDENTIFIER)('Bar')(313,316)
+ PsiElement(.)('.')(316,317)
+ PsiElement(*)('*')(317,318)
+ PsiElement(NEWLINE)('\n')(318,319)
+ PsiElement(INDENT)(' ')(319,323)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(323,341)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(323,341)
+ UnpickClassNameImpl(CLASS_NAME)(323,330)
+ PsiElement(IDENTIFIER)('foo')(323,326)
+ PsiElement(.)('.')(326,327)
+ PsiElement(IDENTIFIER)('Bar')(327,330)
+ PsiElement(.)('.')(330,331)
+ PsiElement(*)('*')(331,332)
+ PsiElement(:)(':')(332,333)
+ PsiElement(KEYWORD)('instance')(333,341)
+ PsiElement(NEWLINE)('\n')(341,342)
+ PsiElement(INDENT)(' ')(342,346)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(346,360)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(346,360)
+ UnpickClassNameImpl(CLASS_NAME)(346,353)
+ PsiElement(IDENTIFIER)('foo')(346,349)
+ PsiElement(.)('.')(349,350)
+ PsiElement(IDENTIFIER)('Bar')(350,353)
+ PsiElement(.)('.')(353,354)
+ PsiElement(*)('*')(354,355)
+ PsiElement(:)(':')(355,356)
+ UnpickDataTypeImpl(DATA_TYPE)(356,360)
+ PsiElement(IDENTIFIER)('byte')(356,360)
+ PsiElement(NEWLINE)('\n')(360,361)
+ PsiElement(INDENT)(' ')(361,365)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(365,388)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(365,388)
+ UnpickClassNameImpl(CLASS_NAME)(365,372)
+ PsiElement(IDENTIFIER)('foo')(365,368)
+ PsiElement(.)('.')(368,369)
+ PsiElement(IDENTIFIER)('Bar')(369,372)
+ PsiElement(.)('.')(372,373)
+ PsiElement(*)('*')(373,374)
+ PsiElement(:)(':')(374,375)
+ PsiElement(KEYWORD)('instance')(375,383)
+ PsiElement(:)(':')(383,384)
+ UnpickDataTypeImpl(DATA_TYPE)(384,388)
+ PsiElement(IDENTIFIER)('byte')(384,388)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/expression.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/expression.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/expression.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,22 @@
+unpick v3
+group int
+ 1 - 2 + 3
+ 0 | 1 << 2 / 3 % 4 + 5 >>> 6 >> 7 ^ 8 * 9 & 10 - 11
+ -0
+ ~0
+ 1 + -2
+ (int) 1
+ (1)
+ (1 + 2)
+ 1 * (2 + 3) / 4
+ (int) 1 + 2
+ foo.Bar.baz
+ foo.Bar.baz:instance
+ foo.Bar.baz:byte
+ foo.Bar.baz:instance:byte
+ (foo.Bar.baz)
+ Foo.bar
+ foo.Bar.*
+ foo.Bar.*:instance
+ foo.Bar.*:byte
+ foo.Bar.*:instance:byte
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/group_definition.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/group_definition.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/group_definition.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,516 @@
+Unpick File(0,886)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v3')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(10,19)
+ PsiElement(group)('group')(10,15)
+ PsiWhiteSpace(' ')(15,16)
+ UnpickDataTypeImpl(DATA_TYPE)(16,19)
+ PsiElement(IDENTIFIER)('int')(16,19)
+ PsiElement(NEWLINE)('\n')(19,20)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(20,35)
+ PsiElement(group)('group')(20,25)
+ PsiWhiteSpace(' ')(25,26)
+ UnpickDataTypeImpl(DATA_TYPE)(26,29)
+ PsiElement(IDENTIFIER)('int')(26,29)
+ PsiElement(NEWLINE)('\n')(29,30)
+ PsiElement(INDENT)(' ')(30,34)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(34,35)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(34,35)
+ PsiElement(INTEGER)('0')(34,35)
+ PsiElement(NEWLINE)('\n')(35,36)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(36,65)
+ PsiElement(group)('group')(36,41)
+ PsiWhiteSpace(' ')(41,42)
+ UnpickDataTypeImpl(DATA_TYPE)(42,45)
+ PsiElement(IDENTIFIER)('int')(42,45)
+ PsiWhiteSpace(' ')(45,46)
+ UnpickGroupNameImpl(GROUP_NAME)(46,47)
+ PsiElement(IDENTIFIER)('g')(46,47)
+ PsiElement(NEWLINE)('\n')(47,48)
+ PsiElement(INDENT)(' ')(48,52)
+ UnpickStrictAttributeImpl(STRICT_ATTRIBUTE)(52,59)
+ PsiElement(@)('@')(52,53)
+ PsiElement(KEYWORD)('strict')(53,59)
+ PsiElement(NEWLINE)('\n')(59,60)
+ PsiElement(INDENT)(' ')(60,64)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(64,65)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(64,65)
+ PsiElement(INTEGER)('0')(64,65)
+ PsiElement(NEWLINE)('\n')(65,66)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(66,82)
+ PsiElement(group)('group')(66,71)
+ PsiWhiteSpace(' ')(71,72)
+ UnpickDataTypeImpl(DATA_TYPE)(72,76)
+ PsiElement(IDENTIFIER)('long')(72,76)
+ PsiElement(NEWLINE)('\n')(76,77)
+ PsiElement(INDENT)(' ')(77,81)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(81,82)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(81,82)
+ PsiElement(INTEGER)('0')(81,82)
+ PsiElement(NEWLINE)('\n')(82,83)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(83,101)
+ PsiElement(group)('group')(83,88)
+ PsiWhiteSpace(' ')(88,89)
+ UnpickDataTypeImpl(DATA_TYPE)(89,93)
+ PsiElement(IDENTIFIER)('long')(89,93)
+ PsiWhiteSpace(' ')(93,94)
+ UnpickGroupNameImpl(GROUP_NAME)(94,95)
+ PsiElement(IDENTIFIER)('g')(94,95)
+ PsiElement(NEWLINE)('\n')(95,96)
+ PsiElement(INDENT)(' ')(96,100)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(100,101)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(100,101)
+ PsiElement(INTEGER)('0')(100,101)
+ PsiElement(NEWLINE)('\n')(101,102)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(102,127)
+ PsiElement(group)('group')(102,107)
+ PsiWhiteSpace(' ')(107,108)
+ UnpickDataTypeImpl(DATA_TYPE)(108,113)
+ PsiElement(IDENTIFIER)('float')(108,113)
+ PsiElement(NEWLINE)('\n')(113,114)
+ PsiElement(INDENT)(' ')(114,118)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(118,119)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(118,119)
+ PsiElement(INTEGER)('0')(118,119)
+ PsiElement(NEWLINE)('\n')(119,120)
+ PsiElement(INDENT)(' ')(120,124)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(124,127)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(124,127)
+ PsiElement(DOUBLE)('1.0')(124,127)
+ PsiElement(NEWLINE)('\n')(127,128)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(128,155)
+ PsiElement(group)('group')(128,133)
+ PsiWhiteSpace(' ')(133,134)
+ UnpickDataTypeImpl(DATA_TYPE)(134,139)
+ PsiElement(IDENTIFIER)('float')(134,139)
+ PsiWhiteSpace(' ')(139,140)
+ UnpickGroupNameImpl(GROUP_NAME)(140,141)
+ PsiElement(IDENTIFIER)('g')(140,141)
+ PsiElement(NEWLINE)('\n')(141,142)
+ PsiElement(INDENT)(' ')(142,146)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(146,147)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(146,147)
+ PsiElement(INTEGER)('0')(146,147)
+ PsiElement(NEWLINE)('\n')(147,148)
+ PsiElement(INDENT)(' ')(148,152)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(152,155)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(152,155)
+ PsiElement(DOUBLE)('1.0')(152,155)
+ PsiElement(NEWLINE)('\n')(155,156)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(156,182)
+ PsiElement(group)('group')(156,161)
+ PsiWhiteSpace(' ')(161,162)
+ UnpickDataTypeImpl(DATA_TYPE)(162,168)
+ PsiElement(IDENTIFIER)('double')(162,168)
+ PsiElement(NEWLINE)('\n')(168,169)
+ PsiElement(INDENT)(' ')(169,173)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(173,174)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(173,174)
+ PsiElement(INTEGER)('0')(173,174)
+ PsiElement(NEWLINE)('\n')(174,175)
+ PsiElement(INDENT)(' ')(175,179)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(179,182)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(179,182)
+ PsiElement(DOUBLE)('1.0')(179,182)
+ PsiElement(NEWLINE)('\n')(182,183)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(183,211)
+ PsiElement(group)('group')(183,188)
+ PsiWhiteSpace(' ')(188,189)
+ UnpickDataTypeImpl(DATA_TYPE)(189,195)
+ PsiElement(IDENTIFIER)('double')(189,195)
+ PsiWhiteSpace(' ')(195,196)
+ UnpickGroupNameImpl(GROUP_NAME)(196,197)
+ PsiElement(IDENTIFIER)('g')(196,197)
+ PsiElement(NEWLINE)('\n')(197,198)
+ PsiElement(INDENT)(' ')(198,202)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(202,203)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(202,203)
+ PsiElement(INTEGER)('0')(202,203)
+ PsiElement(NEWLINE)('\n')(203,204)
+ PsiElement(INDENT)(' ')(204,208)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(208,211)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(208,211)
+ PsiElement(DOUBLE)('1.0')(208,211)
+ PsiElement(NEWLINE)('\n')(211,212)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(212,231)
+ PsiElement(group)('group')(212,217)
+ PsiWhiteSpace(' ')(217,218)
+ UnpickDataTypeImpl(DATA_TYPE)(218,224)
+ PsiElement(IDENTIFIER)('String')(218,224)
+ PsiElement(NEWLINE)('\n')(224,225)
+ PsiElement(INDENT)(' ')(225,229)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(229,231)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(229,231)
+ PsiElement(STRING)('""')(229,231)
+ PsiElement(NEWLINE)('\n')(231,232)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(232,253)
+ PsiElement(group)('group')(232,237)
+ PsiWhiteSpace(' ')(237,238)
+ UnpickDataTypeImpl(DATA_TYPE)(238,244)
+ PsiElement(IDENTIFIER)('String')(238,244)
+ PsiWhiteSpace(' ')(244,245)
+ UnpickGroupNameImpl(GROUP_NAME)(245,246)
+ PsiElement(IDENTIFIER)('g')(245,246)
+ PsiElement(NEWLINE)('\n')(246,247)
+ PsiElement(INDENT)(' ')(247,251)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(251,253)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(251,253)
+ PsiElement(STRING)('""')(251,253)
+ PsiElement(NEWLINE)('\n')(253,254)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(254,277)
+ PsiElement(group)('group')(254,259)
+ PsiWhiteSpace(' ')(259,260)
+ UnpickDataTypeImpl(DATA_TYPE)(260,265)
+ PsiElement(IDENTIFIER)('Class')(260,265)
+ PsiElement(NEWLINE)('\n')(265,266)
+ PsiElement(INDENT)(' ')(266,270)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(270,277)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(270,277)
+ UnpickClassNameImpl(CLASS_NAME)(270,273)
+ PsiElement(IDENTIFIER)('Foo')(270,273)
+ PsiElement(.)('.')(273,274)
+ UnpickFieldNameImpl(FIELD_NAME)(274,277)
+ PsiElement(IDENTIFIER)('bar')(274,277)
+ PsiElement(NEWLINE)('\n')(277,278)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(278,303)
+ PsiElement(group)('group')(278,283)
+ PsiWhiteSpace(' ')(283,284)
+ UnpickDataTypeImpl(DATA_TYPE)(284,289)
+ PsiElement(IDENTIFIER)('Class')(284,289)
+ PsiWhiteSpace(' ')(289,290)
+ UnpickGroupNameImpl(GROUP_NAME)(290,291)
+ PsiElement(IDENTIFIER)('g')(290,291)
+ PsiElement(NEWLINE)('\n')(291,292)
+ PsiElement(INDENT)(' ')(292,296)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(296,303)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(296,303)
+ UnpickClassNameImpl(CLASS_NAME)(296,299)
+ PsiElement(IDENTIFIER)('Foo')(296,299)
+ PsiElement(.)('.')(299,300)
+ UnpickFieldNameImpl(FIELD_NAME)(300,303)
+ PsiElement(IDENTIFIER)('bar')(300,303)
+ PsiElement(NEWLINE)('\n')(303,304)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(304,332)
+ PsiElement(group)('group')(304,309)
+ PsiWhiteSpace(' ')(309,310)
+ UnpickDataTypeImpl(DATA_TYPE)(310,313)
+ PsiElement(IDENTIFIER)('int')(310,313)
+ PsiWhiteSpace(' ')(313,314)
+ UnpickGroupNameImpl(GROUP_NAME)(314,315)
+ PsiElement(IDENTIFIER)('g')(314,315)
+ PsiElement(NEWLINE)('\n')(315,316)
+ PsiElement(INDENT)(' ')(316,320)
+ UnpickFlagsAttributeImpl(FLAGS_ATTRIBUTE)(320,326)
+ PsiElement(@)('@')(320,321)
+ PsiElement(KEYWORD)('flags')(321,326)
+ PsiElement(NEWLINE)('\n')(326,327)
+ PsiElement(INDENT)(' ')(327,331)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(331,332)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(331,332)
+ PsiElement(INTEGER)('0')(331,332)
+ PsiElement(NEWLINE)('\n')(332,333)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(333,362)
+ PsiElement(group)('group')(333,338)
+ PsiWhiteSpace(' ')(338,339)
+ UnpickDataTypeImpl(DATA_TYPE)(339,343)
+ PsiElement(IDENTIFIER)('long')(339,343)
+ PsiWhiteSpace(' ')(343,344)
+ UnpickGroupNameImpl(GROUP_NAME)(344,345)
+ PsiElement(IDENTIFIER)('g')(344,345)
+ PsiElement(NEWLINE)('\n')(345,346)
+ PsiElement(INDENT)(' ')(346,350)
+ UnpickFlagsAttributeImpl(FLAGS_ATTRIBUTE)(350,356)
+ PsiElement(@)('@')(350,351)
+ PsiElement(KEYWORD)('flags')(351,356)
+ PsiElement(NEWLINE)('\n')(356,357)
+ PsiElement(INDENT)(' ')(357,361)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(361,362)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(361,362)
+ PsiElement(INTEGER)('0')(361,362)
+ PsiElement(NEWLINE)('\n')(362,363)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(363,394)
+ PsiElement(group)('group')(363,368)
+ PsiWhiteSpace(' ')(368,369)
+ UnpickDataTypeImpl(DATA_TYPE)(369,372)
+ PsiElement(IDENTIFIER)('int')(369,372)
+ PsiWhiteSpace(' ')(372,373)
+ UnpickGroupNameImpl(GROUP_NAME)(373,374)
+ PsiElement(IDENTIFIER)('a')(373,374)
+ PsiElement(NEWLINE)('\n')(374,375)
+ PsiElement(INDENT)(' ')(375,379)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(379,394)
+ PsiElement(@)('@')(379,380)
+ PsiElement(KEYWORD)('format')(380,386)
+ PsiWhiteSpace(' ')(386,387)
+ UnpickFormatNameImpl(FORMAT_NAME)(387,394)
+ PsiElement(IDENTIFIER)('decimal')(387,394)
+ PsiElement(NEWLINE)('\n')(394,395)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(395,423)
+ PsiElement(group)('group')(395,400)
+ PsiWhiteSpace(' ')(400,401)
+ UnpickDataTypeImpl(DATA_TYPE)(401,405)
+ PsiElement(IDENTIFIER)('long')(401,405)
+ PsiWhiteSpace(' ')(405,406)
+ UnpickGroupNameImpl(GROUP_NAME)(406,407)
+ PsiElement(IDENTIFIER)('b')(406,407)
+ PsiElement(NEWLINE)('\n')(407,408)
+ PsiElement(INDENT)(' ')(408,412)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(412,423)
+ PsiElement(@)('@')(412,413)
+ PsiElement(KEYWORD)('format')(413,419)
+ PsiWhiteSpace(' ')(419,420)
+ UnpickFormatNameImpl(FORMAT_NAME)(420,423)
+ PsiElement(IDENTIFIER)('hex')(420,423)
+ PsiElement(NEWLINE)('\n')(423,424)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(424,454)
+ PsiElement(group)('group')(424,429)
+ PsiWhiteSpace(' ')(429,430)
+ UnpickDataTypeImpl(DATA_TYPE)(430,433)
+ PsiElement(IDENTIFIER)('int')(430,433)
+ PsiWhiteSpace(' ')(433,434)
+ UnpickGroupNameImpl(GROUP_NAME)(434,435)
+ PsiElement(IDENTIFIER)('c')(434,435)
+ PsiElement(NEWLINE)('\n')(435,436)
+ PsiElement(INDENT)(' ')(436,440)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(440,454)
+ PsiElement(@)('@')(440,441)
+ PsiElement(KEYWORD)('format')(441,447)
+ PsiWhiteSpace(' ')(447,448)
+ UnpickFormatNameImpl(FORMAT_NAME)(448,454)
+ PsiElement(IDENTIFIER)('binary')(448,454)
+ PsiElement(NEWLINE)('\n')(454,455)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(455,485)
+ PsiElement(group)('group')(455,460)
+ PsiWhiteSpace(' ')(460,461)
+ UnpickDataTypeImpl(DATA_TYPE)(461,465)
+ PsiElement(IDENTIFIER)('long')(461,465)
+ PsiWhiteSpace(' ')(465,466)
+ UnpickGroupNameImpl(GROUP_NAME)(466,467)
+ PsiElement(IDENTIFIER)('d')(466,467)
+ PsiElement(NEWLINE)('\n')(467,468)
+ PsiElement(INDENT)(' ')(468,472)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(472,485)
+ PsiElement(@)('@')(472,473)
+ PsiElement(KEYWORD)('format')(473,479)
+ PsiWhiteSpace(' ')(479,480)
+ UnpickFormatNameImpl(FORMAT_NAME)(480,485)
+ PsiElement(IDENTIFIER)('octal')(480,485)
+ PsiElement(NEWLINE)('\n')(485,486)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(486,514)
+ PsiElement(group)('group')(486,491)
+ PsiWhiteSpace(' ')(491,492)
+ UnpickDataTypeImpl(DATA_TYPE)(492,495)
+ PsiElement(IDENTIFIER)('int')(492,495)
+ PsiWhiteSpace(' ')(495,496)
+ UnpickGroupNameImpl(GROUP_NAME)(496,497)
+ PsiElement(IDENTIFIER)('e')(496,497)
+ PsiElement(NEWLINE)('\n')(497,498)
+ PsiElement(INDENT)(' ')(498,502)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(502,514)
+ PsiElement(@)('@')(502,503)
+ PsiElement(KEYWORD)('format')(503,509)
+ PsiWhiteSpace(' ')(509,510)
+ UnpickFormatNameImpl(FORMAT_NAME)(510,514)
+ PsiElement(IDENTIFIER)('char')(510,514)
+ PsiElement(NEWLINE)('\n')(514,515)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(515,553)
+ PsiElement(group)('group')(515,520)
+ PsiWhiteSpace(' ')(520,521)
+ UnpickDataTypeImpl(DATA_TYPE)(521,525)
+ PsiElement(IDENTIFIER)('long')(521,525)
+ PsiWhiteSpace(' ')(525,526)
+ UnpickGroupNameImpl(GROUP_NAME)(526,527)
+ PsiElement(IDENTIFIER)('f')(526,527)
+ PsiElement(NEWLINE)('\n')(527,528)
+ PsiElement(INDENT)(' ')(528,532)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(532,547)
+ PsiElement(@)('@')(532,533)
+ PsiElement(KEYWORD)('format')(533,539)
+ PsiWhiteSpace(' ')(539,540)
+ UnpickFormatNameImpl(FORMAT_NAME)(540,547)
+ PsiElement(IDENTIFIER)('decimal')(540,547)
+ PsiElement(NEWLINE)('\n')(547,548)
+ PsiElement(INDENT)(' ')(548,552)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(552,553)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(552,553)
+ PsiElement(INTEGER)('0')(552,553)
+ PsiElement(NEWLINE)('\n')(553,554)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(554,588)
+ PsiElement(group)('group')(554,559)
+ PsiWhiteSpace(' ')(559,560)
+ UnpickDataTypeImpl(DATA_TYPE)(560,565)
+ PsiElement(IDENTIFIER)('float')(560,565)
+ PsiWhiteSpace(' ')(565,566)
+ UnpickGroupNameImpl(GROUP_NAME)(566,568)
+ PsiElement(IDENTIFIER)('af')(566,568)
+ PsiElement(NEWLINE)('\n')(568,569)
+ PsiElement(INDENT)(' ')(569,573)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(573,588)
+ PsiElement(@)('@')(573,574)
+ PsiElement(KEYWORD)('format')(574,580)
+ PsiWhiteSpace(' ')(580,581)
+ UnpickFormatNameImpl(FORMAT_NAME)(581,588)
+ PsiElement(IDENTIFIER)('decimal')(581,588)
+ PsiElement(NEWLINE)('\n')(588,589)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(589,619)
+ PsiElement(group)('group')(589,594)
+ PsiWhiteSpace(' ')(594,595)
+ UnpickDataTypeImpl(DATA_TYPE)(595,600)
+ PsiElement(IDENTIFIER)('float')(595,600)
+ PsiWhiteSpace(' ')(600,601)
+ UnpickGroupNameImpl(GROUP_NAME)(601,603)
+ PsiElement(IDENTIFIER)('bf')(601,603)
+ PsiElement(NEWLINE)('\n')(603,604)
+ PsiElement(INDENT)(' ')(604,608)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(608,619)
+ PsiElement(@)('@')(608,609)
+ PsiElement(KEYWORD)('format')(609,615)
+ PsiWhiteSpace(' ')(615,616)
+ UnpickFormatNameImpl(FORMAT_NAME)(616,619)
+ PsiElement(IDENTIFIER)('hex')(616,619)
+ PsiElement(NEWLINE)('\n')(619,620)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(620,655)
+ PsiElement(group)('group')(620,625)
+ PsiWhiteSpace(' ')(625,626)
+ UnpickDataTypeImpl(DATA_TYPE)(626,632)
+ PsiElement(IDENTIFIER)('double')(626,632)
+ PsiWhiteSpace(' ')(632,633)
+ UnpickGroupNameImpl(GROUP_NAME)(633,635)
+ PsiElement(IDENTIFIER)('cf')(633,635)
+ PsiElement(NEWLINE)('\n')(635,636)
+ PsiElement(INDENT)(' ')(636,640)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(640,655)
+ PsiElement(@)('@')(640,641)
+ PsiElement(KEYWORD)('format')(641,647)
+ PsiWhiteSpace(' ')(647,648)
+ UnpickFormatNameImpl(FORMAT_NAME)(648,655)
+ PsiElement(IDENTIFIER)('decimal')(648,655)
+ PsiElement(NEWLINE)('\n')(655,656)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(656,687)
+ PsiElement(group)('group')(656,661)
+ PsiWhiteSpace(' ')(661,662)
+ UnpickDataTypeImpl(DATA_TYPE)(662,668)
+ PsiElement(IDENTIFIER)('double')(662,668)
+ PsiWhiteSpace(' ')(668,669)
+ UnpickGroupNameImpl(GROUP_NAME)(669,671)
+ PsiElement(IDENTIFIER)('df')(669,671)
+ PsiElement(NEWLINE)('\n')(671,672)
+ PsiElement(INDENT)(' ')(672,676)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(676,687)
+ PsiElement(@)('@')(676,677)
+ PsiElement(KEYWORD)('format')(677,683)
+ PsiWhiteSpace(' ')(683,684)
+ UnpickFormatNameImpl(FORMAT_NAME)(684,687)
+ PsiElement(IDENTIFIER)('hex')(684,687)
+ PsiElement(NEWLINE)('\n')(687,688)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(688,730)
+ PsiElement(group)('group')(688,693)
+ PsiWhiteSpace(' ')(693,694)
+ UnpickDataTypeImpl(DATA_TYPE)(694,697)
+ PsiElement(IDENTIFIER)('int')(694,697)
+ PsiElement(NEWLINE)('\n')(697,698)
+ PsiElement(INDENT)(' ')(698,702)
+ UnpickScopeAttributeImpl(SCOPE_ATTRIBUTE)(702,724)
+ PsiElement(@)('@')(702,703)
+ PsiElement(KEYWORD)('scope')(703,708)
+ PsiWhiteSpace(' ')(708,709)
+ UnpickPackageScopeImpl(PACKAGE_SCOPE)(709,724)
+ PsiElement(KEYWORD)('package')(709,716)
+ PsiWhiteSpace(' ')(716,717)
+ UnpickPackageNameImpl(PACKAGE_NAME)(717,724)
+ PsiElement(IDENTIFIER)('foo')(717,720)
+ PsiElement(.)('.')(720,721)
+ PsiElement(IDENTIFIER)('bar')(721,724)
+ PsiElement(NEWLINE)('\n')(724,725)
+ PsiElement(INDENT)(' ')(725,729)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(729,730)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(729,730)
+ PsiElement(INTEGER)('0')(729,730)
+ PsiElement(NEWLINE)('\n')(730,731)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(731,771)
+ PsiElement(group)('group')(731,736)
+ PsiWhiteSpace(' ')(736,737)
+ UnpickDataTypeImpl(DATA_TYPE)(737,740)
+ PsiElement(IDENTIFIER)('int')(737,740)
+ PsiElement(NEWLINE)('\n')(740,741)
+ PsiElement(INDENT)(' ')(741,745)
+ UnpickScopeAttributeImpl(SCOPE_ATTRIBUTE)(745,765)
+ PsiElement(@)('@')(745,746)
+ PsiElement(KEYWORD)('scope')(746,751)
+ PsiWhiteSpace(' ')(751,752)
+ UnpickClassScopeImpl(CLASS_SCOPE)(752,765)
+ PsiElement(KEYWORD)('class')(752,757)
+ PsiWhiteSpace(' ')(757,758)
+ UnpickClassNameImpl(CLASS_NAME)(758,765)
+ PsiElement(IDENTIFIER)('foo')(758,761)
+ PsiElement(.)('.')(761,762)
+ PsiElement(IDENTIFIER)('Bar')(762,765)
+ PsiElement(NEWLINE)('\n')(765,766)
+ PsiElement(INDENT)(' ')(766,770)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(770,771)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(770,771)
+ PsiElement(INTEGER)('0')(770,771)
+ PsiElement(NEWLINE)('\n')(771,772)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(772,821)
+ PsiElement(group)('group')(772,777)
+ PsiWhiteSpace(' ')(777,778)
+ UnpickDataTypeImpl(DATA_TYPE)(778,781)
+ PsiElement(IDENTIFIER)('int')(778,781)
+ PsiElement(NEWLINE)('\n')(781,782)
+ PsiElement(INDENT)(' ')(782,786)
+ UnpickScopeAttributeImpl(SCOPE_ATTRIBUTE)(786,815)
+ PsiElement(@)('@')(786,787)
+ PsiElement(KEYWORD)('scope')(787,792)
+ PsiWhiteSpace(' ')(792,793)
+ UnpickMethodScopeImpl(METHOD_SCOPE)(793,815)
+ PsiElement(KEYWORD)('method')(793,799)
+ PsiWhiteSpace(' ')(799,800)
+ UnpickClassNameImpl(CLASS_NAME)(800,807)
+ PsiElement(IDENTIFIER)('foo')(800,803)
+ PsiElement(.)('.')(803,804)
+ PsiElement(IDENTIFIER)('Bar')(804,807)
+ PsiWhiteSpace(' ')(807,808)
+ UnpickMethodNameImpl(METHOD_NAME)(808,811)
+ PsiElement(IDENTIFIER)('baz')(808,811)
+ PsiWhiteSpace(' ')(811,812)
+ PsiElement(METHOD_DESCRIPTOR)('()V')(812,815)
+ PsiElement(NEWLINE)('\n')(815,816)
+ PsiElement(INDENT)(' ')(816,820)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(820,821)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(820,821)
+ PsiElement(INTEGER)('0')(820,821)
+ PsiElement(NEWLINE)('\n')(821,822)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(822,886)
+ PsiElement(group)('group')(822,827)
+ PsiWhiteSpace(' ')(827,828)
+ UnpickDataTypeImpl(DATA_TYPE)(828,831)
+ PsiElement(IDENTIFIER)('int')(828,831)
+ PsiElement(NEWLINE)('\n')(831,832)
+ PsiElement(INDENT)(' ')(832,836)
+ UnpickScopeAttributeImpl(SCOPE_ATTRIBUTE)(836,858)
+ PsiElement(@)('@')(836,837)
+ PsiElement(KEYWORD)('scope')(837,842)
+ PsiWhiteSpace(' ')(842,843)
+ UnpickPackageScopeImpl(PACKAGE_SCOPE)(843,858)
+ PsiElement(KEYWORD)('package')(843,850)
+ PsiWhiteSpace(' ')(850,851)
+ UnpickPackageNameImpl(PACKAGE_NAME)(851,858)
+ PsiElement(IDENTIFIER)('foo')(851,854)
+ PsiElement(.)('.')(854,855)
+ PsiElement(IDENTIFIER)('bar')(855,858)
+ PsiElement(NEWLINE)('\n')(858,859)
+ PsiElement(INDENT)(' ')(859,863)
+ UnpickScopeAttributeImpl(SCOPE_ATTRIBUTE)(863,886)
+ PsiElement(@)('@')(863,864)
+ PsiElement(KEYWORD)('scope')(864,869)
+ PsiWhiteSpace(' ')(869,870)
+ UnpickPackageScopeImpl(PACKAGE_SCOPE)(870,886)
+ PsiElement(KEYWORD)('package')(870,877)
+ PsiWhiteSpace(' ')(877,878)
+ UnpickPackageNameImpl(PACKAGE_NAME)(878,886)
+ PsiElement(IDENTIFIER)('baz')(878,881)
+ PsiElement(.)('.')(881,882)
+ PsiElement(IDENTIFIER)('quux')(882,886)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/group_definition.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/group_definition.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/group_definition.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,70 @@
+unpick v3
+group int
+group int
+ 0
+group int g
+ @strict
+ 0
+group long
+ 0
+group long g
+ 0
+group float
+ 0
+ 1.0
+group float g
+ 0
+ 1.0
+group double
+ 0
+ 1.0
+group double g
+ 0
+ 1.0
+group String
+ ""
+group String g
+ ""
+group Class
+ Foo.bar
+group Class g
+ Foo.bar
+group int g
+ @flags
+ 0
+group long g
+ @flags
+ 0
+group int a
+ @format decimal
+group long b
+ @format hex
+group int c
+ @format binary
+group long d
+ @format octal
+group int e
+ @format char
+group long f
+ @format decimal
+ 0
+group float af
+ @format decimal
+group float bf
+ @format hex
+group double cf
+ @format decimal
+group double df
+ @format hex
+group int
+ @scope package foo.bar
+ 0
+group int
+ @scope class foo.Bar
+ 0
+group int
+ @scope method foo.Bar baz ()V
+ 0
+group int
+ @scope package foo.bar
+ @scope package baz.quux
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/minimal_spaces.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/minimal_spaces.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/minimal_spaces.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,72 @@
+Unpick File(0,128)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v3')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ UnpickTargetFieldImpl(TARGET_FIELD)(10,54)
+ PsiElement(target_field)('target_field')(10,22)
+ PsiWhiteSpace(' ')(22,23)
+ UnpickClassNameImpl(CLASS_NAME)(23,30)
+ PsiElement(IDENTIFIER)('foo')(23,26)
+ PsiElement(.)('.')(26,27)
+ PsiElement(IDENTIFIER)('Bar')(27,30)
+ PsiWhiteSpace(' ')(30,31)
+ UnpickFieldNameImpl(FIELD_NAME)(31,34)
+ PsiElement(IDENTIFIER)('baz')(31,34)
+ PsiWhiteSpace(' ')(34,35)
+ PsiElement(FIELD_DESCRIPTOR)('Ljava/lang/String;')(35,53)
+ UnpickGroupRefImpl(GROUP_REF)(53,54)
+ PsiElement(IDENTIFIER)('g')(53,54)
+ PsiElement(NEWLINE)('\n')(54,55)
+ UnpickTargetMethodImpl(TARGET_METHOD)(55,83)
+ PsiElement(target_method)('target_method')(55,68)
+ PsiWhiteSpace(' ')(68,69)
+ UnpickClassNameImpl(CLASS_NAME)(69,76)
+ PsiElement(IDENTIFIER)('foo')(69,72)
+ PsiElement(.)('.')(72,73)
+ PsiElement(IDENTIFIER)('Bar')(73,76)
+ PsiWhiteSpace(' ')(76,77)
+ UnpickMethodNameImpl(METHOD_NAME)(77,80)
+ PsiElement(IDENTIFIER)('baz')(77,80)
+ PsiElement(METHOD_DESCRIPTOR)('()V')(80,83)
+ PsiElement(NEWLINE)('\n')(83,84)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(84,128)
+ PsiElement(group)('group')(84,89)
+ PsiWhiteSpace(' ')(89,90)
+ UnpickDataTypeImpl(DATA_TYPE)(90,96)
+ PsiElement(IDENTIFIER)('String')(90,96)
+ PsiElement(NEWLINE)('\n')(96,97)
+ PsiElement(INDENT)(' ')(97,98)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(98,128)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(98,128)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(98,100)
+ PsiElement(STRING)('""')(98,100)
+ PsiElement(+)('+')(100,101)
+ UnpickMultiplicativeExpressionImpl(MULTIPLICATIVE_EXPRESSION)(101,128)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(101,102)
+ PsiElement(INTEGER)('1')(101,102)
+ PsiElement(/)('/')(102,103)
+ UnpickParenExpressionImpl(PAREN_EXPRESSION)(103,128)
+ PsiElement(()('(')(103,104)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(104,127)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(104,105)
+ PsiElement(INTEGER)('2')(104,105)
+ PsiElement(+)('+')(105,106)
+ UnpickCastExpressionImpl(CAST_EXPRESSION)(106,127)
+ PsiElement(()('(')(106,107)
+ UnpickDataTypeImpl(DATA_TYPE)(107,110)
+ PsiElement(IDENTIFIER)('int')(107,110)
+ PsiElement())(')')(110,111)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(111,127)
+ UnpickClassNameImpl(CLASS_NAME)(111,118)
+ PsiElement(IDENTIFIER)('foo')(111,114)
+ PsiElement(.)('.')(114,115)
+ PsiElement(IDENTIFIER)('Bar')(115,118)
+ PsiElement(.)('.')(118,119)
+ UnpickFieldNameImpl(FIELD_NAME)(119,122)
+ PsiElement(IDENTIFIER)('baz')(119,122)
+ PsiElement(:)(':')(122,123)
+ UnpickDataTypeImpl(DATA_TYPE)(123,127)
+ PsiElement(IDENTIFIER)('byte')(123,127)
+ PsiElement())(')')(127,128)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/minimal_spaces.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/minimal_spaces.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/minimal_spaces.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,5 @@
+unpick v3
+target_field foo.Bar baz Ljava/lang/String;g
+target_method foo.Bar baz()V
+group String
+ ""+1/(2+(int)foo.Bar.baz:byte)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/recovery.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/recovery.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/recovery.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,110 @@
+Unpick File(0,192)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v4')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(10,70)
+ PsiElement(group)('group')(10,15)
+ PsiWhiteSpace(' ')(15,16)
+ UnpickDataTypeImpl(DATA_TYPE)(16,19)
+ PsiElement(IDENTIFIER)('int')(16,19)
+ PsiWhiteSpace(' ')(19,20)
+ UnpickGroupNameImpl(GROUP_NAME)(20,21)
+ PsiElement(IDENTIFIER)('g')(20,21)
+ PsiWhiteSpace(' ')(21,22)
+ PsiErrorElement:'extra' unexpected(22,27)
+ PsiElement(IDENTIFIER)('extra')(22,27)
+ PsiWhiteSpace(' ')(27,28)
+ PsiElement(IDENTIFIER)('tokens')(28,34)
+ PsiElement(NEWLINE)('\n')(34,35)
+ PsiElement(INDENT)(' ')(35,39)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(39,42)
+ UnpickAdditiveExpressionImpl(ADDITIVE_EXPRESSION)(39,42)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(39,40)
+ PsiElement(INTEGER)('1')(39,40)
+ PsiWhiteSpace(' ')(40,41)
+ PsiElement(+)('+')(41,42)
+ PsiErrorElement: expected(42,42)
+
+ PsiElement(NEWLINE)('\n')(42,43)
+ PsiElement(INDENT)(' ')(43,47)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(47,58)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(47,58)
+ UnpickClassNameImpl(CLASS_NAME)(47,54)
+ PsiElement(IDENTIFIER)('foo')(47,50)
+ PsiElement(.)('.')(50,51)
+ PsiElement(IDENTIFIER)('Bar')(51,54)
+ PsiElement(.)('.')(54,55)
+ UnpickFieldNameImpl(FIELD_NAME)(55,58)
+ PsiElement(IDENTIFIER)('BAZ')(55,58)
+ PsiElement(NEWLINE)('\n')(58,59)
+ PsiElement(INDENT)(' ')(59,63)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(63,70)
+ PsiElement(@)('@')(63,64)
+ PsiElement(KEYWORD)('format')(64,70)
+ PsiErrorElement:IDENTIFIER expected(70,70)
+
+ PsiElement(NEWLINE)('\n')(70,71)
+ UnpickTargetMethodImpl(TARGET_METHOD)(71,153)
+ PsiElement(target_method)('target_method')(71,84)
+ PsiWhiteSpace(' ')(84,85)
+ UnpickClassNameImpl(CLASS_NAME)(85,92)
+ PsiElement(IDENTIFIER)('foo')(85,88)
+ PsiElement(.)('.')(88,89)
+ PsiElement(IDENTIFIER)('Bar')(89,92)
+ PsiErrorElement:'.' or expected(92,92)
+
+ PsiElement(NEWLINE)('\n')(92,93)
+ PsiElement(INDENT)(' ')(93,97)
+ UnpickTargetMethodParamImpl(TARGET_METHOD_PARAM)(97,106)
+ PsiElement(KEYWORD)('param')(97,102)
+ PsiWhiteSpace(' ')(102,103)
+ PsiElement(INTEGER)('0')(103,104)
+ PsiWhiteSpace(' ')(104,105)
+ UnpickGroupRefImpl(GROUP_REF)(105,106)
+ PsiElement(IDENTIFIER)('a')(105,106)
+ PsiElement(NEWLINE)('\n')(106,107)
+ PsiElement(INDENT)(' ')(107,111)
+ PsiErrorElement:'bogus' unexpected(111,116)
+ PsiElement(IDENTIFIER)('bogus')(111,116)
+ PsiElement(NEWLINE)('\n')(116,117)
+ PsiElement(INDENT)(' ')(117,121)
+ UnpickTargetMethodReturnImpl(TARGET_METHOD_RETURN)(121,129)
+ PsiElement(KEYWORD)('return')(121,127)
+ PsiWhiteSpace(' ')(127,128)
+ UnpickGroupRefImpl(GROUP_REF)(128,129)
+ PsiElement(IDENTIFIER)('b')(128,129)
+ PsiElement(NEWLINE)('\n')(129,130)
+ PsiElement(INDENT)(' ')(130,134)
+ PsiErrorElement:'stray' unexpected(134,139)
+ PsiElement(IDENTIFIER)('stray')(134,139)
+ PsiWhiteSpace(' ')(139,140)
+ PsiElement(IDENTIFIER)('indented')(140,148)
+ PsiWhiteSpace(' ')(148,149)
+ PsiElement(IDENTIFIER)('line')(149,153)
+ PsiElement(NEWLINE)('\n')(153,154)
+ UnpickTargetFieldImpl(TARGET_FIELD)(154,180)
+ PsiElement(target_field)('target_field')(154,166)
+ PsiWhiteSpace(' ')(166,167)
+ UnpickClassNameImpl(CLASS_NAME)(167,174)
+ PsiElement(IDENTIFIER)('foo')(167,170)
+ PsiElement(.)('.')(170,171)
+ PsiElement(IDENTIFIER)('Bar')(171,174)
+ PsiWhiteSpace(' ')(174,175)
+ UnpickFieldNameImpl(FIELD_NAME)(175,178)
+ PsiElement(IDENTIFIER)('baz')(175,178)
+ PsiWhiteSpace(' ')(178,179)
+ PsiElement(FIELD_DESCRIPTOR)('I')(179,180)
+ PsiErrorElement:IDENTIFIER expected(180,180)
+
+ PsiElement(NEWLINE)('\n')(180,181)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(181,192)
+ PsiElement(group)('group')(181,186)
+ PsiErrorElement:IDENTIFIER expected(186,186)
+
+ PsiElement(NEWLINE)('\n')(186,187)
+ PsiElement(INDENT)(' ')(187,191)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(191,192)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(191,192)
+ PsiElement(INTEGER)('1')(191,192)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/recovery.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/recovery.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/recovery.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,13 @@
+unpick v4
+group int g extra tokens
+ 1 +
+ foo.Bar.BAZ
+ @format
+target_method foo.Bar
+ param 0 a
+ bogus
+ return b
+ stray indented line
+target_field foo.Bar baz I
+group
+ 1
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/spec.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/spec.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/spec.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,366 @@
+Unpick File(0,1560)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v4')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ PsiWhiteSpace('\n')(10,11)
+ PsiComment(COMMENT)('# apply to floats in the default group globally')(11,58)
+ PsiWhiteSpace('\n')(58,59)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(59,179)
+ PsiElement(group)('group')(59,64)
+ PsiWhiteSpace(' ')(64,65)
+ UnpickDataTypeImpl(DATA_TYPE)(65,70)
+ PsiElement(IDENTIFIER)('float')(65,70)
+ PsiElement(NEWLINE)('\n')(70,71)
+ PsiElement(INDENT)(' ')(71,75)
+ UnpickStrictAttributeImpl(STRICT_ATTRIBUTE)(75,82)
+ PsiElement(@)('@')(75,76)
+ PsiElement(KEYWORD)('strict')(76,82)
+ PsiWhiteSpace(' ')(82,83)
+ PsiComment(COMMENT)('# don't apply to double literals')(83,115)
+ PsiElement(NEWLINE)('\n')(115,116)
+ PsiElement(INDENT)(' ')(116,120)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(120,145)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(120,145)
+ UnpickClassNameImpl(CLASS_NAME)(120,142)
+ PsiElement(IDENTIFIER)('net')(120,123)
+ PsiElement(.)('.')(123,124)
+ PsiElement(IDENTIFIER)('minecraft')(124,133)
+ PsiElement(.)('.')(133,134)
+ PsiElement(IDENTIFIER)('util')(134,138)
+ PsiElement(.)('.')(138,139)
+ PsiElement(IDENTIFIER)('Mth')(139,142)
+ PsiElement(.)('.')(142,143)
+ UnpickFieldNameImpl(FIELD_NAME)(143,145)
+ PsiElement(IDENTIFIER)('PI')(143,145)
+ PsiElement(NEWLINE)('\n')(145,146)
+ PsiElement(INDENT)(' ')(146,150)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(150,179)
+ UnpickMultiplicativeExpressionImpl(MULTIPLICATIVE_EXPRESSION)(150,179)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(150,175)
+ UnpickClassNameImpl(CLASS_NAME)(150,172)
+ PsiElement(IDENTIFIER)('net')(150,153)
+ PsiElement(.)('.')(153,154)
+ PsiElement(IDENTIFIER)('minecraft')(154,163)
+ PsiElement(.)('.')(163,164)
+ PsiElement(IDENTIFIER)('util')(164,168)
+ PsiElement(.)('.')(168,169)
+ PsiElement(IDENTIFIER)('Mth')(169,172)
+ PsiElement(.)('.')(172,173)
+ UnpickFieldNameImpl(FIELD_NAME)(173,175)
+ PsiElement(IDENTIFIER)('PI')(173,175)
+ PsiWhiteSpace(' ')(175,176)
+ PsiElement(/)('/')(176,177)
+ PsiWhiteSpace(' ')(177,178)
+ UnpickLiteralExpressionImpl(LITERAL_EXPRESSION)(178,179)
+ PsiElement(INTEGER)('3')(178,179)
+ PsiElement(NEWLINE)('\n')(179,180)
+ PsiWhiteSpace('\n')(180,181)
+ PsiComment(COMMENT)('# apply to strings in the default group globally')(181,229)
+ PsiWhiteSpace('\n')(229,230)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(230,291)
+ PsiElement(group)('group')(230,235)
+ PsiWhiteSpace(' ')(235,236)
+ UnpickDataTypeImpl(DATA_TYPE)(236,242)
+ PsiElement(IDENTIFIER)('String')(236,242)
+ PsiElement(NEWLINE)('\n')(242,243)
+ PsiElement(INDENT)(' ')(243,247)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(247,291)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(247,291)
+ UnpickClassNameImpl(CLASS_NAME)(247,276)
+ PsiElement(IDENTIFIER)('net')(247,250)
+ PsiElement(.)('.')(250,251)
+ PsiElement(IDENTIFIER)('minecraft')(251,260)
+ PsiElement(.)('.')(260,261)
+ PsiElement(IDENTIFIER)('SharedConstants')(261,276)
+ PsiElement(.)('.')(276,277)
+ UnpickFieldNameImpl(FIELD_NAME)(277,291)
+ PsiElement(IDENTIFIER)('VERSION_STRING')(277,291)
+ PsiElement(NEWLINE)('\n')(291,292)
+ PsiWhiteSpace('\n')(292,293)
+ PsiComment(COMMENT)('# an example of a wildcard field')(293,325)
+ PsiWhiteSpace('\n')(325,326)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(326,396)
+ PsiElement(group)('group')(326,331)
+ PsiWhiteSpace(' ')(331,332)
+ UnpickDataTypeImpl(DATA_TYPE)(332,335)
+ PsiElement(IDENTIFIER)('int')(332,335)
+ PsiWhiteSpace(' ')(335,336)
+ UnpickGroupNameImpl(GROUP_NAME)(336,347)
+ PsiElement(IDENTIFIER)('LevelEvents')(336,347)
+ PsiElement(NEWLINE)('\n')(347,348)
+ PsiElement(INDENT)(' ')(348,352)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(352,396)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(352,396)
+ UnpickClassNameImpl(CLASS_NAME)(352,394)
+ PsiElement(IDENTIFIER)('net')(352,355)
+ PsiElement(.)('.')(355,356)
+ PsiElement(IDENTIFIER)('minecraft')(356,365)
+ PsiElement(.)('.')(365,366)
+ PsiElement(IDENTIFIER)('world')(366,371)
+ PsiElement(.)('.')(371,372)
+ PsiElement(IDENTIFIER)('level')(372,377)
+ PsiElement(.)('.')(377,378)
+ PsiElement(IDENTIFIER)('block')(378,383)
+ PsiElement(.)('.')(383,384)
+ PsiElement(IDENTIFIER)('LevelEvent')(384,394)
+ PsiElement(.)('.')(394,395)
+ PsiElement(*)('*')(395,396)
+ PsiElement(NEWLINE)('\n')(396,397)
+ PsiWhiteSpace('\n')(397,398)
+ PsiComment(COMMENT)('# apply to ints in the default group within the scope of ClientboundCustomPayloadPacket')(398,485)
+ PsiWhiteSpace('\n')(485,486)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(486,671)
+ PsiElement(group)('group')(486,491)
+ PsiWhiteSpace(' ')(491,492)
+ UnpickDataTypeImpl(DATA_TYPE)(492,495)
+ PsiElement(IDENTIFIER)('int')(492,495)
+ PsiElement(NEWLINE)('\n')(495,496)
+ PsiElement(INDENT)(' ')(496,500)
+ UnpickScopeAttributeImpl(SCOPE_ATTRIBUTE)(500,581)
+ PsiElement(@)('@')(500,501)
+ PsiElement(KEYWORD)('scope')(501,506)
+ PsiWhiteSpace(' ')(506,507)
+ UnpickClassScopeImpl(CLASS_SCOPE)(507,581)
+ PsiElement(KEYWORD)('class')(507,512)
+ PsiWhiteSpace(' ')(512,513)
+ UnpickClassNameImpl(CLASS_NAME)(513,581)
+ PsiElement(IDENTIFIER)('net')(513,516)
+ PsiElement(.)('.')(516,517)
+ PsiElement(IDENTIFIER)('minecraft')(517,526)
+ PsiElement(.)('.')(526,527)
+ PsiElement(IDENTIFIER)('network')(527,534)
+ PsiElement(.)('.')(534,535)
+ PsiElement(IDENTIFIER)('protocol')(535,543)
+ PsiElement(.)('.')(543,544)
+ PsiElement(IDENTIFIER)('common')(544,550)
+ PsiElement(.)('.')(550,551)
+ PsiElement(IDENTIFIER)('ClientboundCustomPayloadPacket')(551,581)
+ PsiElement(NEWLINE)('\n')(581,582)
+ PsiElement(INDENT)(' ')(582,586)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(586,671)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(586,671)
+ UnpickClassNameImpl(CLASS_NAME)(586,654)
+ PsiElement(IDENTIFIER)('net')(586,589)
+ PsiElement(.)('.')(589,590)
+ PsiElement(IDENTIFIER)('minecraft')(590,599)
+ PsiElement(.)('.')(599,600)
+ PsiElement(IDENTIFIER)('network')(600,607)
+ PsiElement(.)('.')(607,608)
+ PsiElement(IDENTIFIER)('protocol')(608,616)
+ PsiElement(.)('.')(616,617)
+ PsiElement(IDENTIFIER)('common')(617,623)
+ PsiElement(.)('.')(623,624)
+ PsiElement(IDENTIFIER)('ClientboundCustomPayloadPacket')(624,654)
+ PsiElement(.)('.')(654,655)
+ UnpickFieldNameImpl(FIELD_NAME)(655,671)
+ PsiElement(IDENTIFIER)('MAX_PAYLOAD_SIZE')(655,671)
+ PsiElement(NEWLINE)('\n')(671,672)
+ PsiWhiteSpace('\n')(672,673)
+ PsiComment(COMMENT)('# apply to ints with the group "ARGBColor"')(673,715)
+ PsiWhiteSpace('\n')(715,716)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(716,874)
+ PsiElement(group)('group')(716,721)
+ PsiWhiteSpace(' ')(721,722)
+ UnpickDataTypeImpl(DATA_TYPE)(722,725)
+ PsiElement(IDENTIFIER)('int')(722,725)
+ PsiWhiteSpace(' ')(725,726)
+ UnpickGroupNameImpl(GROUP_NAME)(726,735)
+ PsiElement(IDENTIFIER)('ARGBColor')(726,735)
+ PsiElement(NEWLINE)('\n')(735,736)
+ PsiElement(INDENT)(' ')(736,740)
+ UnpickFormatAttributeImpl(FORMAT_ATTRIBUTE)(740,751)
+ PsiElement(@)('@')(740,741)
+ PsiElement(KEYWORD)('format')(741,747)
+ PsiWhiteSpace(' ')(747,748)
+ UnpickFormatNameImpl(FORMAT_NAME)(748,751)
+ PsiElement(IDENTIFIER)('hex')(748,751)
+ PsiWhiteSpace(' ')(751,752)
+ PsiComment(COMMENT)('# format unrecongized constants as hex')(752,790)
+ PsiElement(NEWLINE)('\n')(790,791)
+ PsiElement(INDENT)(' ')(791,795)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(795,832)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(795,832)
+ UnpickClassNameImpl(CLASS_NAME)(795,826)
+ PsiElement(IDENTIFIER)('net')(795,798)
+ PsiElement(.)('.')(798,799)
+ PsiElement(IDENTIFIER)('minecraft')(799,808)
+ PsiElement(.)('.')(808,809)
+ PsiElement(IDENTIFIER)('util')(809,813)
+ PsiElement(.)('.')(813,814)
+ PsiElement(IDENTIFIER)('CommonColors')(814,826)
+ PsiElement(.)('.')(826,827)
+ UnpickFieldNameImpl(FIELD_NAME)(827,832)
+ PsiElement(IDENTIFIER)('WHITE')(827,832)
+ PsiElement(NEWLINE)('\n')(832,833)
+ PsiElement(INDENT)(' ')(833,837)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(837,874)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(837,874)
+ UnpickClassNameImpl(CLASS_NAME)(837,868)
+ PsiElement(IDENTIFIER)('net')(837,840)
+ PsiElement(.)('.')(840,841)
+ PsiElement(IDENTIFIER)('minecraft')(841,850)
+ PsiElement(.)('.')(850,851)
+ PsiElement(IDENTIFIER)('util')(851,855)
+ PsiElement(.)('.')(855,856)
+ PsiElement(IDENTIFIER)('CommonColors')(856,868)
+ PsiElement(.)('.')(868,869)
+ UnpickFieldNameImpl(FIELD_NAME)(869,874)
+ PsiElement(IDENTIFIER)('BLACK')(869,874)
+ PsiElement(NEWLINE)('\n')(874,875)
+ PsiWhiteSpace('\n')(875,876)
+ PsiComment(COMMENT)('# apply the group "ARGBColor" to ints flowing into the 5th parameter of of GuiGraphics.fill')(876,967)
+ PsiWhiteSpace('\n')(967,968)
+ UnpickTargetMethodImpl(TARGET_METHOD)(968,1054)
+ PsiElement(target_method)('target_method')(968,981)
+ PsiWhiteSpace(' ')(981,982)
+ UnpickClassNameImpl(CLASS_NAME)(982,1018)
+ PsiElement(IDENTIFIER)('net')(982,985)
+ PsiElement(.)('.')(985,986)
+ PsiElement(IDENTIFIER)('minecraft')(986,995)
+ PsiElement(.)('.')(995,996)
+ PsiElement(IDENTIFIER)('client')(996,1002)
+ PsiElement(.)('.')(1002,1003)
+ PsiElement(IDENTIFIER)('gui')(1003,1006)
+ PsiElement(.)('.')(1006,1007)
+ PsiElement(IDENTIFIER)('GuiGraphics')(1007,1018)
+ PsiWhiteSpace(' ')(1018,1019)
+ UnpickMethodNameImpl(METHOD_NAME)(1019,1023)
+ PsiElement(IDENTIFIER)('fill')(1019,1023)
+ PsiWhiteSpace(' ')(1023,1024)
+ PsiElement(METHOD_DESCRIPTOR)('(IIIII)V')(1024,1032)
+ PsiElement(NEWLINE)('\n')(1032,1033)
+ PsiElement(INDENT)(' ')(1033,1037)
+ UnpickTargetMethodParamImpl(TARGET_METHOD_PARAM)(1037,1054)
+ PsiElement(KEYWORD)('param')(1037,1042)
+ PsiWhiteSpace(' ')(1042,1043)
+ PsiElement(INTEGER)('4')(1043,1044)
+ PsiWhiteSpace(' ')(1044,1045)
+ UnpickGroupRefImpl(GROUP_REF)(1045,1054)
+ PsiElement(IDENTIFIER)('ARGBColor')(1045,1054)
+ PsiElement(NEWLINE)('\n')(1054,1055)
+ PsiWhiteSpace('\n')(1055,1056)
+ PsiComment(COMMENT)('# apply the group "ARGBColor" to ints flowing from the return of ARGB.color')(1056,1131)
+ PsiWhiteSpace('\n')(1131,1132)
+ UnpickTargetMethodImpl(TARGET_METHOD)(1132,1204)
+ PsiElement(target_method)('target_method')(1132,1145)
+ PsiWhiteSpace(' ')(1145,1146)
+ UnpickClassNameImpl(CLASS_NAME)(1146,1169)
+ PsiElement(IDENTIFIER)('net')(1146,1149)
+ PsiElement(.)('.')(1149,1150)
+ PsiElement(IDENTIFIER)('minecraft')(1150,1159)
+ PsiElement(.)('.')(1159,1160)
+ PsiElement(IDENTIFIER)('util')(1160,1164)
+ PsiElement(.)('.')(1164,1165)
+ PsiElement(IDENTIFIER)('ARGB')(1165,1169)
+ PsiWhiteSpace(' ')(1169,1170)
+ UnpickMethodNameImpl(METHOD_NAME)(1170,1175)
+ PsiElement(IDENTIFIER)('color')(1170,1175)
+ PsiWhiteSpace(' ')(1175,1176)
+ PsiElement(METHOD_DESCRIPTOR)('(IIII)I')(1176,1183)
+ PsiElement(NEWLINE)('\n')(1183,1184)
+ PsiElement(INDENT)(' ')(1184,1188)
+ UnpickTargetMethodReturnImpl(TARGET_METHOD_RETURN)(1188,1204)
+ PsiElement(KEYWORD)('return')(1188,1194)
+ PsiWhiteSpace(' ')(1194,1195)
+ UnpickGroupRefImpl(GROUP_REF)(1195,1204)
+ PsiElement(IDENTIFIER)('ARGBColor')(1195,1204)
+ PsiElement(NEWLINE)('\n')(1204,1205)
+ PsiWhiteSpace('\n')(1205,1206)
+ UnpickTargetFieldImpl(TARGET_FIELD)(1206,1285)
+ PsiElement(target_field)('target_field')(1206,1218)
+ PsiWhiteSpace(' ')(1218,1219)
+ UnpickClassNameImpl(CLASS_NAME)(1219,1267)
+ PsiElement(IDENTIFIER)('net')(1219,1222)
+ PsiElement(.)('.')(1222,1223)
+ PsiElement(IDENTIFIER)('minecraft')(1223,1232)
+ PsiElement(.)('.')(1232,1233)
+ PsiElement(IDENTIFIER)('core')(1233,1237)
+ PsiElement(.)('.')(1237,1238)
+ PsiElement(IDENTIFIER)('particles')(1238,1247)
+ PsiElement(.)('.')(1247,1248)
+ PsiElement(IDENTIFIER)('ColorParticleOption')(1248,1267)
+ PsiWhiteSpace(' ')(1267,1268)
+ UnpickFieldNameImpl(FIELD_NAME)(1268,1273)
+ PsiElement(IDENTIFIER)('color')(1268,1273)
+ PsiWhiteSpace(' ')(1273,1274)
+ PsiElement(FIELD_DESCRIPTOR)('I')(1274,1275)
+ PsiWhiteSpace(' ')(1275,1276)
+ UnpickGroupRefImpl(GROUP_REF)(1276,1285)
+ PsiElement(IDENTIFIER)('ARGBColor')(1276,1285)
+ PsiElement(NEWLINE)('\n')(1285,1286)
+ PsiWhiteSpace('\n')(1286,1287)
+ PsiComment(COMMENT)('# apply to ints with the group "SetBlockFlag"')(1287,1332)
+ PsiWhiteSpace('\n')(1332,1333)
+ UnpickGroupDefinitionImpl(GROUP_DEFINITION)(1333,1478)
+ PsiElement(group)('group')(1333,1338)
+ PsiWhiteSpace(' ')(1338,1339)
+ UnpickDataTypeImpl(DATA_TYPE)(1339,1342)
+ PsiElement(IDENTIFIER)('int')(1339,1342)
+ PsiWhiteSpace(' ')(1342,1343)
+ UnpickGroupNameImpl(GROUP_NAME)(1343,1355)
+ PsiElement(IDENTIFIER)('SetBlockFlag')(1343,1355)
+ PsiElement(NEWLINE)('\n')(1355,1356)
+ PsiElement(INDENT)(' ')(1356,1360)
+ UnpickFlagsAttributeImpl(FLAGS_ATTRIBUTE)(1360,1366)
+ PsiElement(@)('@')(1360,1361)
+ PsiElement(KEYWORD)('flags')(1361,1366)
+ PsiElement(NEWLINE)('\n')(1366,1367)
+ PsiElement(INDENT)(' ')(1367,1371)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(1371,1419)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(1371,1419)
+ UnpickClassNameImpl(CLASS_NAME)(1371,1408)
+ PsiElement(IDENTIFIER)('net')(1371,1374)
+ PsiElement(.)('.')(1374,1375)
+ PsiElement(IDENTIFIER)('minecraft')(1375,1384)
+ PsiElement(.)('.')(1384,1385)
+ PsiElement(IDENTIFIER)('world')(1385,1390)
+ PsiElement(.)('.')(1390,1391)
+ PsiElement(IDENTIFIER)('level')(1391,1396)
+ PsiElement(.)('.')(1396,1397)
+ PsiElement(IDENTIFIER)('block')(1397,1402)
+ PsiElement(.)('.')(1402,1403)
+ PsiElement(IDENTIFIER)('Block')(1403,1408)
+ PsiElement(.)('.')(1408,1409)
+ UnpickFieldNameImpl(FIELD_NAME)(1409,1419)
+ PsiElement(IDENTIFIER)('UPDATE_ALL')(1409,1419)
+ PsiElement(NEWLINE)('\n')(1419,1420)
+ PsiElement(INDENT)(' ')(1420,1424)
+ UnpickGroupConstantImpl(GROUP_CONSTANT)(1424,1478)
+ UnpickFieldExpressionImpl(FIELD_EXPRESSION)(1424,1478)
+ UnpickClassNameImpl(CLASS_NAME)(1424,1461)
+ PsiElement(IDENTIFIER)('net')(1424,1427)
+ PsiElement(.)('.')(1427,1428)
+ PsiElement(IDENTIFIER)('minecraft')(1428,1437)
+ PsiElement(.)('.')(1437,1438)
+ PsiElement(IDENTIFIER)('world')(1438,1443)
+ PsiElement(.)('.')(1443,1444)
+ PsiElement(IDENTIFIER)('level')(1444,1449)
+ PsiElement(.)('.')(1449,1450)
+ PsiElement(IDENTIFIER)('block')(1450,1455)
+ PsiElement(.)('.')(1455,1456)
+ PsiElement(IDENTIFIER)('Block')(1456,1461)
+ PsiElement(.)('.')(1461,1462)
+ UnpickFieldNameImpl(FIELD_NAME)(1462,1478)
+ PsiElement(IDENTIFIER)('UPDATE_NEIGHBORS')(1462,1478)
+ PsiElement(NEWLINE)('\n')(1478,1479)
+ PsiWhiteSpace('\n')(1479,1480)
+ UnpickTargetAnnotationImpl(TARGET_ANNOTATION)(1480,1560)
+ PsiElement(target_annotation)('target_annotation')(1480,1497)
+ PsiWhiteSpace(' ')(1497,1498)
+ UnpickClassNameImpl(CLASS_NAME)(1498,1547)
+ PsiElement(IDENTIFIER)('net')(1498,1501)
+ PsiElement(.)('.')(1501,1502)
+ PsiElement(IDENTIFIER)('minecraft')(1502,1511)
+ PsiElement(.)('.')(1511,1512)
+ PsiElement(IDENTIFIER)('world')(1512,1517)
+ PsiElement(.)('.')(1517,1518)
+ PsiElement(IDENTIFIER)('level')(1518,1523)
+ PsiElement(.)('.')(1523,1524)
+ PsiElement(IDENTIFIER)('block')(1524,1529)
+ PsiElement(.)('.')(1529,1530)
+ PsiElement(IDENTIFIER)('Block$UpdateFlags')(1530,1547)
+ PsiWhiteSpace(' ')(1547,1548)
+ UnpickGroupRefImpl(GROUP_REF)(1548,1560)
+ PsiElement(IDENTIFIER)('SetBlockFlag')(1548,1560)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/spec.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/spec.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/spec.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,44 @@
+unpick v4
+
+# apply to floats in the default group globally
+group float
+ @strict # don't apply to double literals
+ net.minecraft.util.Mth.PI
+ net.minecraft.util.Mth.PI / 3
+
+# apply to strings in the default group globally
+group String
+ net.minecraft.SharedConstants.VERSION_STRING
+
+# an example of a wildcard field
+group int LevelEvents
+ net.minecraft.world.level.block.LevelEvent.*
+
+# apply to ints in the default group within the scope of ClientboundCustomPayloadPacket
+group int
+ @scope class net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket
+ net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket.MAX_PAYLOAD_SIZE
+
+# apply to ints with the group "ARGBColor"
+group int ARGBColor
+ @format hex # format unrecongized constants as hex
+ net.minecraft.util.CommonColors.WHITE
+ net.minecraft.util.CommonColors.BLACK
+
+# apply the group "ARGBColor" to ints flowing into the 5th parameter of of GuiGraphics.fill
+target_method net.minecraft.client.gui.GuiGraphics fill (IIIII)V
+ param 4 ARGBColor
+
+# apply the group "ARGBColor" to ints flowing from the return of ARGB.color
+target_method net.minecraft.util.ARGB color (IIII)I
+ return ARGBColor
+
+target_field net.minecraft.core.particles.ColorParticleOption color I ARGBColor
+
+# apply to ints with the group "SetBlockFlag"
+group int SetBlockFlag
+ @flags
+ net.minecraft.world.level.block.Block.UPDATE_ALL
+ net.minecraft.world.level.block.Block.UPDATE_NEIGHBORS
+
+target_annotation net.minecraft.world.level.block.Block$UpdateFlags SetBlockFlag
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/target_method.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/target_method.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/target_method.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,107 @@
+Unpick File(0,212)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v3')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ UnpickTargetMethodImpl(TARGET_METHOD)(10,39)
+ PsiElement(target_method)('target_method')(10,23)
+ PsiWhiteSpace(' ')(23,24)
+ UnpickClassNameImpl(CLASS_NAME)(24,31)
+ PsiElement(IDENTIFIER)('foo')(24,27)
+ PsiElement(.)('.')(27,28)
+ PsiElement(IDENTIFIER)('Bar')(28,31)
+ PsiWhiteSpace(' ')(31,32)
+ UnpickMethodNameImpl(METHOD_NAME)(32,35)
+ PsiElement(IDENTIFIER)('baz')(32,35)
+ PsiWhiteSpace(' ')(35,36)
+ PsiElement(METHOD_DESCRIPTOR)('()V')(36,39)
+ PsiElement(NEWLINE)('\n')(39,40)
+ UnpickTargetMethodImpl(TARGET_METHOD)(40,125)
+ PsiElement(target_method)('target_method')(40,53)
+ PsiWhiteSpace(' ')(53,54)
+ UnpickClassNameImpl(CLASS_NAME)(54,61)
+ PsiElement(IDENTIFIER)('foo')(54,57)
+ PsiElement(.)('.')(57,58)
+ PsiElement(IDENTIFIER)('Bar')(58,61)
+ PsiWhiteSpace(' ')(61,62)
+ UnpickMethodNameImpl(METHOD_NAME)(62,65)
+ PsiElement(IDENTIFIER)('baz')(62,65)
+ PsiWhiteSpace(' ')(65,66)
+ PsiElement(METHOD_DESCRIPTOR)('()V')(66,69)
+ PsiElement(NEWLINE)('\n')(69,70)
+ PsiElement(INDENT)(' ')(70,74)
+ UnpickTargetMethodParamImpl(TARGET_METHOD_PARAM)(74,83)
+ PsiElement(KEYWORD)('param')(74,79)
+ PsiWhiteSpace(' ')(79,80)
+ PsiElement(INTEGER)('0')(80,81)
+ PsiWhiteSpace(' ')(81,82)
+ UnpickGroupRefImpl(GROUP_REF)(82,83)
+ PsiElement(IDENTIFIER)('a')(82,83)
+ PsiElement(NEWLINE)('\n')(83,84)
+ PsiElement(INDENT)(' ')(84,88)
+ UnpickTargetMethodParamImpl(TARGET_METHOD_PARAM)(88,97)
+ PsiElement(KEYWORD)('param')(88,93)
+ PsiWhiteSpace(' ')(93,94)
+ PsiElement(INTEGER)('1')(94,95)
+ PsiWhiteSpace(' ')(95,96)
+ UnpickGroupRefImpl(GROUP_REF)(96,97)
+ PsiElement(IDENTIFIER)('b')(96,97)
+ PsiElement(NEWLINE)('\n')(97,98)
+ PsiElement(INDENT)(' ')(98,102)
+ UnpickTargetMethodParamImpl(TARGET_METHOD_PARAM)(102,112)
+ PsiElement(KEYWORD)('param')(102,107)
+ PsiWhiteSpace(' ')(107,108)
+ PsiElement(INTEGER)('69')(108,110)
+ PsiWhiteSpace(' ')(110,111)
+ UnpickGroupRefImpl(GROUP_REF)(111,112)
+ PsiElement(IDENTIFIER)('c')(111,112)
+ PsiElement(NEWLINE)('\n')(112,113)
+ PsiElement(INDENT)(' ')(113,117)
+ UnpickTargetMethodReturnImpl(TARGET_METHOD_RETURN)(117,125)
+ PsiElement(KEYWORD)('return')(117,123)
+ PsiWhiteSpace(' ')(123,124)
+ UnpickGroupRefImpl(GROUP_REF)(124,125)
+ PsiElement(IDENTIFIER)('d')(124,125)
+ PsiElement(NEWLINE)('\n')(125,126)
+ UnpickTargetMethodImpl(TARGET_METHOD)(126,169)
+ PsiElement(target_method)('target_method')(126,139)
+ PsiWhiteSpace(' ')(139,140)
+ UnpickClassNameImpl(CLASS_NAME)(140,147)
+ PsiElement(IDENTIFIER)('foo')(140,143)
+ PsiElement(.)('.')(143,144)
+ PsiElement(IDENTIFIER)('Bar')(144,147)
+ PsiWhiteSpace(' ')(147,148)
+ UnpickMethodNameImpl(METHOD_NAME)(148,151)
+ PsiElement(IDENTIFIER)('baz')(148,151)
+ PsiWhiteSpace(' ')(151,152)
+ PsiElement(METHOD_DESCRIPTOR)('()V')(152,155)
+ PsiElement(NEWLINE)('\n')(155,156)
+ PsiElement(INDENT)(' ')(156,160)
+ UnpickTargetMethodParamImpl(TARGET_METHOD_PARAM)(160,169)
+ PsiElement(KEYWORD)('param')(160,165)
+ PsiWhiteSpace(' ')(165,166)
+ PsiElement(INTEGER)('0')(166,167)
+ PsiWhiteSpace(' ')(167,168)
+ UnpickGroupRefImpl(GROUP_REF)(168,169)
+ PsiElement(IDENTIFIER)('e')(168,169)
+ PsiElement(NEWLINE)('\n')(169,170)
+ UnpickTargetMethodImpl(TARGET_METHOD)(170,212)
+ PsiElement(target_method)('target_method')(170,183)
+ PsiWhiteSpace(' ')(183,184)
+ UnpickClassNameImpl(CLASS_NAME)(184,191)
+ PsiElement(IDENTIFIER)('foo')(184,187)
+ PsiElement(.)('.')(187,188)
+ PsiElement(IDENTIFIER)('Bar')(188,191)
+ PsiWhiteSpace(' ')(191,192)
+ UnpickMethodNameImpl(METHOD_NAME)(192,195)
+ PsiElement(IDENTIFIER)('baz')(192,195)
+ PsiWhiteSpace(' ')(195,196)
+ PsiElement(METHOD_DESCRIPTOR)('()V')(196,199)
+ PsiElement(NEWLINE)('\n')(199,200)
+ PsiElement(INDENT)(' ')(200,204)
+ UnpickTargetMethodReturnImpl(TARGET_METHOD_RETURN)(204,212)
+ PsiElement(KEYWORD)('return')(204,210)
+ PsiWhiteSpace(' ')(210,211)
+ UnpickGroupRefImpl(GROUP_REF)(211,212)
+ PsiElement(IDENTIFIER)('f')(211,212)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/target_method.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/target_method.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/target_method.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,11 @@
+unpick v3
+target_method foo.Bar baz ()V
+target_method foo.Bar baz ()V
+ param 0 a
+ param 1 b
+ param 69 c
+ return d
+target_method foo.Bar baz ()V
+ param 0 e
+target_method foo.Bar baz ()V
+ return f
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/unsupported.txt
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/unsupported.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/unsupported.txt (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,7 @@
+Unpick File(0,25)
+ UnpickHeaderImpl(HEADER)(0,9)
+ PsiElement(unpick)('unpick')(0,6)
+ PsiWhiteSpace(' ')(6,7)
+ PsiElement(IDENTIFIER)('v2')(7,9)
+ PsiElement(NEWLINE)('\n')(9,10)
+ PsiElement(UNSUPPORTED_BODY)('group int\n 1')(10,25)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/unsupported.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/unsupported.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/parser/fixtures/unsupported.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v2
+group int
+ 1
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_binary_expression_unterminated.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_binary_expression_unterminated.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_binary_expression_unterminated.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ 1 +
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_identifier.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_identifier.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_identifier.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ foo
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_identifier_parenthesized.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_identifier_parenthesized.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_identifier_parenthesized.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ (foo)
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_nonexistent_operator.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_nonexistent_operator.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_nonexistent_operator.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ 1 @ 2
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_unary_expression_incomplete.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_unary_expression_incomplete.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_unary_expression_incomplete.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ ~
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_unclosed_parentheses.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_unclosed_parentheses.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/expression_unclosed_parentheses.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ (1
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/other_missing_header.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/other_missing_header.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/other_missing_header.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,1 @@
+group int
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_class_name_two_dots.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_class_name_two_dots.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_class_name_two_dots.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,2 @@
+unpick v3
+target_field foo..Bar baz I g
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_flag_default_group.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_flag_default_group.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_flag_default_group.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ @flags
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_flag_invalid_data_type.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_flag_invalid_data_type.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_flag_invalid_data_type.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group float g
+ @flags
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_invalid_format.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_invalid_format.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_invalid_format.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+group int
+ @format foo
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_flags.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_flags.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_flags.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,4 @@
+unpick v3
+group int g
+ @flags
+ @flags
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_formats.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_formats.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_formats.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,4 @@
+unpick v3
+group int
+ @format decimal
+ @format hex
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_strict.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_strict.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_group_definition_multiple_strict.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,4 @@
+unpick v3
+group int
+ @strict
+ @strict
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_angled_brackets_incorrect.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_angled_brackets_incorrect.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_angled_brackets_incorrect.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,2 @@
+unpick v3
+target_method foo.Bar ()V
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_less_than.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_less_than.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_less_than.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,2 @@
+unpick v3
+target_method foo.Bar < ()V
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_missing_greater_than.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_missing_greater_than.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/invalid/syntax_method_name_missing_greater_than.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,2 @@
+unpick v3
+target_method foo.Bar >> 6 >> 7 ^ 8 * 9 & 10 - 11
+ -0
+ ~0
+ 1 + -2
+ (int) 1
+ (1)
+ (1 + 2)
+ 1 * (2 + 3) / 4
+ (int) 1 + 2
+ foo.Bar.baz
+ foo.Bar.baz:instance
+ foo.Bar.baz:byte
+ foo.Bar.baz:instance:byte
+ (foo.Bar.baz)
+ Foo.bar
+ foo.Bar.*
+ foo.Bar.*:instance
+ foo.Bar.*:byte
+ foo.Bar.*:instance:byte
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/other_spec.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/other_spec.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/other_spec.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,44 @@
+unpick v4
+
+# apply to floats in the default group globally
+group float
+ @strict # don't apply to double literals
+ net.minecraft.util.Mth.PI
+ net.minecraft.util.Mth.PI / 3
+
+# apply to strings in the default group globally
+group String
+ net.minecraft.SharedConstants.VERSION_STRING
+
+# an example of a wildcard field
+group int LevelEvents
+ net.minecraft.world.level.block.LevelEvent.*
+
+# apply to ints in the default group within the scope of ClientboundCustomPayloadPacket
+group int
+ @scope class net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket
+ net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket.MAX_PAYLOAD_SIZE
+
+# apply to ints with the group "ARGBColor"
+group int ARGBColor
+ @format hex # format unrecongized constants as hex
+ net.minecraft.util.CommonColors.WHITE
+ net.minecraft.util.CommonColors.BLACK
+
+# apply the group "ARGBColor" to ints flowing into the 5th parameter of of GuiGraphics.fill
+target_method net.minecraft.client.gui.GuiGraphics fill (IIIII)V
+ param 4 ARGBColor
+
+# apply the group "ARGBColor" to ints flowing from the return of ARGB.color
+target_method net.minecraft.util.ARGB color (IIII)I
+ return ARGBColor
+
+target_field net.minecraft.core.particles.ColorParticleOption color I ARGBColor
+
+# apply to ints with the group "SetBlockFlag"
+group int SetBlockFlag
+ @flags
+ net.minecraft.world.level.block.Block.UPDATE_ALL
+ net.minecraft.world.level.block.Block.UPDATE_NEIGHBORS
+
+target_annotation net.minecraft.world.level.block.Block$UpdateFlags SetBlockFlag
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_class_name.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_class_name.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_class_name.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,5 @@
+unpick v3
+target_field Foo bar I g
+target_field foo.Bar baz I g
+target_field foo.Bar$Baz quux I g
+target_field foo.Bar$1 baz I g
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_data_type.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_data_type.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_data_type.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,10 @@
+unpick v3
+group int
+ (byte) 0
+ (short) 1
+ (int) 2
+ (long) 3
+ (float) 4
+ (double) 5
+ (char) 6
+ (String) 7
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_group_definition.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_group_definition.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_group_definition.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,70 @@
+unpick v3
+group int
+group int
+ 0
+group int g
+ @strict
+ 0
+group long
+ 0
+group long g
+ 0
+group float
+ 0
+ 1.0
+group float g
+ 0
+ 1.0
+group double
+ 0
+ 1.0
+group double g
+ 0
+ 1.0
+group String
+ ""
+group String g
+ ""
+group Class
+ Foo.bar
+group Class g
+ Foo.bar
+group int g
+ @flags
+ 0
+group long g
+ @flags
+ 0
+group int a
+ @format decimal
+group long b
+ @format hex
+group int c
+ @format binary
+group long d
+ @format octal
+group int e
+ @format char
+group long f
+ @format decimal
+ 0
+group float af
+ @format decimal
+group float bf
+ @format hex
+group double cf
+ @format decimal
+group double df
+ @format hex
+group int
+ @scope package foo.bar
+ 0
+group int
+ @scope class foo.Bar
+ 0
+group int
+ @scope method foo.Bar baz ()V
+ 0
+group int
+ @scope package foo.bar
+ @scope package baz.quux
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_method_name.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_method_name.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_method_name.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,4 @@
+unpick v3
+target_method foo.Bar baz ()V
+target_method foo.Bar ()V
+target_method foo.Bar ()V
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_target_annotation.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_target_annotation.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_target_annotation.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v4
+
+target_annotation foo.Bar baz
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_target_method.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_target_method.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/syntax_target_method.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,11 @@
+unpick v3
+target_method foo.Bar baz ()V
+target_method foo.Bar baz ()V
+ param 0 a
+ param 1 b
+ param 69 c
+ return d
+target_method foo.Bar baz ()V
+ param 0 e
+target_method foo.Bar baz ()V
+ return f
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_char.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_char.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_char.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,17 @@
+unpick v3
+group int
+ 'a'
+ '"'
+ '\uuuuu00a7'
+ '\b'
+ '\t'
+ '\n'
+ '\f'
+ '\r'
+ '\''
+ '\"'
+ '\\'
+ '\0'
+ '\12'
+ '\123'
+ '\74'
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_double.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_double.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_double.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,12 @@
+unpick v3
+group double
+ 0.0
+ 1.0
+ -2.0
+ 4.5
+ 1.0e5
+ 1.0E5
+ 1.0e-5
+ 1.0e+5
+ 1.0e10
+ 1.7976931348623157E308
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_field_descriptor.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_field_descriptor.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_field_descriptor.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,12 @@
+unpick v3
+target_field foo.Bar baz B g
+target_field foo.Bar baz C g
+target_field foo.Bar baz D g
+target_field foo.Bar baz F g
+target_field foo.Bar baz I g
+target_field foo.Bar baz J g
+target_field foo.Bar baz S g
+target_field foo.Bar baz Z g
+target_field foo.Bar baz Ljava/lang/String; g
+target_field foo.Bar baz [I g
+target_field foo.Bar baz [[Ljava/lang/String; g
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_float.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_float.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_float.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,9 @@
+unpick v3
+group float
+ 0.0f
+ 1.0f
+ -2.0F
+ 1.0e5f
+ 1.0e-5F
+ 1.0e10f
+ 3.4028235e38F
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_identifier.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_identifier.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_identifier.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,6 @@
+unpick v3
+group int a
+group int A
+group int _
+group int $
+group int az0_$G
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_integer.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_integer.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_integer.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,13 @@
+unpick v3
+group int
+ 0
+ 1
+ -2
+ 2147483647
+ -2147483648
+ 0x09fF
+ 0Xffffffff
+ 0b1010
+ 0B11111111111111111111111111111111
+ 0777
+ 037777777777
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_long.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_long.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_long.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,13 @@
+unpick v3
+group long
+ 0l
+ 1L
+ -2l
+ 9223372036854775807L
+ -9223372036854775808l
+ 0x09fFL
+ 0Xffffffffffffffffl
+ 0b1010L
+ 0B1111111111111111111111111111111111111111111111111111111111111111l
+ 0777L
+ 01777777777777777777777l
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_method_descriptor.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_method_descriptor.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_method_descriptor.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,3 @@
+unpick v3
+target_method foo.Bar baz ()V
+target_method foo.Bar baz ([[[Ljava/lang/Object;IIIDDZZLjava/lang/Object;[[[[[I)Ljava/lang/Thread;
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_string.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_string.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/tokens_string.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,4 @@
+unpick v3
+group String
+ "Hello '\u00A7\b\t\n\f\r\'\"\\\0\12\123\1234\74\747\08"
+ ""
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_blank_lines.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_blank_lines.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_blank_lines.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,6 @@
+unpick v3
+
+
+
+target_field foo.Bar baz I g
+
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_comments.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_comments.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_comments.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,5 @@
+unpick v3
+# this is a comment
+ # this is a second comment
+target_field foo.Bar baz I g# this is an end of line comment with no preceding space
+target_field foo.Bar baz I g # this is an end of line comment with preceding spaces
\ No newline at end of file
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_indent.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_indent.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_indent.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,14 @@
+unpick v3
+
+group float
+ 0
+ 0
+ 0
+
+ 0 # comment
+ 0
+
+# comment
+
+ 0
+
Index: src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_minimal_spaces.unpick
===================================================================
--- src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_minimal_spaces.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ src/test/resources/com/demonwav/mcdev/platform/minecraft/unpick/reference/valid/whitespace_minimal_spaces.unpick (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,5 @@
+unpick v3
+target_field foo.Bar baz Ljava/lang/String;g
+target_method foo.Bar baz()V
+group String
+ ""+1/(2+(int)foo.Bar.baz:byte)
\ No newline at end of file
Index: unpick-review.md
===================================================================
--- unpick-review.md (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
+++ unpick-review.md (revision ac067c6ef1ed01a34debcb869b4d3f26d3613a37)
@@ -0,0 +1,26 @@
+- I have updated the unpick spec to clarify that wildcard field expressions only match constant fields. Update the code to comply with this clarification.
+- `UpickValue.toJavaString()` does not handle the case where the value is a `PsiType`. In this case, you should make it return the same result as if `Class.toString()` were called on the value if it were a `Class`.
+- In `Evaluation.evaluateField`, `isNullInitializer` for string values isn't enough, as the string constant could be `null` due to being initialized to another string constant which is `null`.
+- What's the logic behind class values being able to be `PsiField` as well? If you are unable to resolve what the field value is for whatever reason, return an unknown value.
+- `UnpickValue.convertTo` should probably throw an exception if it's inconvertible. When you apply this change, check the call sites to make sure they properly handle the case where it's inconvertible. Maybe you should add a `canConvertTo` utility if it needs checking.
+- You could make `UnpickValue` a data class, which would avoid you needing to implement `equals`, `hashCode`, and `toString`.
+- Throughout your changes there are companion objects in IDE extension implementations which generate a warning in IntelliJ. Resolve these warnings by converting them to named objects, as we do in the rest of the project. Add this to your memory that this needs to be done in future.
+- Inner class references indeed don't work as you predicted. Find a way to fix this.
+- The error message in DuplicateUnpickConstantInspection is a bit off in the case of wildcard fields. It assumes that the value of the wildcard field expression is the final value of the expression.
+- `UnpickDescriptors` is mostly unnecessary since we have ASM on the classpath. They can be validated with a simple regex (I think we already do this somewhere in the project) before being passed on to ASM.
+- `UnpickClassReference.getVariants`, where it uses `outer.innerClasses`, does not take into account local or anonymous classes. Fix this.
+- `UnpickBinaryExpressionMixin` could use properties rather than getter methods.
+- It feels like `UnpickHeaderMixin.SUPPORTED_VERSIONS` can live in a better location.
+- `UnpickAnnotator.annotateHeader` converts the whole file to a string, which is very inefficient.
+- In `UnpickAnnotator`, it's a bit weird that `error` and `highlight` are structured differently with different receivers.
+- `UnpickCompletionContributor.fillCompletionVariants` converts the whole file to a string, which is very inefficient.
+- Look to see if there's a built-in replacement for `UnpickLiterals.unquote` (there might not be).
+- I want some changes to the highlighting. Some of these may just be a problem in the preview in the color settings menu, some may be real issues:
+ - I want the attribute highlight to cover the attribute name, not just the `@` symbol.
+ - I want there to be a separate highlight color for data types.
+ - I want there to be a separate highlight color for group formats.
+ - I want the group name color to inherit from enum definitions/references rather than constants.
+ - I want descriptors to default to a different color than strings.
+- Auto-completion of the owner class in field expressions doesn't work
+- Auto-completion of classes should allow the user to type the simple name of the class, and then complete to the fully-qualified name.
+- Docs are in Markdown Javadoc format. What would it take to be able to reuse the highlighting, completion features, etc, of that? Unless it's simple, don't implement it, just answer the question.
\ No newline at end of file