@@ -62,15 +62,15 @@ Pattern <- setRefClass( "Pattern"
6262 counts <- table(nms )
6363 for (e in child ){
6464 if (isTRUE(unname(counts [as.character(e )] > 1 ))){
65- if (class( e ) == " Argument" || (class( e ) == " Option" && e $ argcount > 0 )){
65+ if (inherits( e , " Argument" ) || (inherits( e , " Option" ) && e $ argcount > 0 )){
6666 if (is.null(e $ value )){
6767 e $ value <- list ()
68- } else if (class (e $ value ) != " list" ){
68+ } else if (! inherits (e $ value , " list" ) ){
6969 e $ value <- as.list(e $ value )
7070 }
7171 }
72- if ( class( e ) == " Command"
73- || (class( e ) == " Option" && e $ argcount == 0 )){
72+ if ( inherits( e , " Command" )
73+ || (inherits( e , " Option" ) && e $ argcount == 0 )){
7474 e $ value <- 0L
7575 }
7676 }
@@ -100,12 +100,12 @@ Pattern <- setRefClass( "Pattern"
100100 idx <- which(m > 0L )[1 ]
101101 child <- .children [[idx ]]
102102 .children <- .children [- idx ]
103- if (class (child ) == " Either" ){
103+ if (inherits (child , " Either" ) ){
104104 for (ci in child $ children ){
105105 group <- c(ci , .children )
106106 groups [[length(groups )+ 1 ]] <- group
107107 }
108- } else if (class (child ) == " OneOrMore" ){
108+ } else if (inherits (child , " OneOrMore" ) ){
109109 group <- c(child $ children , child $ children , .children )
110110 groups [[length(groups )+ 1 ]] <- group
111111 } else {
@@ -242,7 +242,7 @@ Argument <- setRefClass("Argument", contains="Pattern"
242242 return (matched(TRUE , left , collected ))
243243 }
244244 same_name <- Filter(function (a ){
245- class( a ) == " Argument" && identical(a $ name(), name())
245+ inherits( a , " Argument" ) && identical(a $ name(), name())
246246 }
247247 , collected )
248248 if (length(same_name )){
0 commit comments