Re: scan.l simplifications

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: scan.l simplifications
Date: 2001-01-29 15:03:40
Message-ID: 24381.980780620@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Robert B. Easter" <reaster(at)comptechnews(dot)com> writes:
> In scan.l, there is:
> decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*))
> real
> ((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+))

> Could this be simplified as:

> decimal (({integer}?\.{integer})|({integer}\.{integer}?))
> real ((({decimal})|({integer}))([Ee][-+]?{integer}))

I think it's better style as it stands. The latter might be fewer
characters but it's not easier to understand (IMHO anyway), because
you have to refer back to more nonterminals to decipher it, and said
nonterminals have meanings much more complicated than digit.

Also, as you noted, it'd link the definitions of integer/decimal/real
in ways that might cause trouble later.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2001-01-29 15:07:27 Security hole in PL/pgSQL
Previous Message Tom Lane 2001-01-29 14:48:21 Re: new version of contrib-intarray