File tree Expand file tree Collapse file tree
src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/grammar Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,11 +42,6 @@ fun defaultRole(terminal: TerminalCombinator): Role? = when (terminal) {
4242private fun Array <out String >.allPunctuation (): Boolean =
4343 isNotEmpty() && all { choice -> choice.isNotEmpty() && choice.none(Char ::isLetterOrDigit) }
4444
45- /* *
46- * The coloured regions for [value]. Explicit [Labeled] regions win; any token not inside a labeled
47- * region gets its terminal's [defaultRole]. Returns empty if no full parse exists — we don't colour
48- * values that don't match the grammar.
49- */
5045/* *
5146 * The explicit [Labeled] spans in [value] (e.g. a whole IP address), from the first fully-valid
5247 * parse — i.e. structure the grammar marked, without the per-token coloring defaults. Used by
@@ -58,6 +53,11 @@ fun Combinator.labeledRegions(value: String): List<Region> {
5853 return parse.regions
5954}
6055
56+ /* *
57+ * The coloured regions for [value]. Explicit [Labeled] regions win; any token not inside a labeled
58+ * region gets its terminal's [defaultRole]. Returns empty if no full parse exists — we don't colour
59+ * values that don't match the grammar.
60+ */
6161fun Combinator.colorize (value : String ): List <Region > {
6262 val parse = parse(value, 0 ).filterIsInstance<Parse >().firstOrNull { it.end == value.length } ? : return emptyList()
6363
You can’t perform that action at this time.
0 commit comments