Displaying 2 results from an estimated 2 matches for "xxungetc".
Did you mean:
ungetc
2004 Sep 10
1
Multi-line string constants: proposed patch
...proposed patch.
In the files src/main/gram.y and src/main/gram.c strings
are parsed with the StringValue function. Looking at the function it is
clear that a newline character (not the two-byte '\n') generates an error:
static int StringValue(int c)
{
...
if (c == '\n') {
xxungetc(c);
return ERROR;
}
...
}
I tracked this code down and Mark Bravington confirmed (by building r-devel
on Windows) that commenting out the four lines that start with
if (c == '\n')
will allow R to handle multi-line strings either with or without backslashes
for continuation. A ...
2004 Sep 16
0
FW: Parsing multi-line strings. Bug? Feature?
...appear to be completely unresponsive because all input is being eaten
> by the string readers.
I think the following patch in StringValue might address Peter Dalgaard's point: when a bare newline is found (i.e. not preceded by a backslash), it's pushed back onto the character stack via xxungetc(c) and StringValue pretends that it's just read a backslash instead. Then, as usual, it looks for the next character which is of course a newline, and proceeds as normal.
Output is from diff gram.c on R-devel from 7/9/2004. I hope the comments look sufficiently standard now (I'm not a C pr...