Resend...
On 9/26/09, Tom Lane <[email protected]> wrote:
> Marko Kreen <[email protected]> writes:
> > On 9/26/09, Peter Eisentraut <[email protected]> wrote:
>
> >> That patch results in the following message from flex:
> >>
> >> psqlscan.l:1039: warning, -s option given but default rule can be
> >> matched
>
> > Agh. Well, that just means the <xeu> state must be commented out:
>
> > -%x xeu
> > +/* %x xeu */
>
>
> Ick --- that breaks the whole concept of keeping the two sets of
> flex rules in sync. And it's quite unclear why it fixes the problem,
> too. At the very least, if you do it that way, it needs a comment
> explaining exactly why it's different from the backend.
The commenting-out fixes the problem, because I copy pasted the state
declaration without any rules in it.
Anyway, now I attached a patch, where I filled the section but without
referring it from anywhere. The rules itself are now equal. Is that OK?
--
marko
diff --git a/src/bin/psql/psqlscan.l b/src/bin/psql/psqlscan.l
index 7f08da2..8309577 100644
--- a/src/bin/psql/psqlscan.l
+++ b/src/bin/psql/psqlscan.l
@@ -158,6 +158,7 @@ static void emit(const char *txt, int len);
* <xdolq> $foo$ quoted strings
* <xui> quoted identifier with Unicode escapes
* <xus> quoted string with Unicode escapes
+ * <xeu> Unicode surrogate pair in extended quoted string.
*/
%x xb
@@ -169,6 +170,7 @@ static void emit(const char *txt, int len);
%x xdolq
%x xui
%x xus
+%x xeu
/* Additional exclusive states for psql only: lex backslash commands */
%x xslashcmd
%x xslasharg
@@ -253,6 +255,8 @@ xeinside [^\\']+
xeescape [\\][^0-7]
xeoctesc [\\][0-7]{1,3}
xehexesc [\\]x[0-9A-Fa-f]{1,2}
+xeunicode [\\](u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})
+xeunicodefail [\\](u[0-9A-Fa-f]{0,3}|U[0-9A-Fa-f]{0,7})
/* Extended quote
* xqdouble implements embedded quote, ''''
@@ -511,6 +515,20 @@ other .
<xe>{xeinside} {
ECHO;
}
+<xe>{xeunicode} {
+ ECHO;
+ }
+<xeu>{xeunicode} {
+ ECHO;
+ }
+<xeu>. |
+<xeu>\n |
+<xeu><<EOF>> {
+ ECHO;
+ }
+<xe,xeu>{xeunicodefail} {
+ ECHO;
+ }
<xe>{xeescape} {
ECHO;
}
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers