PostgreSQL Source Code: src/interfaces/ecpg/preproc/parser.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

23

25#include "preproc.h"

26

27

33

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56int

58{

59 int cur_token;

63 char *cur_yytext;

64

65

67 {

73 }

74 else

76

77

78

79

80 switch (cur_token)

81 {

82 case FORMAT:

83 case NOT:

84 case NULLS_P:

85 case WITH:

86 case WITHOUT:

87 case UIDENT:

88 case USCONST:

89 break;

90 default:

91 return cur_token;

92 }

93

94

96 cur_yylloc = base_yylloc;

98

99

101

106

108 base_yylloc = cur_yylloc;

110

112

113

114 switch (cur_token)

115 {

116 case FORMAT:

117

119 {

120 case JSON:

121 cur_token = FORMAT_LA;

122 break;

123 }

124 break;

125

126 case NOT:

127

129 {

130 case BETWEEN:

131 case IN_P:

132 case LIKE:

133 case ILIKE:

134 case SIMILAR:

135 cur_token = NOT_LA;

136 break;

137 }

138 break;

139

140 case NULLS_P:

141

143 {

144 case FIRST_P:

145 case LAST_P:

146 cur_token = NULLS_LA;

147 break;

148 }

149 break;

150

151 case WITH:

152

154 {

155 case TIME:

156 case ORDINALITY:

157 cur_token = WITH_LA;

158 break;

159 }

160 break;

161

162 case WITHOUT:

163

165 {

166 case TIME:

167 cur_token = WITHOUT_LA;

168 break;

169 }

170 break;

171 case UIDENT:

172 case USCONST:

173

175 {

176

177 const char *escstr;

178

179

180

181

182

184 cur_yylloc = base_yylloc;

186

187

189

192

193

194

195

196

200

202 base_yylloc = cur_yylloc;

204

205

207 " UESCAPE ",

208 escstr);

210

211

213 }

214

215 if (cur_token == UIDENT)

216 cur_token = IDENT;

217 else if (cur_token == USCONST)

218 cur_token = SCONST;

219 break;

220 }

221

222 return cur_token;

223}

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238static int

240{

242

244 {

245

246 case Op:

247 case CSTRING:

248 case CPP_LINE:

249 case CVARIABLE:

250 case BCONST:

251 case SCONST:

252 case USCONST:

253 case XCONST:

254 case FCONST:

255 case IDENT:

256 case UIDENT:

257 case IP:

258

260 break;

261 default:

262

264

265 for (unsigned char *ptr = (unsigned char *) base_yylloc; *ptr; ptr++)

266 {

267 if (*ptr >= 'A' && *ptr <= 'Z')

268 *ptr += 'a' - 'A';

269 }

270 break;

271 }

273}

274

275

276

277

278

279

280

281static bool

283{

284 if (isxdigit(escape)

285 || escape == '+'

286 || escape == '\''

287 || escape == '"'

289 return false;

290 else

291 return true;

292}

293

294

295

296

297static bool

299{

300 if (ch == ' ' ||

301 ch == '\t' ||

302 ch == '\n' ||

303 ch == '\r' ||

304 ch == '\f')

305 return true;

306 return false;

307}

int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)

static bool next_token(char **lineptr, StringInfo buf, bool *initial_quote, bool *terminating_comma)

static YYLTYPE lookahead_yylloc

static int base_yylex_location(void)

static bool have_lookahead

static int lookahead_token

static YYSTYPE lookahead_yylval

static bool ecpg_isspace(char ch)

static char * lookahead_yytext

int filtered_base_yylex(void)

static bool check_uescapechar(unsigned char escape)

void mmerror(int error_code, enum errortype type, const char *error,...) pg_attribute_printf(3

char * make3_str(const char *str1, const char *str2, const char *str3)

char * loc_strdup(const char *string)