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.7 1997/09/08 03:19:53 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 "utils/tqual.h"
43 #include "nodes/parsenodes.h"
45 #include "parser/scansup.h"
47 #include "bootstrap_tokens.h"
51 /* some versions of lex define this as a macro */
57 int yyline; /* keep track of the line number for error reporting */
64 id ([A-Za-z0-9_]|{oct}|\-)+
66 arrayid [A-Za-z0-9_]+\[{D}*\]
70 open { return(OPEN); }
72 close { return(XCLOSE); }
74 create { return(XCREATE); }
76 OID { return(OBJ_ID); }
77 bootstrap { return(XBOOTSTRAP); }
78 _null_ { return(NULLVAL); }
80 insert { return(INSERT_TUPLE); }
82 "," { return(COMMA); }
83 "=" { return(EQUALS); }
84 "(" { return(LPAREN); }
85 ")" { return(RPAREN); }
91 ^\#[^\n]* ; /* drop everything after "#" for comments */
94 "declare" { return(XDECLARE); }
95 "build" { return(XBUILD); }
96 "indices" { return(INDICES); }
97 "index" { return(INDEX); }
99 "using" { return(USING); }
101 yylval.ival = EnterString(MapArrayTypeName((char*)yytext));
105 yylval.ival = EnterString(scanstr((char*)yytext));
109 yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */
110 yylval.ival = EnterString(scanstr((char*)yytext+1));
111 yytext[strlen(yytext)] = '"'; /* restore quotes */
115 (-)?{D}+"."{D}*({Exp})? |
116 (-)?{D}*"."{D}+({Exp})? |
118 yylval.ival = EnterString((char*)yytext);
123 printf("syntax error %d : -> %s\n", yyline, yytext);
137 yyerror(const char *str)
139 fprintf(stderr,"\tsyntax error %d : %s",yyline, str);