R/numberInteger.R

Defines functions numberInteger

Documented in numberInteger

#do not edit, edit noweb/qmrparser.nw
numberInteger <- function(action = function(s) list(type="numberInteger",value=s), 
                          error = function(p) list(type="numberInteger",pos  =p))
  
  function (stream) {
    cstream <- streamParserNextChar(stream)
    
    if ( cstream$status == "eof" )   return(list(status="fail",node=error(streamParserPosition(stream)),stream=stream))
    
    if ( cstream$char %in% c("+","-") ) {
      s        <- cstream$char
      cstream  <- numberNatural()(cstream$stream) 
    }
    else {
      s       <- ""
      cstream <- numberNatural()(stream) 
    }   
    if ( cstream$status == "fail" )   return(list(status="fail",node=error(streamParserPosition(stream)),stream=stream))
    return(list(status="ok",node=action(paste(s,cstream$node$value,sep="")),stream=cstream$stream)) 
    
  }     

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.