2 /*-------------------------------------------------------------------------
5 * a lexical scanner for the bootstrap parser
7 * Copyright (c) 1994, Regents of the University of California
11 * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.3 1996/10/21 08:31:21 scrappy Exp $
13 *-------------------------------------------------------------------------
17 #include "storage/block.h"
18 #include "storage/off.h"
19 #include "storage/itemptr.h"
20 #include "catalog/pg_attribute.h"
21 #include "access/attnum.h"
22 #include "nodes/pg_list.h"
23 #include "access/tupdesc.h"
24 #include "access/itup.h"
25 #include "access/funcindex.h"
26 #include "storage/fd.h"
27 #include "catalog/pg_am.h"
28 #include "catalog/pg_class.h"
29 #include "nodes/nodes.h"
30 #include "rewrite/prs2lock.h"
31 #include "access/skey.h"
32 #include "access/strat.h"
33 #include "utils/rel.h"
34 #include "bootstrap/bootstrap.h"
36 #include "nodes/primnodes.h"
38 #include "utils/nabstime.h"
39 #include "access/htup.h"
40 #include "utils/tqual.h"
41 #include "nodes/parsenodes.h"
43 #include "parser/scansup.h"
45 #include "bootstrap_tokens.h"
47 /* some versions of lex define this as a macro */
53 int yyline; /* keep track of the line number for error reporting */
60 id ([A-Za-z0-9_]|{oct}|\-)+
62 arrayid [A-Za-z0-9_]+\[{D}*\]
66 open { return(OPEN); }
68 close { return(XCLOSE); }
70 create { return(XCREATE); }
72 OID { return(OBJ_ID); }
73 bootstrap { return(XBOOTSTRAP); }
74 _null_ { return(NULLVAL); }
76 insert { return(INSERT_TUPLE); }
78 "," { return(COMMA); }
79 "=" { return(EQUALS); }
80 "(" { return(LPAREN); }
81 ")" { return(RPAREN); }
87 ^\#[^\n]* ; /* drop everything after "#" for comments */
90 "declare" { return(XDECLARE); }
91 "build" { return(XBUILD); }
92 "indices" { return(INDICES); }
93 "index" { return(INDEX); }
95 "using" { return(USING); }
97 yylval.ival = EnterString(MapArrayTypeName((char*)yytext));
101 yylval.ival = EnterString(scanstr((char*)yytext));
105 yylval.ival = EnterString(scanstr((char*)yytext));
109 (-)?{D}+"."{D}*({Exp})? |
110 (-)?{D}*"."{D}+({Exp})? |
112 yylval.ival = EnterString((char*)yytext);
117 printf("syntax error %d : -> %s\n", yyline, yytext);
132 fprintf(stderr,"\tsyntax error %d : %s",yyline, str);