Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c001f0

Browse files
committed
CHECK/DEFAULT syntax (some tricks to get current scan position).
1 parent4527172 commit0c001f0

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

‎src/backend/parser/scan.l

Lines changed: 18 additions & 9 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.13 1997/06/29 17:29:14 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.14 1997/08/20 01:50:06 vadim Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -36,6 +36,10 @@
3636
externchar *parseString;
3737
externchar *parseCh;
3838

39+
intCurScanPosition(void);
40+
int DefaultStartPosition;
41+
int CheckStartPosition;
42+
3943
/* some versions of lex define this as a macro*/
4044
#if defined(yywrap)
4145
#undef yywrap
@@ -173,6 +177,10 @@ other.
173177

174178
keyword =ScanKeywordLookup((char*)yytext);
175179
if (keyword !=NULL) {
180+
if ( keyword->value == DEFAULT )
181+
DefaultStartPosition =CurScanPosition () + yyleng +1;
182+
elseif ( keyword->value == CHECK )
183+
CheckStartPosition =CurScanPosition () + yyleng +1;
176184
return (keyword->value);
177185
}else {
178186
yylval.str =pstrdup((char*)yytext);
@@ -240,6 +248,12 @@ unput(char c)
240248
*--parseCh = c;
241249
}
242250
}
251+
252+
int
253+
CurScanPosition(void)
254+
{
255+
return (parseCh - parseString - yyleng -1);
256+
}
243257
#endif/* !defined(FLEX_SCANNER) */
244258

245259
#ifdef FLEX_SCANNER
@@ -265,16 +279,11 @@ myinput(char* buf, int max)
265279
}
266280
}
267281

268-
#ifdef NOT_USED
269-
char*
270-
CurScan(void)
282+
int
283+
CurScanPosition(void)
271284
{
272-
/*
273-
return (InputFrag ? InputFrag : parseCh) +
274-
(yy_c_buf_p - &yy_current_buffer->yy_ch_buf[yy_n_chars]);
275-
*/
285+
return (yy_c_buf_p - yy_current_buffer->yy_ch_buf - yyleng);
276286
}
277-
#endif
278287

279288
#endif/* FLEX_SCANNER */
280289

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp