R/whitespace.R

Defines functions whitespace

Documented in whitespace

#do not edit, edit noweb/qmrparser.nw
whitespace <- function(action = function(s) list(type="white",value=s),
                       error  = function(p) list(type="white",pos  =p) ) 
  
  function (stream) {
    
    cstream <- streamParserNextChar(stream)
    
    if ( cstream$status == "eof" || ! isWhitespace(cstream$char) ) return(list(status="ok",node=action(""),stream=stream)) 
    
    s <- cstream$char
    repeat {
      stream  <- cstream$stream
      cstream <- streamParserNextCharSeq(stream) 
      
      if (  cstream$status == "eof" || ! isWhitespace(cstream$char)  ) return(list(status="ok",node=action(paste(s,collapse="")),stream=stream)) 
      
      s      <- c(s,cstream$char)
    }
  }

Try the qmrparser package in your browser

Any scripts or data that you put into this service are public.

qmrparser documentation built on April 24, 2022, 1:05 a.m.