From ripley at stats.ox.ac.uk  Tue Jan 25 08:22:12 2011
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 25 Jan 2011 07:22:12 +0000 (GMT)
Subject: [Rd] Possible bug in R parser
In-Reply-To: <AANLkTimQVCHSFXHRaLtJXY_NpTxRHsZcdyNQ9h+UT4jA@mail.gmail.com>
References: <AANLkTimQVCHSFXHRaLtJXY_NpTxRHsZcdyNQ9h+UT4jA@mail.gmail.com>
Message-ID: <alpine.LFD.2.00.1101250650220.27617@gannet.stats.ox.ac.uk>

On Mon, 24 Jan 2011, Olaf Mersmann wrote:

> Dear R developers,
>
> A recent typo led me to discover, that R is happy to accept
>
>  > 20x2
>  [1] 20
>
> as input. This appears to be related to the parsing of hexadecimal
> constants, since there must be a zero before the 'x' (i.e. 2x2 or
> 02x02 gives the expected error). All this is under R 2.12.1 on both OS
> X and Linux. Is this expected behavior?

Only 'expected' in so far as we don't expect the parser to always 
detect incorrect numeric constants (since we've seen other instances, 
and it does not use a grammar for numeric constants).

I'll change the rules to detect this one -- thanks for the report and 
example.

> Cheers,
> Olaf Mersmann

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Possible bug in R parser
Prof Brian Ripley