<commit_before>/*
 * Use of this source code is governed by the MIT license that can be
 * found in the LICENSE file.
 */

package org.toml.lang.psi.impl

import com.intellij.extapi.psi.ASTWrapperPsiElement
import com.intellij.lang.ASTNode
import com.intellij.psi.tree.TokenSet
import org.toml.lang.psi.*
import org.toml.lang.psi.TomlElementTypes.*


class TomlKeyValueImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlKeyValue {
    override val key: TomlKey
        get() = notNullChild(findChildByType(KEY))

    override val value: TomlValue?
        get() = findChildByType(KEY)
}


class TomlKeyImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlKey
class TomlLiteralImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlLiteral

class TomlArrayImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlArray {
    override val elements: List<TomlValue>
        get() = findChildrenByType(VALUES)
}

class TomlTableImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlTable {
    override val header: TomlTableHeader
        get() = notNullChild(findChildByType(TABLE_HEADER))

    override val entries: List<TomlKeyValue>
        get() = findChildrenByType(KEY_VALUE)
}

class TomlTableHeaderImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlTableHeader {
    override val names: List<TomlKey>
        get() = findChildrenByType(KEY)
}

class TomlInlineTableImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlInlineTable {
    override val entries: List<TomlKeyValue>
        get() = findChildrenByType(KEY_VALUE)
}

class TomlArrayTableImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlArrayTable {
    override val header: TomlTableHeader
        get() = notNullChild(findChildByType(TABLE_HEADER))<commit_msg>Support reference providers for keys&values<commit_after>/*
 * Use of this source code is governed by the MIT license that can be
 * found in the LICENSE file.
 */

package org.toml.lang.psi.impl

import com.intellij.extapi.psi.ASTWrapperPsiElement
import com.intellij.lang.ASTNode
import com.intellij.psi.PsiReference
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry
import com.intellij.psi.tree.TokenSet
import org.toml.lang.psi.*
import org.toml.lang.psi.TomlElementTypes.*


class TomlKeyValueImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlKeyValue {
    override val key: TomlKey
        get() = notNullChild(findChildByType(KEY))

    override val value: TomlValue?
        get() = findChildByType(KEY)
}


class TomlKeyImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlKey {
    override fun getReferences(): Array<PsiReference>
        = ReferenceProvidersRegistry.getReferencesFromProviders(this)
}

class TomlLiteralImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlLiteral {
    override fun getReferences(): Array<PsiReference>
        = ReferenceProvidersRegistry.getReferencesFromProviders(this)
}

class TomlArrayImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlArray {
    override val elements: List<TomlValue>
        get() = findChildrenByType(VALUES)
}

class TomlTableImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlTable {
    override val header: TomlTableHeader
        get() = notNullChild(findChildByType(TABLE_HEADER))

    override val entries: List<TomlKeyValue>
        get() = findChildrenByType(KEY_VALUE)
}

class TomlTableHeaderImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlTableHeader {
    override val names: List<TomlKey>
        get() = findChildrenByType(KEY)
}

class TomlInlineTableImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlInlineTable {
    override val entries: List<TomlKeyValue>
        get() = findChildrenByType(KEY_VALUE)
}

class TomlArrayTableImpl(node: ASTNode) : ASTWrapperPsiElement(node), TomlArrayTable {
    override val header: TomlTableHeader
        get() = notNullChild(findChildByType(TABLE_HEADER))
{'fraction_non_alphanumeric': 0.09424218951717016, 'fraction_numerical': 0.0, 'mean_word_length': 5.072100313479623, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2273715', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1187, 'n_words': 257}