1 /*-------------------------------------------------------------------------
4 * support routines for the lex/flex scanner, used by both the normal
5 * backend as well as the bootstrap backend
7 * Copyright (c) 1994, Regents of the University of California
11 * $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.11 1999/02/07 23:59:59 tgl Exp $
13 *-------------------------------------------------------------------------
22 #include "miscadmin.h"
23 #include "parser/scansup.h"
24 #include "utils/elog.h"
29 * if the string passed in has escaped codes, map the escape codes to actual
32 * the string returned is a pointer to static storage and should NOT
33 * be freed by the caller.
40 static char newStr[MAX_PARSE_BUFFER];
45 if (s == NULL || s[0] == '\0')
50 for (i = 0, j = 0; i < len; i++)
54 /* Note: if scanner is working right, unescaped quotes can only
55 * appear in pairs, so there should be another character.
60 else if (s[i] == '\\')
93 s[i + k] >= '0' && s[i + k] <= '7' && k < 3;
95 octVal = (octVal << 3) + (s[i + k] - '0');
97 newStr[j] = ((char) octVal);