Skip to content

Commit 4379ce8

Browse files
committed
Quick hack to get CHECK working for incoming betta.
1 parent 4587547 commit 4379ce8

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/backend/parser/scan.l

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.19 1997/09/08 03:20:04 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.20 1997/09/12 09:01:46 vadim Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -303,6 +303,7 @@ CurScanPosition(void)
303303
#endif /* !defined(FLEX_SCANNER) */
304304

305305
#ifdef FLEX_SCANNER
306+
static bool end_of_buf = false;
306307
/* input routine for flex to read input from a string instead of a file */
307308
int
308309
myinput(char* buf, int max)
@@ -320,17 +321,28 @@ myinput(char* buf, int max)
320321
memcpy(buf, parseString, copylen);
321322
buf[copylen] = '\0';
322323
parseCh = parseString;
324+
end_of_buf = false;
323325
return copylen;
324326
}
325327
else
328+
{
329+
end_of_buf = true;
326330
return 0; /* end of string */
331+
}
327332
}
328333

329334
int
330335
CurScanPosition(void)
331336
{
332-
printf( "current position is %d\n", yy_c_buf_p - yy_current_buffer->yy_ch_buf - yyleng);
333-
return (yy_c_buf_p - yy_current_buffer->yy_ch_buf - yyleng);
337+
int spos;
338+
339+
if ( end_of_buf )
340+
spos = strlen (parseString) - strlen (yytext);
341+
else
342+
spos = yy_c_buf_p - yy_current_buffer->yy_ch_buf - yyleng;
343+
344+
printf( "current position is %d\n", spos);
345+
return (spos);
334346
}
335347

336348
#endif /* FLEX_SCANNER */

0 commit comments

Comments
 (0)