| # Otherwise treat as text | # Otherwise treat as text | ||||
| obj <- tryCatch({ | obj <- tryCatch({ | ||||
| if (grepl("\n", ctx_text)) { | if (grepl("\n", ctx_text)) { | ||||
| ctx_text | |||||
| ctx_text[1:min(length(ctx_text), 100)] | |||||
| } else { | } else { | ||||
| x <- eval(parse(text = ctx_text)) | x <- eval(parse(text = ctx_text)) | ||||
| x <- as.character(x) | x <- as.character(x) | ||||
| } else x | } else x | ||||
| } | } | ||||
| }, | }, | ||||
| error = function(e) {as.character(ctx_text)}) | |||||
| error = function(e) {as.character(ctx_text[1:min(length(ctx_text), 100)])}) | |||||
| regex_gadget(if (length(obj) && obj != "") obj) | regex_gadget(if (length(obj) && obj != "") obj) | ||||