Error in parse

Ross Ihaka ihaka@stat.auckland.ac.nz
Wed, 7 Jan 1998 15:47:08 +1300 (NZDT)


Peter Dalgaard writes:
 > Paul Gilbert <pgilbert@bank-banque-canada.ca> writes:
 > 
 > > Error in parse(file, n, text, prompt) : syntax error on line 23

 > 1) There's a bug in the readahead logic (this essentially works by
 > counting if's, else's, braces and newlines, so it would be no wonder
 > if your code tickled it)


Got it in one (1?).  The problem is that '}', ')' and ']' should each
terminate ALL preceding if clauses.  Here is the fix ...

At the very bottom of gram.y in yylex, there are case statements of
the form:

        case ']':
                ifpop();
		...
 
        case RBRACE:
                ifpop();
		...

        case ')':
                ifpop();
		...

These should read

        case ']':
		while(*contextp == 'i')
			ifpop();
		...
 
        case RBRACE:
		while(*contextp == 'i')
			ifpop();
		...

        case ')':
                while(*contextp == 'i')
                        ifpop();

This seems to make Paul's example work.  I will commit this in a minute.

	Ross
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._