mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Postgres95 1.01 Distribution - Virgin Sources
This commit is contained in:
108
src/backend/bootstrap/bootscanner.l
Normal file
108
src/backend/bootstrap/bootscanner.l
Normal file
@ -0,0 +1,108 @@
|
||||
%{
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* bootscanner.lex--
|
||||
* a lexical scanner for the bootstrap parser
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.1.1.1 1996/07/09 06:21:14 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "bootstrap/bootstrap.h"
|
||||
#include "utils/portal.h"
|
||||
#include "access/xact.h"
|
||||
#include "parser/scansup.h"
|
||||
|
||||
#include "bootstrap_tokens.h"
|
||||
|
||||
/* some versions of lex define this as a macro */
|
||||
#if defined(yywrap)
|
||||
#undef yywrap
|
||||
#endif /* yywrap */
|
||||
|
||||
YYSTYPE yylval;
|
||||
int yyline; /* keep track of the line number for error reporting */
|
||||
|
||||
%}
|
||||
|
||||
D [0-9]
|
||||
oct \\{D}{D}{D}
|
||||
Exp [Ee][-+]?{D}+
|
||||
id ([A-Za-z0-9_]|{oct}|\-)+
|
||||
sid \"([^\"])*\"
|
||||
arrayid [A-Za-z0-9_]+\[{D}*\]
|
||||
|
||||
%%
|
||||
|
||||
open { return(OPEN); }
|
||||
|
||||
close { return(XCLOSE); }
|
||||
|
||||
create { return(XCREATE); }
|
||||
|
||||
OID { return(OBJ_ID); }
|
||||
bootstrap { return(XBOOTSTRAP); }
|
||||
_null_ { return(NULLVAL); }
|
||||
|
||||
insert { return(INSERT_TUPLE); }
|
||||
|
||||
"," { return(COMMA); }
|
||||
"=" { return(EQUALS); }
|
||||
"(" { return(LPAREN); }
|
||||
")" { return(RPAREN); }
|
||||
|
||||
[\n] { yyline++; }
|
||||
[\t] ;
|
||||
" " ;
|
||||
|
||||
^\#[^\n]* ; /* drop everything after "#" for comments */
|
||||
|
||||
|
||||
"declare" { return(XDECLARE); }
|
||||
"build" { return(XBUILD); }
|
||||
"indices" { return(INDICES); }
|
||||
"index" { return(INDEX); }
|
||||
"on" { return(ON); }
|
||||
"using" { return(USING); }
|
||||
{arrayid} {
|
||||
yylval.ival = EnterString(MapArrayTypeName((char*)yytext));
|
||||
return(ID);
|
||||
}
|
||||
{id} {
|
||||
yylval.ival = EnterString(scanstr((char*)yytext));
|
||||
return(ID);
|
||||
}
|
||||
{sid} {
|
||||
yylval.ival = EnterString(scanstr((char*)yytext));
|
||||
return(ID);
|
||||
}
|
||||
|
||||
(-)?{D}+"."{D}*({Exp})? |
|
||||
(-)?{D}*"."{D}+({Exp})? |
|
||||
(-)?{D}+{Exp} {
|
||||
yylval.ival = EnterString((char*)yytext);
|
||||
return(CONST);
|
||||
}
|
||||
|
||||
. {
|
||||
printf("syntax error %d : -> %s\n", yyline, yytext);
|
||||
}
|
||||
|
||||
|
||||
|
||||
%%
|
||||
|
||||
yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
yyerror(str)
|
||||
char *str;
|
||||
{
|
||||
fprintf(stderr,"\tsyntax error %d : %s",yyline, str);
|
||||
}
|
Reference in New Issue
Block a user