PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00

142 lines
3.2 KiB
Plaintext

%{
/*-------------------------------------------------------------------------
*
* bootscanner.l
* a lexical scanner for the bootstrap parser
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.38 2004/12/31 21:59:34 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/attnum.h"
#include "access/htup.h"
#include "access/itup.h"
#include "access/skey.h"
#include "access/tupdesc.h"
#include "bootstrap/bootstrap.h"
#include "catalog/pg_am.h"
#include "catalog/pg_attribute.h"
#include "catalog/pg_class.h"
#include "nodes/nodes.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h"
#include "nodes/primnodes.h"
#include "parser/scansup.h"
#include "rewrite/prs2lock.h"
#include "storage/block.h"
#include "storage/fd.h"
#include "storage/itemptr.h"
#include "storage/off.h"
#include "utils/nabstime.h"
#include "utils/rel.h"
/* Not needed now that this file is compiled as part of bootparse. */
/* #include "bootstrap_tokens.h" */
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
static int yyline = 1; /* line number for error reporting */
%}
%option 8bit
%option never-interactive
%option nodefault
%option nounput
%option noyywrap
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); }
"shared_relation" { return(XSHARED_RELATION); }
"without_oids" { return(XWITHOUT_OIDS); }
_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); }
"unique" { return(UNIQUE); }
"index" { return(INDEX); }
"on" { return(ON); }
"using" { return(USING); }
{arrayid} {
yylval.ival = EnterString(MapArrayTypeName((char*)yytext));
return(ID);
}
{id} {
char *newid = scanstr((char*)yytext);
yylval.ival = EnterString(newid);
pfree(newid);
return(ID);
}
{sid} {
char *newid;
yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */
newid = scanstr((char*)yytext+1);
yylval.ival = EnterString(newid);
pfree(newid);
yytext[strlen(yytext)] = '"'; /* restore quotes */
return(ID);
}
(-)?{D}+"."{D}*({Exp})? |
(-)?{D}*"."{D}+({Exp})? |
(-)?{D}+{Exp} {
yylval.ival = EnterString((char*)yytext);
return(CONST_P);
}
. {
elog(ERROR, "syntax error at line %d: unexpected character \"%s\"", yyline, yytext);
}
%%
void
yyerror(const char *message)
{
elog(ERROR, "%s at line %d", message, yyline);
}