Skip to content

KtLiteralPrefixAndSuffix

The rule that a literal may not be glued to the token next to it, as in a foo"bar" or 1in a.

The rule is checked once per tree shape: FirPrefixAndSuffixSyntaxChecker walks the PSI, while for the light tree the check rides along with the walk KotlinLightParser already makes over the freshly parsed tree. Only the walk differs between the two, so what a literal is and which neighbours are prohibited is kept here.

Properties

relevantLiteralTypes

val relevantLiteralTypes: TokenSet

The literal expressions the rule applies to.

Functions

isProhibitedPrefixOrSuffix

fun isProhibitedPrefixOrSuffix(tokenType: IElementType): Boolean

Whether a token of type tokenType may not directly touch a literal. Any other token, whitespace and comments included, separates the two.