[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preventing Float 1.2e3.4



Hi Evan,

Evan Easton wrote:
> Is there a way in the grammar to prevent a a variant 2 floating point from
> following the variant 1, 2, or 3 float with exponent without putting a space
> between them?

Have you tried adding an "error" token:

error =
  digit+ '.' digit* exponent_part '.' |
        '.' digit+ exponent_part '.' |
        digit+ exponent_part '.';

Please let us know if it works.

Etienne
-- 
----------------------------------------------------------------------
Etienne M. Gagnon, M.Sc.                     e-mail: egagnon@j-meg.com
Author of SableCC:                             http://www.sablecc.org/
and SableVM:                                   http://www.sablevm.org/