File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ parse_transform_serialize_r_block <- function(pd_nested,
28
28
base_indention ) {
29
29
if (! all(pd_nested $ is_cached , na.rm = TRUE ) || ! cache_is_activated()) {
30
30
transformed_pd <- apply_transformers(pd_nested , transformers )
31
- flattened_pd <- post_visit_one(transformed_pd , extract_terminals ) %> %
31
+ flattened_pd <-
32
+ # Special transformer: returns a list of pd
33
+ vec_rbind(!!! post_visit_one(transformed_pd , extract_terminals )) %> %
32
34
enrich_terminals(transformers $ use_raw_indention ) %> %
33
35
apply_ref_indention() %> %
34
36
set_regex_indention(
Original file line number Diff line number Diff line change @@ -188,12 +188,19 @@ context_towards_terminals <- function(pd_nested,
188
188
# ' @param pd_nested A nested parse table.
189
189
# ' @keywords internal
190
190
extract_terminals <- function (pd_nested ) {
191
- vec_rbind(
192
- !!! ifelse(pd_nested $ terminal | pd_nested $ is_cached ,
193
- split(pd_nested , seq_len(nrow(pd_nested ))),
194
- pd_nested $ child
195
- )
196
- )
191
+ terminal <- pd_nested $ terminal
192
+ is_cached <- pd_nested $ is_cached
193
+
194
+ child <- pd_nested $ child
195
+
196
+ for (i in seq_len(nrow(pd_nested ))) {
197
+ if (terminal [[i ]] || is_cached [[i ]]) {
198
+ child [[i ]] <- list (pd_nested [i , ])
199
+ }
200
+ }
201
+
202
+ # child is a list of data frame lists here
203
+ unlist(unname(child ), recursive = FALSE )
197
204
}
198
205
199
206
# ' Enrich flattened parse table
You can’t perform that action at this time.
0 commit comments