| charParser {qmrparser} | R Documentation | 
Specific single character token.
Description
Recognises a specific single character.
Usage
  
  charParser(char,
            action = function(s) list(type="char",value=s), 
            error  = function(p) list(type="char",pos  =p)) 
Arguments
char | 
 character to be recognised  | 
action | 
 Function to be executed if recognition succeeds. Character stream making up the token is passed as parameter to this function  | 
error | 
 Function to be executed if recognition does not succeed. Position of   | 
Value
Anonymous function, returning a list.
function(stream) –>   list(status,node,stream) 
From input parameters, an anonymous function is defined. This function admits just one parameter, stream, with type streamParser, and returns a three-field list:
status
"ok" or "fail"
node
With
actionorerrorfunction output, depending on the casestream
With information about the input, after success or failure in recognition
See Also
Examples
# fail
stream  <- streamParserFromString("H")
( charParser("a")(stream) )[c("status","node")]
# ok 
stream  <- streamParserFromString("a")
( charParser("a")(stream) )[c("status","node")]
# ok 
( charParser("\U00B6")(streamParserFromString("\U00B6")) )[c("status","node")]