33# ' Must be after dropping comments because the closing brace is only guaranteed
44# ' to be the last token in that case.
55# ' @inheritParams alignment_drop_comments
6- # ' @importFrom rlang seq2
76# ' @keywords internal
87alignment_ensure_no_closing_brace <- function (pd_by_line ,
98 last_line_droped_early ) {
@@ -28,7 +27,6 @@ alignment_ensure_no_closing_brace <- function(pd_by_line,
2827# ' @param pd_by_line A list, each element corresponding to a potentially
2928# ' incomplete parse table that represents all token from one line.
3029# ' @keywords internal
31- # ' @importFrom purrr map compact
3230alignment_drop_comments <- function (pd_by_line ) {
3331 map(pd_by_line , function (x ) {
3432 out <- x [x $ token != " COMMENT" , ]
@@ -107,7 +105,6 @@ alignment_ensure_trailing_comma <- function(pd_by_line) {
107105# ' Checks if all arguments of column 1 are named
108106# ' @param relevant_pd_by_line A list with parse tables of a multi-line call,
109107# ' excluding first and last column.
110- # ' @importFrom purrr map_lgl
111108# ' @keywords internal
112109alignment_col1_all_named <- function (relevant_pd_by_line ) {
113110 map_lgl(relevant_pd_by_line , function (x ) {
@@ -124,15 +121,13 @@ alignment_col1_all_named <- function(relevant_pd_by_line) {
124121# ' Serialize all lines for a given column
125122# ' @param column The index of the column to serialize.
126123# ' @inheritParams alignment_col1_all_named
127- # ' @importFrom purrr map
128124# ' @keywords internal
129125alignment_serialize_column <- function (relevant_pd_by_line , column ) {
130126 map(relevant_pd_by_line , alignment_serialize_line , column = column )
131127}
132128
133129# ' Serialize one line for a column
134130# '
135- # '
136131# ' @inheritParams alignment_serialize_column
137132# ' @inheritParams alignment_col1_all_named
138133# ' @keywords internal
@@ -147,7 +142,7 @@ alignment_serialize_line <- function(relevant_pd_by_line, column) {
147142 # line does not have values at that column
148143 return (NULL )
149144 }
150- between_commas <- seq2(max(1 , comma_idx [column - 1L ]), comma_idx [column ])
145+ between_commas <- seq2(max(1L , comma_idx [column - 1L ]), comma_idx [column ])
151146 relevant_pd_by_line <- relevant_pd_by_line [between_commas , ]
152147 alignment_serialize(relevant_pd_by_line )
153148}
@@ -178,7 +173,7 @@ alignment_serialize <- function(pd_sub) {
178173# ' At least one space after comma, none before, for all but the last comma on
179174# ' the line
180175# ' @param pd_sub The subset of a parse table corresponding to one line.
181- # ' @importFrom rlang seq2
176+ # '
182177# ' @keywords internal
183178alignment_has_correct_spacing_around_comma <- function (pd_sub ) {
184179 comma_tokens <- which(pd_sub $ token == " ','" )
@@ -196,14 +191,13 @@ alignment_has_correct_spacing_around_comma <- function(pd_sub) {
196191# ' At least one space around `EQ_SUB`
197192# ' @inheritParams alignment_has_correct_spacing_around_comma
198193# ' @keywords internal
199- # ' @importFrom rlang seq2
200194alignment_has_correct_spacing_around_eq_sub <- function (pd_sub ) {
201195 relevant_eq_sub_token <- which(pd_sub $ token == " EQ_SUB" )
202196 if (length(relevant_eq_sub_token ) == 0L ) {
203197 return (TRUE )
204198 }
205199
206- correct_spaces_before <- pd_sub $ .lag_spaces [relevant_eq_sub_token ] > = 1
207- correct_spaces_after <- pd_sub $ spaces [relevant_eq_sub_token ] > = 1
200+ correct_spaces_before <- pd_sub $ .lag_spaces [relevant_eq_sub_token ] > = 1L
201+ correct_spaces_after <- pd_sub $ spaces [relevant_eq_sub_token ] > = 1L
208202 all(correct_spaces_before ) && all(correct_spaces_after )
209203}
0 commit comments