Re: scan.l simplifications - Mailing list pgsql-hackers

From Tom Lane
Subject Re: scan.l simplifications
Date
Msg-id 24381.980780620@sss.pgh.pa.us
Whole thread Raw
In response to scan.l simplifications  ("Robert B. Easter" <reaster@comptechnews.com>)
List pgsql-hackers
"Robert B. Easter" <reaster@comptechnews.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


pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Security hole in PL/pgSQL
Next
From: Tom Lane
Date:
Subject: Re: Security hole in PL/pgSQL