streamParserFromString {qmrparser} | R Documentation |
Creates a streamParser from a string
Description
Creates a list of functions which allow streamParser manipulation (when defined from a character string)
Usage
streamParserFromString(string)
Arguments
string |
string to be recognised |
Details
See streamParser
Value
A list of four functions which allow stream manipulation:
streamParserNextChar |
Functions which takes a streamParser as argument ant returns a |
streamParserNextCharSeq |
Function which takes a streamParser as argument and returns a |
streamParserPosition |
Function which takes a streamParser as argument and returns position of next character to be read |
streamParserClose |
Function which closes the stream |
Examples
# reads one character
streamParserNextChar(streamParserFromString("\U00B6"))
# reads a string
stream <- streamParserFromString("Hello world")
cstream <- streamParserNextChar(stream)
while( cstream$status == "ok" ) {
print(streamParserPosition(cstream$stream))
print(cstream$char)
cstream <- streamParserNextCharSeq(cstream$stream)
streamParserClose(stream)
}
[Package qmrparser version 0.1.6 Index]