On Wed, Jan 26, 2022 at 10:10 PM Peter Eisentraut <peter.eisentr...@enterprisedb.com> wrote: > [v8 patch]
0001-0004 seem pretty straightforward. 0005: {realfail1} { - /* - * throw back the [Ee], and figure out whether what - * remains is an {integer} or {decimal}. - */ - yyless(yyleng - 1); SET_YYLLOC(); - return process_integer_literal(yytext, yylval); + yyerror("trailing junk after numeric literal"); } realfail1 has been subsumed by integer_junk and decimal_junk, so that pattern can be removed. <SQL>{ +/* + * Note that some trailing junk is valid in C (such as 100LL), so we contain + * this to SQL mode. + */ It seems Flex doesn't like C comments after the "%%", so this stanza was indented in 0006. If these are to be committed separately, that fix should happen here. 0006: Minor nit -- the s/decimal/numeric/ change doesn't seem to have any notational advantage, but it's not worse, either. 0007: I've attached an addendum to restore the no-backtrack property. Will the underscore syntax need treatment in the input routines as well? -- John Naylor EDB: http://www.enterprisedb.com
diff --git a/src/backend/parser/Makefile b/src/backend/parser/Makefile index 827bc4c189..5ddb9a92f0 100644 --- a/src/backend/parser/Makefile +++ b/src/backend/parser/Makefile @@ -56,7 +56,7 @@ gram.c: BISON_CHECK_CMD = $(PERL) $(srcdir)/check_keywords.pl $< $(top_srcdir)/s scan.c: FLEXFLAGS = -CF -p -p -#scan.c: FLEX_NO_BACKUP=yes +scan.c: FLEX_NO_BACKUP=yes scan.c: FLEX_FIX_WARNING=yes diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index 5b574c4233..3b311ac2dd 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -400,9 +400,9 @@ hexinteger 0[xX](_?{hexdigit})+ octinteger 0[oO](_?{octdigit})+ bininteger 0[bB](_?{bindigit})+ -hexfail 0[xX] -octfail 0[oO] -binfail 0[bB] +hexfail 0[xX]_? +octfail 0[oO]_? +binfail 0[bB]_? numeric (({decinteger}\.{decinteger}?)|(\.{decinteger})) numericfail {decdigit}+\.\.