File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -303,6 +303,7 @@ CurScanPosition(void)
303
303
#endif /* !defined(FLEX_SCANNER) */
304
304
305
305
#ifdef FLEX_SCANNER
306
+ static bool end_of_buf = false ;
306
307
/* input routine for flex to read input from a string instead of a file */
307
308
int
308
309
myinput (char * buf, int max)
@@ -320,17 +321,28 @@ myinput(char* buf, int max)
320
321
memcpy (buf, parseString, copylen);
321
322
buf[copylen] = ' \0 ' ;
322
323
parseCh = parseString;
324
+ end_of_buf = false ;
323
325
return copylen;
324
326
}
325
327
else
328
+ {
329
+ end_of_buf = true ;
326
330
return 0 ; /* end of string */
331
+ }
327
332
}
328
333
329
334
int
330
335
CurScanPosition (void )
331
336
{
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);
334
346
}
335
347
336
348
#endif /* FLEX_SCANNER */
You can’t perform that action at this time.
0 commit comments