Reading whole lines whith GScanner




Hello.

I am trying to implement a simple parser using the GScanner functions.
The indata might contain lines like this one:

SYMBOL bla, bla ({ bla  , fo 123 /

And when SYMBOL is read, the remainder of the line should be treated as
single string, regardless of it's content. What I'm looking for is a
function like char *g_scanner_remainder_of_line(GScanner *scanner);

My question is:

Is is safe to use the following (pseudocode) to achieve this
functionality:

char *g_scanner_remainder_of_line(GScanner *scanner) 
{
	char *string =  read_to_eol(scanner->input_fd);
	scanner->line++;
	scanner->position = 0;
	return string;
}
 
Or will this corrupt the scanners internal state?

-Jens




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]