@@ -339,16 +339,15 @@ CombinedSelector <- R6Class("CombinedSelector",
339
339
# ### Parser
340
340
341
341
# foo
342
- el_re <- ' ^[ \t\r\n\f ]*([a-zA-Z]+)[ \t\r\n\f ]*$'
342
+ el_re <- " ^[ \t\r\n\f ]*([a-zA-Z]+)[ \t\r\n\f ]*$"
343
343
344
344
# foo#bar or #bar
345
- id_re <- ' ^[ \t\r\n\f ]*([a-zA-Z]*)#([a-zA-Z0-9_-]+)[ \t\r\n\f ]*$'
345
+ id_re <- " ^[ \t\r\n\f ]*([a-zA-Z]*)#([a-zA-Z0-9_-]+)[ \t\r\n\f ]*$"
346
346
347
347
# foo.bar or .bar
348
- class_re <- ' ^[ \t\r\n\f ]*([a-zA-Z]*)\\ .([a-zA-Z][a-zA-Z0-9_-]*)[ \t\r\n\f ]*$'
348
+ class_re <- " ^[ \t\r\n\f ]*([a-zA-Z]*)\\ .([a-zA-Z][a-zA-Z0-9_-]*)[ \t\r\n\f ]*$"
349
349
350
350
parse <- function (css ) {
351
- nc <- nchar(css )
352
351
el_match <- str_match(css , el_re )[1 , 2 ]
353
352
if (! is.na(el_match ))
354
353
return (list (Selector $ new(Element $ new(element = el_match ))))
@@ -430,7 +429,7 @@ parse_selector <- function(stream) {
430
429
} else {
431
430
# By exclusion, the last parse_simple_selector() ended
432
431
# at peek == ' '
433
- combinator <- ' '
432
+ combinator <- " "
434
433
}
435
434
stuff <- parse_simple_selector(stream )
436
435
pseudo_element <- stuff $ pseudo_element
@@ -537,7 +536,7 @@ parse_simple_selector <- function(stream, inside_negation = FALSE) {
537
536
while (TRUE ) {
538
537
nt <- stream $ nxt()
539
538
if (nt $ type %in% c(" IDENT" , " STRING" , " NUMBER" ) ||
540
- (token_equality(nt , " DELIM" , " +" ) ||
539
+ (token_equality(nt , " DELIM" , " +" ) ||
541
540
token_equality(nt , " DELIM" , " -" ))) {
542
541
arguments [[i ]] <- nt
543
542
i <- i + 1
@@ -663,7 +662,7 @@ parse_series <- function(tokens) {
663
662
return (c(0 , result ))
664
663
}
665
664
}
666
- ab <- str_split_fixed(s , " n" , 2 )[1 ,]
665
+ ab <- str_split_fixed(s , " n" , 2 )[1 , ]
667
666
a <- str_trim(ab [1 ])
668
667
b <- str_trim(ab [2 ])
669
668
@@ -726,20 +725,20 @@ compile_ <- function(pattern) {
726
725
}
727
726
}
728
727
729
- delims_2ch <- c(' ~= ' , ' |= ' , ' ^= ' , ' $= ' , ' *= ' , ' :: ' , ' != ' )
730
- delims_1ch <- c(' > ' , ' + ' , ' ~ ' , ' , ' , ' . ' , ' * ' , ' = ' , ' [ ' , ' ] ' , ' ( ' , ' ) ' , ' | ' , ' : ' , ' # ' )
728
+ delims_2ch <- c(" ~= " , " |= " , " ^= " , " $= " , " *= " , " :: " , " != " )
729
+ delims_1ch <- c(" > " , " + " , " ~ " , " , " , " . " , " * " , " = " , " [ " , " ] " , " ( " , " ) " , " | " , " : " , " # " )
731
730
delim_escapes <- paste0(" \\ " , delims_1ch , collapse = " |" )
732
- match_whitespace <- compile_(' [ \t\r\n\f ]+' )
733
- match_number <- compile_(' [+-]?(?:[0-9]*\\ .[0-9]+|[0-9]+)' )
731
+ match_whitespace <- compile_(" [ \t\r\n\f ]+" )
732
+ match_number <- compile_(" [+-]?(?:[0-9]*\\ .[0-9]+|[0-9]+)" )
734
733
match_hash <- compile_(paste0(" ^#([_a-zA-Z0-9-]|" , nonascii , " |\\\\ (?:" , delim_escapes , " ))+" ))
735
734
match_ident <- compile_(paste0(" ^([_a-zA-Z0-9-]|" , nonascii , " |\\\\ (?:" , delim_escapes , " ))+" ))
736
735
match_string_by_quote <- list (" '" = compile_(paste0(" ([^\n\r\f\\ ']|" , TokenMacros $ string_escape , " )*" )),
737
736
' "' = compile_(paste0(' ([^\n\r\f\\ "]|' , TokenMacros $ string_escape , " )*" )))
738
737
739
738
# Substitution for escaped chars
740
- sub_simple_escape <- function (x ) gsub(' \\\\ (.)' , " \\ 1" , x )
739
+ sub_simple_escape <- function (x ) gsub(" \\\\ (.)" , " \\ 1" , x )
741
740
sub_unicode_escape <- function (x ) gsub(TokenMacros $ unicode_escape , " \\ 1" , x , ignore.case = TRUE )
742
- sub_newline_escape <- function (x ) gsub(' \\\\ (?:\n |\r\n |\r |\f )' , " " , x )
741
+ sub_newline_escape <- function (x ) gsub(" \\\\ (?:\n |\r\n |\r |\f )" , " " , x )
743
742
744
743
tokenize <- function (s ) {
745
744
pos <- 1
0 commit comments