Commit 0c001f08 authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

CHECK/DEFAULT syntax (some tricks to get current scan position).

parent 4527172b
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.13 1997/06/29 17:29:14 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.14 1997/08/20 01:50:06 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
extern char *parseString; extern char *parseString;
extern char *parseCh; extern char *parseCh;
int CurScanPosition(void);
int DefaultStartPosition;
int CheckStartPosition;
/* some versions of lex define this as a macro */ /* some versions of lex define this as a macro */
#if defined(yywrap) #if defined(yywrap)
#undef yywrap #undef yywrap
...@@ -173,6 +177,10 @@ other . ...@@ -173,6 +177,10 @@ other .
keyword = ScanKeywordLookup((char*)yytext); keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) { if (keyword != NULL) {
if ( keyword->value == DEFAULT )
DefaultStartPosition = CurScanPosition () + yyleng + 1;
else if ( keyword->value == CHECK )
CheckStartPosition = CurScanPosition () + yyleng + 1;
return (keyword->value); return (keyword->value);
} else { } else {
yylval.str = pstrdup((char*)yytext); yylval.str = pstrdup((char*)yytext);
...@@ -240,6 +248,12 @@ unput(char c) ...@@ -240,6 +248,12 @@ unput(char c)
*--parseCh = c; *--parseCh = c;
} }
} }
int
CurScanPosition(void)
{
return (parseCh - parseString - yyleng - 1);
}
#endif /* !defined(FLEX_SCANNER) */ #endif /* !defined(FLEX_SCANNER) */
#ifdef FLEX_SCANNER #ifdef FLEX_SCANNER
...@@ -265,16 +279,11 @@ myinput(char* buf, int max) ...@@ -265,16 +279,11 @@ myinput(char* buf, int max)
} }
} }
#ifdef NOT_USED int
char* CurScanPosition(void)
CurScan(void)
{ {
/* return (yy_c_buf_p - yy_current_buffer->yy_ch_buf - yyleng);
return (InputFrag ? InputFrag : parseCh) +
(yy_c_buf_p - &yy_current_buffer->yy_ch_buf[yy_n_chars]);
*/
} }
#endif
#endif /* FLEX_SCANNER */ #endif /* FLEX_SCANNER */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment