From ihaka@stat.auckland.ac.nz  Wed Jan  7 02:47:08 1998
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Wed, 7 Jan 1998 15:47:08 +1300 (NZDT)
Subject: Error in parse
In-Reply-To: <x24t3hkj2r.fsf@blueberry.kubism.ku.dk>
References: <98Jan5.172327est.13453@mailgate.bank-banque-canada.ca>
 <x24t3hkj2r.fsf@blueberry.kubism.ku.dk>
Message-ID: <199801070247.PAA12670@stat1.stat.auckland.ac.nz>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Error in parse
Ross Ihaka