Add color to brackets. Brackets will be coloured consecutively with the
colors provided in color_seq
by scope.
color_brackets(x, color_seq = list(yellow, blue, cyan))
a character vector of brackets consisting of a valid sequence of any
of the following: '[[', '[', ']', '(', ')', '{', '}'
a list of functions that take and return a character scalar
Meant for coloring brackets encountered within highlight
.
Note that occurrences of 'orphan' brackets are not taken into account
mainly due to the fact that cases such as
foo <- function(x){ `[`(x, 1) }
will either be converted to
foo <- function(x){ x[1]}
before the brackets are coloured if passed in as
highlight(deparse(foo))
or will be identified as a
'SYMBOL_FUNCTION_CALL' token instead of 'LBB' if passed in as
highlight("foo <- function(x){ `[`(x, 1) }")
Similarly, invalid code that would lead to orphaned brackets is not taken
into account as this would be caught before hand in highlight
.