# reserved [plain] Code cat(code_highlight("function () { }", list(reserved = "bold"))) Output function () { } Code cat(code_highlight("if (1) NULL else NULL", list(reserved = "bold"))) Output if (1) NULL else NULL Code cat(code_highlight("repeat {}", list(reserved = "bold"))) Output repeat {} Code cat(code_highlight("while (1) {}", list(reserved = "bold"))) Output while (1) {} Code cat(code_highlight("for (i in x) next", list(reserved = "bold"))) Output for (i in x) next Code cat(code_highlight("for (i in x) break", list(reserved = "bold"))) Output for (i in x) break # reserved [ansi] Code cat(code_highlight("function () { }", list(reserved = "bold"))) Output function () { } Code cat(code_highlight("if (1) NULL else NULL", list(reserved = "bold"))) Output if (1) NULL else NULL Code cat(code_highlight("repeat {}", list(reserved = "bold"))) Output repeat {} Code cat(code_highlight("while (1) {}", list(reserved = "bold"))) Output while (1) {} Code cat(code_highlight("for (i in x) next", list(reserved = "bold"))) Output for (i in x) next Code cat(code_highlight("for (i in x) break", list(reserved = "bold"))) Output for (i in x) break # number [plain] Code cat(code_highlight("1 + 1.0 + -1 + 2L + Inf", list(number = "bold"))) Output 1 + 1.0 + -1 + 2L + Inf Code cat(code_highlight("NA + NA_real_ + NA_integer_ + NA_character_", list(number = "bold"))) Output NA + NA_real_ + NA_integer_ + NA_character_ Code cat(code_highlight("TRUE + FALSE", list(number = "bold"))) Output TRUE + FALSE # number [ansi] Code cat(code_highlight("1 + 1.0 + -1 + 2L + Inf", list(number = "bold"))) Output 1 + 1.0 + -1 + 2L + Inf Code cat(code_highlight("NA + NA_real_ + NA_integer_ + NA_character_", list(number = "bold"))) Output NA + NA_real_ + NA_integer_ + NA_character_ Code cat(code_highlight("TRUE + FALSE", list(number = "bold"))) Output TRUE + FALSE # null [plain] Code cat(code_highlight("NULL", list(null = "bold"))) Output NULL # null [ansi] Code cat(code_highlight("NULL", list(null = "bold"))) Output NULL # operator [plain] Code cat(code_highlight("~ ! 1 - 2 + 3:4 * 5 / 6 ^ 7", list(operator = "bold"))) Output ~ ! 1 - 2 + 3:4 * 5 / 6 ^ 7 Code cat(code_highlight("? 1 %% 2 %+% 2 < 3 & 4 > 5 && 6 == 7 | 8 <= 9 || 10 >= 11", list(operator = "bold"))) Output ? 1 %% 2 %+% 2 < 3 & 4 > 5 && 6 == 7 | 8 <= 9 || 10 >= 11 Code cat(code_highlight("a <- 10; 20 -> b; c = 30; a$b; a@b", list(operator = "bold"))) Output a <- 10; 20 -> b; c = 30; a$b; a@b # operator [ansi] Code cat(code_highlight("~ ! 1 - 2 + 3:4 * 5 / 6 ^ 7", list(operator = "bold"))) Output ~ ! 1 - 2 + 3:4 * 5 / 6 ^ 7 Code cat(code_highlight("? 1 %% 2 %+% 2 < 3 & 4 > 5 && 6 == 7 | 8 <= 9 || 10 >= 11", list(operator = "bold"))) Output ? 1 %% 2 %+% 2 < 3 & 4 > 5 && 6 == 7 | 8 <= 9 || 10 >= 11 Code cat(code_highlight("a <- 10; 20 -> b; c = 30; a$b; a@b", list(operator = "bold"))) Output a <- 10; 20 -> b; c = 30; a$b; a@b # call [plain] Code cat(code_highlight("ls(2)", list(call = "bold"))) Output ls(2) # call [ansi] Code cat(code_highlight("ls(2)", list(call = "bold"))) Output ls(2) # string [plain] Code cat(code_highlight("'s' + \"s\"", list(string = "bold"))) Output 's' + "s" # string [ansi] Code cat(code_highlight("'s' + \"s\"", list(string = "bold"))) Output 's' + "s" # comment [plain] Code cat(code_highlight(c("# COM", " ls() ## ANOT"), list(comment = "bold"))) Output # COM ls() ## ANOT # comment [ansi] Code cat(code_highlight(c("# COM", " ls() ## ANOT"), list(comment = "bold"))) Output # COM ls() ## ANOT # bracket [plain] Code cat(code_highlight("foo <- function(x){x}", list(bracket = list("bold")))) Output foo <- function(x){x} # bracket [ansi] Code cat(code_highlight("foo <- function(x){x}", list(bracket = list("bold")))) Output foo <- function(x){x} # code_theme_list Code code_theme_list() Output [1] "Ambiance" "Chaos" "Chrome" [4] "Clouds" "Clouds Midnight" "Cobalt" [7] "Crimson Editor" "Dawn" "Dracula" [10] "Dreamweaver" "Eclipse" "Idle Fingers" [13] "Katzenmilch" "Kr Theme" "Material" [16] "Merbivore" "Merbivore Soft" "Mono Industrial" [19] "Monokai" "Pastel On Dark" "Solarized Dark" [22] "Solarized Light" "Textmate (default)" "Tomorrow" [25] "Tomorrow Night" "Tomorrow Night Blue" "Tomorrow Night Bright" [28] "Tomorrow Night 80s" "Twilight" "Vibrant Ink" [31] "Xcode" # new language features, raw strings [ansi] Code cat(code_highlight("\"old\" + r\"(\"new\"\"\")\"", list(string = "bold", reserved = "italic"))) Output "old" + r"("new""")" # new language features, pipe [ansi] Code cat(code_highlight("dir() |> toupper()", list(operator = "bold"))) Output dir() |> toupper() # new language features, lambda functions [ansi] Code cat(code_highlight("\\(x) x * 2", list(reserved = "bold"))) Output \(x) x * 2
Generated by dwww version 1.15 on Sat May 18 09:48:17 CEST 2024.