streamParser: Generic interface for character processing, allowing forward...

Description Usage Arguments Details Value See Also Examples

Description

Generic interface for character processing. It allows going forward sequentially or backwards to a previous arbitrary position.

Each one of these functions performs an operation on or obtains information from a character sequence (stream).

Usage

1
2
3
4

Arguments

stream

object containing information about the text to be processed and, specifically, about the next character to be read

Details

Value

streamParserNextChar and streamParserNextCharSeq

Three field list:

  • status

    "ok" or "eof"

  • char

    Character read (ok) or "" (eof)

  • stream

    With information about next character to be read or same position if end of file has been reached ("eof")

streamParserPosition

Three field list:

  • fileName File name or "" if the stream is not associated with a file name

  • line

    line number

  • linePos

    character to be read position within its line

  • streamPos

    character to be read position from the text beginning

streamParserClose

NULL

See Also

streamParserFromFileName streamParserFromString

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
stream<- streamParserFromString("Hello world")

cstream <- streamParserNextChar(stream)

while( cstream$status == "ok" ) {
    print(streamParserPosition(cstream$stream))
    print(cstream$char)
    cstream <- streamParserNextCharSeq(cstream$stream)
}

streamParserClose(stream)

qmrparser documentation built on May 2, 2019, 5:50 a.m.