On 9/26/09, Tom Lane <[email protected]> wrote:
> Maybe it doesn't "need" to know, but I think it would be disastrous from
> a maintenance standpoint to not keep the two sets of flex rules in
> strict correspondence. It would soon become unclear whether or how to
> apply changes in the backend lexer to psql.
Patch attached.
--
marko
diff --git a/src/bin/psql/psqlscan.l b/src/bin/psql/psqlscan.l
index 7f08da2..cb85658 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,12 @@ other .
<xe>{xeinside} {
ECHO;
}
+<xe>{xeunicode} {
+ ECHO;
+ }
+<xe>{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