| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
| Cc: | PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
| Subject: | Re: Lexer patch question |
| Date: | 2005-06-15 17:31:24 |
| Message-ID: | 4411.1118856684@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-patches |
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> I am confused why the following change Tom made to scan.l works.
> Isn't that 'x' required so xqescape doesn't match '\x'?
> *** scan.l 2 Jun 2005 01:23:08 -0000 1.123
> --- scan.l 2 Jun 2005 17:45:17 -0000 1.124
> ***************
> *** 193,199 ****
> xqstart {quote}
> xqdouble {quote}{quote}
> xqinside [^\\']+
> ! xqescape [\\][^0-7x]
> xqoctesc [\\][0-7]{1,3}
> xqhexesc [\\]x[0-9A-Fa-f]{1,2}
> --- 193,199 ----
> xqstart {quote}
> xqdouble {quote}{quote}
> xqinside [^\\']+
> ! xqescape [\\][^0-7]
> xqoctesc [\\][0-7]{1,3}
> xqhexesc [\\]x[0-9A-Fa-f]{1,2}
No; if a match to xqhexesc is possible, the lexer will prefer that match
because it is longer. If a match to xqhexesc is not possible --- that
is, we have \x not followed by a hex digit --- then we *want* xqescape
to match. The original coding forced a backup to the <xq>. rule in this
situation, which is not how we want it to behave.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2005-06-15 17:36:22 | Re: Lexer patch question |
| Previous Message | Bruce Momjian | 2005-06-15 17:25:58 | Lexer patch question |