http://d.puremagic.com/issues/show_bug.cgi?id=3854



--- Comment #8 from Ellery Newcomer <ellery-newco...@utulsa.edu> 2010-04-02 
09:50:23 PDT ---
(In reply to comment #7)
> > 
> > Eh? What makes you think it isn't?
> 
> Well, from what I can tell, if I were to have the following code excerpt:
> 
> int[] a = [1]];
> 
> The scan ahead routine will swallow the "[1]", and since (--brackets == 0),
> takes a peek at the last bracket, to which it matches in the if statement and
> says 'yep, that is OK'.
> In other words, it assumes that whether or not the above line is correct has
> already been checked, or will be checked later on during the compile (which I
> don't doubt it already has, but at least see it better to have some sort of
> sanitisation when checking things).

The scan ahead doesn't swallow anything. It does see only "[1]" and because
(--brackets == 0) it says "I'm going to parse this as ArrayInitializer", which
it does. The next loop (the ArrayInitializer rule) swallows "[1]", and no more.
Then parseInitializer is done. The function that called parseInitializer
(parseDeclarations or whatever), will expect a semicolon or comma to be the
next token, and when it sees lbracket, it errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to