styleTokens

fun styleTokens(tokens: Iterable<A_Token>, style: StylerDescriptor.SystemStyle, overwrite: Boolean = false, editor: (String?) -> String? = { old -> when (old) { null -> style.kotlinString else -> "$old,${style.kotlinString}" } })

Helper method to style a token's range in a particular named style, using the specified function to merge any style information previously attached to all or parts of the token's range.

Parameters

tokens

The tokens to style. Only tokens actually taken from the source of the current module will be styled.

style

The system style to apply to the token.

overwrite

Whether the new style should clobber the old style.

editor

How to reconcile an existing style with the new style. Applied to the existing style. Evaluates to the replacement style, which may be a comma-separated composite of styles. Defaults to style composition.


fun styleTokens(tokens: Iterable<A_Token>, style: String?, overwrite: Boolean = false, editor: (String?) -> String? = { old -> when { old === null -> style style === null -> old else -> "$old,$style" } })

Helper method to style a token's range in a particular named style, using the specified function to merge any style information previously attached to all or parts of the token's range.

Parameters

tokens

The tokens to style. Only tokens actually taken from the source of the current module will be styled.

style

The optional style to apply to the token. If null, then clear the style iff overwrite is true; otherwise, preserve the original style.

overwrite

Whether the new style should clobber the old style.

editor

How to reconcile an existing style with the new style. Applied to the existing style. Evaluates to the replacement style, which may be a comma-separated composite of styles. Defaults to style composition.