
commonMain.at.asitplus.jsonpath.implementation.AbstractSyntaxTree.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsonpath4k-jvm Show documentation
Show all versions of jsonpath4k-jvm Show documentation
Kotlin Multiplatform library for using Json Paths as specified in [RFC9535](https://datatracker.ietf.org/doc/rfc9535/)
The newest version!
package at.asitplus.jsonpath.implementation
import org.antlr.v4.kotlinruntime.ParserRuleContext
import org.antlr.v4.kotlinruntime.Token
import org.antlr.v4.kotlinruntime.ast.Position
internal data class AbstractSyntaxTree(
val text: String,
val position: Position?,
val value: T,
val children: List> = listOf(),
) {
constructor(
context: ParserRuleContext?,
value: T,
children: List> = listOf(),
) : this(
text = context?.text ?: "",
position = context?.position,
value = value,
children = children,
)
constructor(
token: Token,
value: T,
children: List> = listOf(),
) : this(
text = token.text ?: "",
position = token.startPoint().let { Position(it, token.endPoint() ?: it) },
value = value,
children = children,
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy