1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Add support for \x hex strings in psql variables.

This commit is contained in:
Bruce Momjian
2005-06-02 01:23:48 +00:00
parent 65537ac1b4
commit b51366396b
2 changed files with 16 additions and 5 deletions

View File

@@ -33,7 +33,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.12 2005/05/30 16:48:47 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.13 2005/06/02 01:23:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -250,8 +250,9 @@ xnstart [nN]{quote}
xqstart {quote}
xqdouble {quote}{quote}
xqinside [^\\']+
xqescape [\\][^0-7]
xqescape [\\][^0-7x]
xqoctesc [\\][0-7]{1,3}
xqhexesc [\\]x[0-9A-Fa-f]{1,2}
/* $foo$ style quotes ("dollar quoting")
* The quoted string starts with $foo$ where "foo" is an optional string
@@ -467,6 +468,9 @@ other .
<xq>{xqoctesc} {
ECHO;
}
<xq>{xqhexesc} {
ECHO;
}
<xq>{quotecontinue} {
ECHO;
}
@@ -855,6 +859,12 @@ other .
(char) strtol(yytext + 1, NULL, 8));
}
{xqhexesc} {
/* hex case */
appendPQExpBufferChar(output_buf,
(char) strtol(yytext + 2, NULL, 16));
}
"\\". { emit(yytext + 1, 1); }
{other}|\n { ECHO; }