Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group