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.8 1997/11/24 05:07:56 momjian Exp $
13 *-------------------------------------------------------------------------
20 #include "storage/block.h"
21 #include "storage/off.h"
22 #include "storage/itemptr.h"
23 #include "catalog/pg_attribute.h"
24 #include "access/attnum.h"
25 #include "nodes/pg_list.h"
26 #include "access/tupdesc.h"
27 #include "access/itup.h"
28 #include "access/funcindex.h"
29 #include "storage/fd.h"
30 #include "catalog/pg_am.h"
31 #include "catalog/pg_class.h"
32 #include "nodes/nodes.h"
33 #include "rewrite/prs2lock.h"
34 #include "access/skey.h"
35 #include "access/strat.h"
36 #include "utils/rel.h"
37 #include "bootstrap/bootstrap.h"
39 #include "nodes/primnodes.h"
40 #include "utils/nabstime.h"
41 #include "access/htup.h"
42 #include "nodes/parsenodes.h"
44 #include "parser/scansup.h"
46 #include "bootstrap_tokens.h"
50 /* some versions of lex define this as a macro */
56 int yyline; /* keep track of the line number for error reporting */
63 id ([A-Za-z0-9_]|{oct}|\-)+
65 arrayid [A-Za-z0-9_]+\[{D}*\]
69 open { return(OPEN); }
71 close { return(XCLOSE); }
73 create { return(XCREATE); }
75 OID { return(OBJ_ID); }
76 bootstrap { return(XBOOTSTRAP); }
77 _null_ { return(NULLVAL); }
79 insert { return(INSERT_TUPLE); }
81 "," { return(COMMA); }
82 "=" { return(EQUALS); }
83 "(" { return(LPAREN); }
84 ")" { return(RPAREN); }
90 ^\#[^\n]* ; /* drop everything after "#" for comments */
93 "declare" { return(XDECLARE); }
94 "build" { return(XBUILD); }
95 "indices" { return(INDICES); }
96 "index" { return(INDEX); }
98 "using" { return(USING); }
100 yylval.ival = EnterString(MapArrayTypeName((char*)yytext));
104 yylval.ival = EnterString(scanstr((char*)yytext));
108 yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */
109 yylval.ival = EnterString(scanstr((char*)yytext+1));
110 yytext[strlen(yytext)] = '"'; /* restore quotes */
114 (-)?{D}+"."{D}*({Exp})? |
115 (-)?{D}*"."{D}+({Exp})? |
117 yylval.ival = EnterString((char*)yytext);
122 printf("syntax error %d : -> %s\n", yyline, yytext);
136 yyerror(const char *str)
138 fprintf(stderr,"\tsyntax error %d : %s",yyline, str);