1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00
Files
postgres/src/backend/bootstrap/bootscanner.l
Bruce Momjian c0b01461db o note that now pg_database has a new attribuite "encoding" even
if MULTIBYTE is not enabled. So be sure to run initdb.

o these patches are made against the latest source tree (after
Bruce's massive patch, I think) BTW, I noticed that after running
regression, the oid field of pg_type seems disappeared.

	regression=> select oid from pg_type; ERROR:  attribute
	'oid' not found

this happens after the constraints test. This occures with/without
my patches. strange...

o pg_database_mb.h, pg_class_mb.h, pg_attribute_mb.h are no longer
used, and shoud be removed.

o GetDatabaseInfo() in utils/misc/database.c removed (actually in
#ifdef 0). seems nobody uses.

t-ishii@sra.co.jp
1998-08-24 01:14:24 +00:00

140 lines
2.8 KiB
Plaintext

%{
/*-------------------------------------------------------------------------
*
* 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.11 1998/08/24 01:13:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <time.h>
#include <string.h>
#include "postgres.h"
#include "storage/block.h"
#include "storage/off.h"
#include "storage/itemptr.h"
#include "catalog/pg_attribute.h"
#include "access/attnum.h"
#include "nodes/pg_list.h"
#include "access/tupdesc.h"
#include "access/itup.h"
#include "access/funcindex.h"
#include "storage/fd.h"
#include "catalog/pg_am.h"
#include "catalog/pg_class.h"
#include "nodes/nodes.h"
#include "rewrite/prs2lock.h"
#include "access/skey.h"
#include "access/strat.h"
#include "utils/rel.h"
#include "bootstrap/bootstrap.h"
#include "nodes/primnodes.h"
#include "utils/nabstime.h"
#include "access/htup.h"
#include "nodes/parsenodes.h"
#include "parser/scansup.h"
#include "bootstrap_tokens.h"
#define YY_NO_UNPUT
/* 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} {
yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */
yylval.ival = EnterString(scanstr((char*)yytext+1));
yytext[strlen(yytext)] = '"'; /* restore quotes */
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);
}
%%
int
yywrap(void)
{
return 1;
}
void
yyerror(const char *str)
{
fprintf(stderr,"\tsyntax error %d : %s",yyline, str);
}